@intent-hq/web 2.389.0 → 2.389.1

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/{DRbQVjcG.js → -MOfUnWK.js} +1 -1
  3. package/web/app/immutable/chunks/{Bauem7Ke.js → -iNNNnZP.js} +1 -1
  4. package/web/app/immutable/chunks/{qtHim0jP.js → 1biRkLeO.js} +1 -1
  5. package/web/app/immutable/chunks/{iIsyEXfi.js → 2TDNGwi2.js} +1 -1
  6. package/web/app/immutable/chunks/{B-r8Ld9c.js → 56loFVfQ.js} +1 -1
  7. package/web/app/immutable/chunks/{B91tdOJm.js → B-tK7hOH.js} +1 -1
  8. package/web/app/immutable/chunks/{k1pjOtcg.js → B2_6AX8w.js} +2 -2
  9. package/web/app/immutable/chunks/{HYdiaHV7.js → B3FnJcLx.js} +1 -1
  10. package/web/app/immutable/chunks/{hgE6oWwa.js → B7-Rf8Ja.js} +1 -1
  11. package/web/app/immutable/chunks/{T7iqVsMb.js → B7zssCpp.js} +1 -1
  12. package/web/app/immutable/chunks/{BdNfyyl1.js → B8rKVMLL.js} +1 -1
  13. package/web/app/immutable/chunks/{C9szebIt.js → BNu0Ucwh.js} +1 -1
  14. package/web/app/immutable/chunks/{2sf1Yn-s.js → BOyjfrDv.js} +1 -1
  15. package/web/app/immutable/chunks/{CeWx_dfN.js → BPcs9j0t.js} +1 -1
  16. package/web/app/immutable/chunks/{BwVhyX7o.js → BPmcj0VV.js} +1 -1
  17. package/web/app/immutable/chunks/{CgzHyieN.js → BRKRnHX6.js} +1 -1
  18. package/web/app/immutable/chunks/{0AIorxUa.js → BSXmccL1.js} +7 -7
  19. package/web/app/immutable/chunks/{Cp1B7D7t.js → BUo-3nO7.js} +1 -1
  20. package/web/app/immutable/chunks/{DVsXJTH5.js → B_EaOuZ7.js} +1 -1
  21. package/web/app/immutable/chunks/{s6Wn05Cg.js → B_QbDMuF.js} +1 -1
  22. package/web/app/immutable/chunks/{qWMP3EPi.js → BaH6sH1s.js} +1 -1
  23. package/web/app/immutable/chunks/{B4JMAhvp.js → Bb98JhKr.js} +1 -1
  24. package/web/app/immutable/chunks/{xXDRZ4UR.js → BbrUifYV.js} +1 -1
  25. package/web/app/immutable/chunks/{Di3tMG_J.js → Bc1CpNLz.js} +1 -1
  26. package/web/app/immutable/chunks/{dEPZ-XrU.js → BdrLG-E0.js} +1 -1
  27. package/web/app/immutable/chunks/{CXfRSojK.js → BfnPC1r8.js} +1 -1
  28. package/web/app/immutable/chunks/{BoCCPZlL.js → BiZ5HCfj.js} +1 -1
  29. package/web/app/immutable/chunks/{Bmlx0yvl.js → BjDM3rxu.js} +2 -2
  30. package/web/app/immutable/chunks/{D3shmp0V.js → BjVkuF0t.js} +1 -1
  31. package/web/app/immutable/chunks/{5J_xNo3h.js → BkqNdsh1.js} +2 -2
  32. package/web/app/immutable/chunks/{DM3Yrkkb.js → BouO3S3L.js} +1 -1
  33. package/web/app/immutable/chunks/{CUE71p7a.js → BqCpnQY_.js} +1 -1
  34. package/web/app/immutable/chunks/{C4UYdkwZ.js → BqXtiIKZ.js} +1 -1
  35. package/web/app/immutable/chunks/{Be-9sO50.js → BvDFX1mj.js} +1 -1
  36. package/web/app/immutable/chunks/{DN-c0DDt.js → BvZOajsk.js} +1 -1
  37. package/web/app/immutable/chunks/{BIVpRSxo.js → C1_cc_jh.js} +2 -2
  38. package/web/app/immutable/chunks/{D3vsaFn3.js → C4wGdw9l.js} +1 -1
  39. package/web/app/immutable/chunks/{CmBouCgt.js → C5YfJpVq.js} +2 -2
  40. package/web/app/immutable/chunks/{BhVbCtBE.js → C9Sx9tb_.js} +1 -1
  41. package/web/app/immutable/chunks/{D-q3diCz.js → CG1puMxA.js} +1 -1
  42. package/web/app/immutable/chunks/{fCCFSMRf.js → CHaC_gXH.js} +3 -3
  43. package/web/app/immutable/chunks/{CRPk37P7.js → CJ7X12Bw.js} +1 -1
  44. package/web/app/immutable/chunks/{vJJhwCPu.js → CKxZ8tlS.js} +1 -1
  45. package/web/app/immutable/chunks/{BQGIKN0g.js → CQlYR8ss.js} +1 -1
  46. package/web/app/immutable/chunks/{DBwApbzS.js → CTFqJlwB.js} +1 -1
  47. package/web/app/immutable/chunks/{BdQ54KL0.js → CTflyKHO.js} +1 -1
  48. package/web/app/immutable/chunks/{DZKOpbCv.js → CUeJC-BW.js} +1 -1
  49. package/web/app/immutable/chunks/{B-I8ZlVM.js → CUsiQpqx.js} +1 -1
  50. package/web/app/immutable/chunks/{mq9vi3Up.js → CVtmf86l.js} +3 -3
  51. package/web/app/immutable/chunks/{D63urNNT.js → CY1uQ_EK.js} +1 -1
  52. package/web/app/immutable/chunks/{Z2wqUYyr.js → CbGsjkOn.js} +2 -2
  53. package/web/app/immutable/chunks/{D17rwSNZ.js → CbwlFeZe.js} +1 -1
  54. package/web/app/immutable/chunks/{KvHDUk_b.js → CcDyBqhb.js} +2 -2
  55. package/web/app/immutable/chunks/{nfiajAfR.js → CeaP52uL.js} +1 -1
  56. package/web/app/immutable/chunks/{4VEtxogG.js → Cekr5Jry.js} +1 -1
  57. package/web/app/immutable/chunks/{85NDZF0c.js → Ch6a7ELM.js} +1 -1
  58. package/web/app/immutable/chunks/{BwCICkMn.js → ChXsVZci.js} +1 -1
  59. package/web/app/immutable/chunks/{Dsyh_lG5.js → Cj89j1C-.js} +1 -1
  60. package/web/app/immutable/chunks/{86aXQThN.js → ClbQbaTd.js} +1 -1
  61. package/web/app/immutable/chunks/{oBc79yRV.js → CmR2cnYT.js} +1 -1
  62. package/web/app/immutable/chunks/{BT5v4htV.js → CnNk48uP.js} +1 -1
  63. package/web/app/immutable/chunks/{D5dii3q-.js → CoGKQKFb.js} +1 -1
  64. package/web/app/immutable/chunks/{CS9nZ0mb.js → CpQ2QLnc.js} +1 -1
  65. package/web/app/immutable/chunks/{BR02ohTI.js → Cs6KI4dy.js} +1 -1
  66. package/web/app/immutable/chunks/{DtluaQEg.js → Cu11OjbU.js} +4 -4
  67. package/web/app/immutable/chunks/{D8EdnE4r.js → CyDuWtxr.js} +1 -1
  68. package/web/app/immutable/chunks/{R69_F6ow.js → D-19S-7Z.js} +1 -1
  69. package/web/app/immutable/chunks/{BNSbhHFY.js → D1CvgUga.js} +1 -1
  70. package/web/app/immutable/chunks/{DZz-0U7K.js → D3R31YXQ.js} +1 -1
  71. package/web/app/immutable/chunks/{Dl8k4QUp.js → D5WcE_P_.js} +1 -1
  72. package/web/app/immutable/chunks/{Z4vtXCdu.js → D6m95MWL.js} +1 -1
  73. package/web/app/immutable/chunks/{DDVnHnMH.js → D78ptBES.js} +3 -3
  74. package/web/app/immutable/chunks/{CdfbvT19.js → D915og2m.js} +1 -1
  75. package/web/app/immutable/chunks/{wX0L7qir.js → DA_7jaWc.js} +3 -3
  76. package/web/app/immutable/chunks/{CheN8m7G.js → DAoh5LIP.js} +1 -1
  77. package/web/app/immutable/chunks/{BWFaOHKx.js → DAwK7LKd.js} +1 -1
  78. package/web/app/immutable/chunks/{B6CGcXmK.js → DIvSo5Nm.js} +1 -1
  79. package/web/app/immutable/chunks/{DUJ7Uicl.js → DJ_B6Tb0.js} +1 -1
  80. package/web/app/immutable/chunks/{CIuThArl.js → DLnFsCgA.js} +3 -3
  81. package/web/app/immutable/chunks/{CFjHgtjF.js → DMomDPVD.js} +4 -4
  82. package/web/app/immutable/chunks/{DHz7ym-I.js → DNnyE4a4.js} +1 -1
  83. package/web/app/immutable/chunks/{DrF6vLLb.js → DPhH7vBg.js} +1 -1
  84. package/web/app/immutable/chunks/{CJ9ZGIU3.js → DQVuWRan.js} +1 -1
  85. package/web/app/immutable/chunks/{T6fchQhT.js → DRD4T4u0.js} +2 -2
  86. package/web/app/immutable/chunks/{C3vs7E1W.js → DSjchUEk.js} +1 -1
  87. package/web/app/immutable/chunks/{Cy--ZUaj.js → DWt5yjbU.js} +2 -2
  88. package/web/app/immutable/chunks/{Bm_geQt1.js → DXY_Cr2S.js} +1 -1
  89. package/web/app/immutable/chunks/{C8A41C8K.js → DYcuijJl.js} +1 -1
  90. package/web/app/immutable/chunks/{uftNwUIw.js → DZiUi6tE.js} +1 -1
  91. package/web/app/immutable/chunks/{gsePksRf.js → DaQPP3_d.js} +1 -1
  92. package/web/app/immutable/chunks/{DCFeaWgZ.js → Db4jRBl0.js} +1 -1
  93. package/web/app/immutable/chunks/{CkTunFkP.js → Dgc0jIMe.js} +1 -1
  94. package/web/app/immutable/chunks/{D2McplNW.js → DiBpIS7p.js} +1 -1
  95. package/web/app/immutable/chunks/{Ba3e0br1.js → DjbX62Cx.js} +1 -1
  96. package/web/app/immutable/chunks/{ublLekYt.js → DlWizs9I.js} +1 -1
  97. package/web/app/immutable/chunks/{Nthsb-68.js → Dm9VEl_l.js} +1 -1
  98. package/web/app/immutable/chunks/{CeZGOup4.js → DnhCnCMz.js} +1 -1
  99. package/web/app/immutable/chunks/{CM3NPzxs.js → Dz-zX_Ts.js} +1 -1
  100. package/web/app/immutable/chunks/{x0vz7jUI.js → EAuFbzCr.js} +1 -1
  101. package/web/app/immutable/chunks/{zA4TFq_E.js → IvX_QTkj.js} +1 -1
  102. package/web/app/immutable/chunks/{ByZRLPfm.js → J2YvrN12.js} +3 -3
  103. package/web/app/immutable/chunks/{g-pOypvE.js → JZ-O0OQl.js} +1 -1
  104. package/web/app/immutable/chunks/{BE4rQlti.js → MzHad0-m.js} +1 -1
  105. package/web/app/immutable/chunks/{DqRvDwkX.js → OIB4u9ZA.js} +1 -1
  106. package/web/app/immutable/chunks/{CB2iSm6U.js → OtJAfUmG.js} +1 -1
  107. package/web/app/immutable/chunks/{oEGQGYxq.js → PX_tznAF.js} +1 -1
  108. package/web/app/immutable/chunks/{Ci0dPfzv.js → RWuDgH63.js} +1 -1
  109. package/web/app/immutable/chunks/{BF_gPEg7.js → Rtit513z.js} +1 -1
  110. package/web/app/immutable/chunks/{BlTdGk3A.js → UZYqZZXR.js} +1 -1
  111. package/web/app/immutable/chunks/{BkYN9M7z.js → UsyUyHOM.js} +1 -1
  112. package/web/app/immutable/chunks/{C4sNRwZN.js → X6hYTxgn.js} +1 -1
  113. package/web/app/immutable/chunks/{DIPIWs2Q.js → cTFeOFQC.js} +4 -4
  114. package/web/app/immutable/chunks/{CzFnnQhI.js → cmil589m.js} +1 -1
  115. package/web/app/immutable/chunks/{JrdZaYjT.js → fKOcHw3K.js} +1 -1
  116. package/web/app/immutable/chunks/{C4JKtRY1.js → iTNhB2TC.js} +1 -1
  117. package/web/app/immutable/chunks/{sQSEv8Vy.js → j5mPVG9_.js} +1 -1
  118. package/web/app/immutable/chunks/{BVXrO_xP.js → kzuAnGps.js} +1 -1
  119. package/web/app/immutable/chunks/{2mfr9mCI.js → lei6Hlse.js} +1 -1
  120. package/web/app/immutable/chunks/{Cmw8ZiCg.js → lskgWJFV.js} +1 -1
  121. package/web/app/immutable/chunks/{CrK7N1sc.js → lzi3tV-r.js} +1 -1
  122. package/web/app/immutable/chunks/{CqqkIXTJ.js → pe4pVEc5.js} +1 -1
  123. package/web/app/immutable/chunks/{Da5bNPjQ.js → r3TSpOm2.js} +1 -1
  124. package/web/app/immutable/chunks/{97-360Ms.js → rEuNpCjM.js} +1 -1
  125. package/web/app/immutable/chunks/{Beb33qQi.js → rdKijoRw.js} +1 -1
  126. package/web/app/immutable/chunks/{D36a16oA.js → sPwEr0L4.js} +2 -2
  127. package/web/app/immutable/chunks/{CndXvgyH.js → tqn1yslZ.js} +6 -6
  128. package/web/app/immutable/chunks/{DOmB999d.js → yqU168vt.js} +1 -1
  129. package/web/app/immutable/entry/{app.Beuvfwpq.js → app.CD-KpBFY.js} +2 -2
  130. package/web/app/immutable/entry/start.BtJunRGi.js +1 -0
  131. package/web/app/immutable/nodes/{0.cL5zt7Bt.js → 0.BTKBksQU.js} +1 -1
  132. package/web/app/immutable/nodes/{1.Dj9s42wq.js → 1.CDH50XYo.js} +1 -1
  133. package/web/app/immutable/nodes/{10.CQpwV39P.js → 10.BSK1ezgF.js} +1 -1
  134. package/web/app/immutable/nodes/{11.ryjds32c.js → 11.BkTyY8lh.js} +1 -1
  135. package/web/app/immutable/nodes/{15.ffzaVnT8.js → 15.CRngZgh2.js} +1 -1
  136. package/web/app/immutable/nodes/{19.COuvk-IK.js → 19.CI9f3oHV.js} +2 -2
  137. package/web/app/immutable/nodes/{2.CyeHTGza.js → 2.BPIXyW9K.js} +1 -1
  138. package/web/app/immutable/nodes/{3.Cli5S3q6.js → 3.CjIzds8z.js} +1 -1
  139. package/web/app/immutable/nodes/{4.DnwVlUKb.js → 4.BzXxqxag.js} +1 -1
  140. package/web/app/immutable/nodes/{5.BBLKg00X.js → 5.B54vgJ_P.js} +1 -1
  141. package/web/app/immutable/nodes/{6.D_zrx8Je.js → 6.plJT8OLe.js} +1 -1
  142. package/web/app/immutable/nodes/{7.CbiG1FxN.js → 7.DSDH5hqz.js} +1 -1
  143. package/web/app/immutable/nodes/{8.BqucsZP2.js → 8.B7U72PdE.js} +1 -1
  144. package/web/app/immutable/nodes/{9.YctElBWI.js → 9.BY44vZ0i.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.dSf-uLxv.js +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/uvhZkGDU.js","/app/immutable/chunks/B9vHutcJ.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BBFoj-dS.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BwNrQXlF.js","/app/immutable/chunks/CLAmm_T1.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/C2UL5Ler.js","/app/immutable/chunks/_UjuBCOJ.js","/app/immutable/chunks/DPttSllj.js","/app/immutable/chunks/BwH4Bvte.js","/app/immutable/chunks/BFgvMDua.js","/app/immutable/chunks/CcJmuwXr.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/B1CKzIA2.js","/app/immutable/chunks/TB9r2XJy.js","/app/immutable/chunks/UTM5G-w-.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BGrimfDs.js","/app/immutable/chunks/Cu5e4npY.js","/app/immutable/chunks/aZdb_rCN.js","/app/immutable/chunks/BPQFiQQc.js","/app/immutable/chunks/96V4v2iI.js","/app/immutable/chunks/nxtepGjE.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/CIbfGsF-.js","/app/immutable/chunks/BbYWP3Ow.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/CfNIzRu8.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.DylRFR3N.css"])))=>i.map(i=>d[i]);
2
- var ne=Object.defineProperty;var oe=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>oe(e,typeof t!="symbol"?t+"":t,r);import{JH as a,uC as ce,n_ as k,nZ as y,mq as le,c9 as de,c8 as ue,cn as pe,cm as ge,z6 as C,z7 as B,z4 as he,z3 as fe,z5 as Se,rV as be,o0 as w}from"./B9vHutcJ.js";import{cU as me,cJ as ve,bJ as _e,cS as Q,aJ as Ae,c3 as ke,c$ as ye,cl as we,cB as Ee,cn as Ce}from"./C2UL5Ler.js";import{a as Pe,i as Re}from"./CL3a4Hm1.js";import{c as N}from"./ChTqQfQN.js";import{x as Me,aO as Te,c as Ie,aD as Fe,B as De,y as Le,z as xe}from"./DQw0Iiac.js";import{a0 as Oe,K as J,a1 as We,ay as U,Z as Be,a3 as Ge,L as Ve,$ as Ne,aA as Ue,x as He}from"./KnkAG0HD.js";import{bm as n,_ as qe}from"./CLAmm_T1.js";import{i as D}from"./BBWuirRW.js";import{n as ze}from"./Cy--ZUaj.js";const $e=5,L=120,je=4e3,j=.2,Ke=.8;function Ze(e,t,r=$e){const s=e.length>0?t/(2*e.length):0,i=je/L;return Array.from({length:r},(o,l)=>{if(s<=0)return 0;const c=L*i**(l/r),g=L*i**((l+1)/r),f=Math.min(e.length-1,Math.floor(c/s)),b=Math.min(e.length,Math.max(f+1,Math.ceil(g/s)));let z=0;for(let F=f;F<b;F+=1)z+=e[F]??0;const $=(z/(b-f)/255-j)/(Ke-j);return Number.isFinite($)?Math.min(1,Math.max(0,$)):0})}const _r=a.createSelector(e=>me.select(e)?.capabilities.gitlabCheckout===!0),Ar=a.createSelector(e=>e.gitlabAuth.host),kr=a.createSelector(e=>e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host),yr=a.createSelector(e=>ce(e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host)??""),wr=a.createSelector(e=>e.gitlabAuth.isCancelling),Er=a.createSelector(e=>e.gitlabAuth.cancelOutcome),Cr=a.createSelector(e=>e.gitlabAuth.isConfigured),Pr=a.createSelector(e=>e.gitlabAuth.isAuthenticating),Rr=a.createSelector(e=>e.gitlabAuth.deviceFlow),Mr=a.createSelector(e=>e.gitlabAuth.deviceGrantSupported),Tr=a.createSelector(e=>e.gitlabAuth.user),Ir=a.createSelector(e=>e.gitlabAuth.error);a.createSelector(e=>e.gitlabAuth.method);const Fr=a.createSelector(e=>e.gitlabAuth.statusReady===!0),A=[{id:"pr-reviewer",icon:"pr-reviewer",get name(){return n.specialists_builtin_prReviewer_name()},get description(){return n.specialists_builtin_prReviewer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"ui-designer",icon:"ui-designer",get name(){return n.specialists_builtin_uiDesigner_name()},get description(){return n.specialists_builtin_uiDesigner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"vulnerability-scanner",icon:"pr-reviewer",get name(){return n.specialists_builtin_vulnerabilityScanner_name()},get description(){return n.specialists_builtin_vulnerabilityScanner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"developer",icon:"verifier",get name(){return n.specialists_builtin_developer_name()},get description(){return n.specialists_builtin_developer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"product-manager",icon:"coordinator",get name(){return n.specialists_builtin_productManager_name()},get description(){return n.specialists_builtin_productManager_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"maintenance-coordinator",icon:"ralph",get name(){return n.specialists_builtin_maintenanceCoordinator_name()},get description(){return n.specialists_builtin_maintenanceCoordinator_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"chief-of-staff",icon:"chief-of-staff",get name(){return n.specialists_builtin_chiefOfStaff_name()},get description(){return n.specialists_builtin_chiefOfStaff_description()},hidden:!0,defaultBehaviorPrompt:"",promptUnavailable:!0}],Y=new Set(["pr-reviewer"]),Dr="developer";function Lr(e){return A.find(t=>t.id===e)}const Qe=a.createSelector(e=>e.githubAuth.mutationRequestId),Je=a.createSelector(e=>e.githubAuth.callbacksCancelled),Ye=a.createSelector(e=>e.githubAuth.isDisconnecting),X=a.createSelector(e=>e.githubAuth.isAuthenticated),Xe=a.createSelector(e=>e.githubAuth.statusSettled===!0),et=a.createSelector(e=>e.githubAuth.requiresDaemonAuth),tt=a.createSelector(e=>e.githubAuth.user),rt=a.createSelector(e=>e.githubAuth.isAuthenticating),st=a.createSelector(e=>e.githubAuth.deviceFlow),it=a.createSelector(e=>e.githubAuth.error),xr=Object.freeze(Object.defineProperty({__proto__:null,selectGitHubAuthCallbacksCancelled:Je,selectGitHubAuthDeviceFlow:st,selectGitHubAuthError:it,selectGitHubAuthIsAuthenticated:X,selectGitHubAuthIsAuthenticating:rt,selectGitHubAuthIsDisconnecting:Ye,selectGitHubAuthMutationRequestId:Qe,selectGitHubAuthRequiresDaemonAuth:et,selectGitHubAuthStatusSettled:Xe,selectGitHubAuthUser:tt},Symbol.toStringTag,{value:"Module"}));function u(e){return e??""}function at(e,t){const r=e??[],s=t??[];return r.length===s.length&&r.every((i,o)=>u(i.provider)===u(s[o].provider)&&i.model===s[o].model&&i.hint===s[o].hint&&u(i.reasoningEffort)===u(s[o].reasoningEffort))}function K(e,t){if(e.source!=="user"||!t?.ignoreModelPin&&(e.model||e.codingAgent))return!1;const r=e.bundled;return r?u(e.name)===u(r.name)&&u(e.description)===u(r.description)&&u(e.behaviorPrompt)===u(r.behaviorPrompt)&&u(e.roleReminder)===u(r.roleReminder)&&u(e.reasoningEffort)===u(r.reasoningEffort)&&at(e.modelOptions,r.modelOptions):!1}const Or=a.createSelector(e=>e.specialists.bundledSpecialists),nt=a.createSelector(e=>e.specialists.fileSpecialists),Wr=a.createSelector(e=>k(nt.select(e))),Br=a.createSelector(e=>e.specialists.userOverrides);a.createSelector(e=>e.specialists.overridesLoaded);const Gr=a.createSelector(e=>e.specialists.customSpecialistsLoaded),Vr=a.createSelector(e=>e.specialists.fileSpecialistsLoaded),Nr=a.createSelector(e=>e.specialists.bundledSpecialistsLoaded),Ur=a.createSelector(e=>e.specialists.specialistsFolderPath),Hr=a.createSelector((e,t)=>{if(!t)return e.specialists.defaultSpecialistId??"";const r=e.providerCatalog?.byWorkspaceId?.[t]?.settings.find(s=>s.path==="specialists.default")?.value;return typeof r=="string"?r:""});a.createSelector(e=>e.specialists.providerModelOverrides);const x=a.createSelector((e,t)=>!(Y.has(t)&&!X.select(e)));function ot(e,t){return t?e:e.filter(r=>!Y.has(r.id))}function ct(e,t){return ot(e,t).filter(r=>!r.hidden)}function qr(e,t){return ct(e,t).filter(r=>r.role!=="internal")}const v=a.createSelector((e,t)=>{if(t)return(e.providerCatalog?.byWorkspaceId?.[t]?.specialists??[]).map(c=>({...c,defaultModel:c.model,defaultBehaviorPrompt:c.behaviorPrompt??c.prompt??"",defaultAgentType:c.agentType}));const r=k(e.specialists.fileSpecialists),s=e.specialists.bundledSpecialists,i=new Set,o=[];for(const c of r)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push({id:c.id,name:c.name,description:c.description,codingAgent:c.codingAgent,defaultModel:c.model||void 0,defaultBehaviorPrompt:c.behaviorPrompt,roleReminder:c.roleReminder,source:c.source,importedFrom:c.importedFrom,unsupportedFields:c.unsupportedFields,requiredSkills:c.requiredSkills,missingSkills:c.missingSkills,hidden:c.hidden,resolvedModel:c.resolvedModel,resolvedProvider:c.resolvedProvider,modelOptions:c.modelOptions,reasoningEffort:c.reasoningEffort,role:c.role,teamAgents:c.teamAgents,icon:c.icon}));for(const c of s)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push(c));if(!e.specialists.bundledSpecialistsLoaded&&r.length===0&&s.length===0)for(const c of A)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push(c));const l=new Map;for(const c of A)l.has(c.id)||l.set(c.id,l.size);for(const c of s)l.has(c.id)||l.set(c.id,l.size);return o.sort((c,g)=>{const f=l.has(c.id),b=l.has(g.id);return f&&b?(l.get(c.id)??0)-(l.get(g.id)??0):f&&!b?-1:!f&&b?1:c.name.localeCompare(g.name)}),o}),zr=a.createSelector(e=>{const t=v.select(e).filter(s=>s.role==="orchestrator");if(t.length===0)return null;const r=new Set([...A.map(({id:s})=>s),...e.specialists.bundledSpecialists.map(({id:s})=>s)]);return t.sort((s,i)=>+!r.has(s.id)-+!r.has(i.id)||s.id.localeCompare(i.id)),t[0]}),lt=a.createSelector((e,t)=>{const r=y(e.specialists.fileSpecialists,t);if(r)return{id:r.id,name:r.name,description:r.description,source:r.source};const s=e.specialists.bundledSpecialists.find(i=>i.id===t);if(s)return{id:s.id,name:s.name,description:s.description,source:"builtin"};if(!e.specialists.bundledSpecialistsLoaded&&k(e.specialists.fileSpecialists).length===0&&e.specialists.bundledSpecialists.length===0){const i=A.find(o=>o.id===t);if(i)return{id:i.id,name:i.name,description:i.description,source:"builtin"}}return null}),$r=a.createSelector((e,t)=>lt.select(e,t)?.name??null),jr=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultModel?i.defaultModel:i.resolvedModel??"":""}),Kr=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.defaultModel||void 0),Zr=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.reasoningEffort||void 0),Qr=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultBehaviorPrompt:""});function P(e,t){return t.some(r=>r.id===e)||A.some(r=>r.id===e)}const Jr=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.importedFrom?!1:s.source==="bundled"||s.source==="user"&&P(t,e.specialists.bundledSpecialists)}return P(t,e.specialists.bundledSpecialists)}),Yr=a.createSelector((e,t,r)=>r?!!H.select(e,t,r):!!y(e.specialists.fileSpecialists,t)),Xr=a.createSelector((e,t,r)=>{if(r){const o=H.select(e,t,r);return!o||o.importedFrom||o.source==="project"?!1:P(t,e.specialists.bundledSpecialists)&&!K(o)}if(!P(t,e.specialists.bundledSpecialists))return!1;const i=y(e.specialists.fileSpecialists,t);return!i||i.source!=="user"?!1:!K(i)}),H=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.source==="bundled"?void 0:{...s,source:s.source,model:s.model??"",behaviorPrompt:s.behaviorPrompt??s.prompt??"",filePath:s.path??""}}return y(e.specialists.fileSpecialists,t)}),es=a.createSelector((e,t,r)=>{const s=H.select(e,t,r);return r&&!s?e.providerCatalog?.byWorkspaceId?.[r]?.specialists.some(i=>i.id===t)?"Built-in":null:s?.source==="project"?"Project":s?.source==="user"?"User":e.specialists.bundledSpecialists.some(i=>i.id===t)?"Built-in":null}),ts=a.createSelector((e,t,r)=>{if(r)return e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(o=>o.id===t)?.path;const s=y(e.specialists.fileSpecialists,t);if(s)return s.filePath;const i=e.specialists.bundledSpecialists.find(o=>o.id===t);if(i&&"filePath"in i)return i.filePath}),rs=a.createSelector((e,t,r)=>{if(r){const i=v.select(e,r).find(c=>c.id===t),o=i?.codingAgent||i?.resolvedProvider;if(o)return ve.select(e,o,r);const l=_e.select(e,r);return e.providerCatalog?.byWorkspaceId?.[r]?.readiness[l]?.available?l:""}const s=y(e.specialists.fileSpecialists,t);return s?.codingAgent?s.codingAgent:dt.select(e,t)}),dt=a.createSelector((e,t)=>{const s=v.select(e).find(i=>i.id===t);return s?.codingAgent?s.codingAgent:Oe.select(e)?J.select(e):""}),ss=a.createSelector((e,t)=>{if(t)return e.providerCatalog?.byWorkspaceId?.[t]?.importDiagnostics??[];const r=e.specialists.importDiagnostics;return r?k(r):[]}),is=a.createSelector((e,t)=>e.specialists.creationByContext?.[t]??le),as=a.createSelector(e=>Object.values(e.specialists.creationByContext??{}).flatMap(t=>t.specialistId?[t.specialistId]:[])),O=N("Clipboard");async function ns(e){let t;if(Pe())try{const r=await Re("system:write-clipboard",{text:e});if(r?.success===!1)throw new Error(r.error||"Electron clipboard write failed");return}catch(r){t=r,O.warn("Electron clipboard write failed; falling back to browser clipboard",{error:r})}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch(r){throw O.error("Browser clipboard write failed",r,{electronError:t}),r}throw O.error("No clipboard write API is available",void 0,{electronError:t}),t instanceof Error?t:new Error("Clipboard write API unavailable")}function os(e,t){if(!e||!t||t===e.providerId)return!1;const r=e.providerSettings[t];return!!(r&&[r.defaultModel,...Object.values(r.typeOverrides??{})].some(s=>typeof s=="string"&&s.includes(":")))}let ut=0;function pt(e,t){const r=++ut;return a.dispatch(ue(e,t,r)),r}function cs(e,t,r){a.dispatch(de(e,t,r))}async function ee(e,t,r,s){const i=crypto.randomUUID(),o=s?.source??"control";try{return(await a.dispatch(pe({requestId:i,consumerId:o,agentId:e,workspaceId:t,operation:r,connection:Q.select(a.state)},{...s,intent:s?.intent??pt(e,t)}))).status==="success"}finally{a.dispatch(ge(i,o))}}async function ls(e,t,r,s,i){return ee(e,t,{kind:"effort",effort:r,previous:s},i)}async function ds(e,t,r,s,i){return ee(e,t,{kind:"reconcile",current:r??null,levels:s},i)}const gt=a.createSelector((e,t)=>k(e.agentModel.mutations).filter(r=>r.consumerId===t)),us=a.createSelector((e,t)=>gt.select(e,t).some(r=>r.status==="pending")),ps=a.createSelector((e,t,r)=>{const s=e.agentSessions.byAgentId[t],i=Ae.select(e,t),o=Me.select(e,t),l=e.daemonHealth.stats?.protocolVersion,c=Te(l),g=c?Ie(s?.model,null,o):s?.model;return{session:s,providerId:i,levels:o,legacy:c,identity:JSON.stringify([g,i]),connection:Q.select(e),canWrite:!!s&&s.workspaceId===r&&!ke.select(e,r)}});function ht(e,t,r=!1){const s=t?.available===!0&&t.viaNpx!==!0;return e!=="auggie"||s||r}const gs=a.createSelector(e=>We.select(e)?null:U.select(e)),ft=a.createSelector(e=>e.providerCatalog?.workspaceEpoch??0),S=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]:void 0),hs=a.createSelector(e=>Object.keys(e.providerCatalog?.byWorkspaceId??{})),fs=a.createSelector((e,t)=>!!S.select(e,t)&&e.providerCatalog.workspaceSnapshotEpochs?.[t]===ft.select(e)),te=a.createSelector((e,t)=>t?S.select(e,t)?.catalog.providers??[]:ye.select(e)),re=a.createSelector((e,t)=>{if(!t)return J.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="model.defaultProvider")?.value;return typeof r=="string"?r:""}),q=a.createSelector((e,t)=>{if(!t)return Be.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="providers.enabled")?.value;return r&&typeof r=="object"?r:{}}),se=a.createSelector((e,t)=>{if(!t)return Ge.select(e);const r=q.select(e,t),s=re.select(e,t),i=S.select(e,t)?.readiness??{};return te.select(e,t).filter(o=>o.visible&&(!o.canBeDisabled||r[o.id]||o.id===s)&&i[o.id]?.available).map(o=>o.id)}),Ss=a.createSelector((e,t)=>{const r=q.select(e,t),s=t?S.select(e,t)?.readiness??{}:U.select(e);return te.select(e,t).filter(i=>ht(i.id,s[i.id],r[i.id]===!0)).map(i=>i.id)}),bs=a.createSelector((e,t)=>t?se.select(e,t):Ve.select(e)),ms=a.createSelector((e,t)=>v.select(e,t)),vs=a.createSelector((e,t)=>t?!!S.select(e,t):Ne.select(e)),_s=a.createSelector((e,t)=>{if(!t)return Fe.select(e);const r=S.select(e,t)?.settings??[],s=re.select(e,t),i=r.find(c=>c.path==="model.providerDefaults")?.value,o=i&&typeof i=="object"?i[s]:void 0;if(typeof o=="string")return o;const l=r.find(c=>c.path==="model.default")?.value;return typeof l=="string"?l:""}),As=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning?[[r,s.warning]]:[])):De.select(e)),ks=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).map(([r,s])=>[r,s.stale===!0])):Le.select(e)),ys=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning&&s.warningKind?[[r,s.warningKind]]:[])):xe.select(e)),ws=a.createSelector((e,t,r)=>{if(!r)return Ue.select(e,t);const s=q.select(e,r),i=S.select(e,r);return se.select(e,r).filter(o=>o!==t&&(s[o]||i?.catalog.providers.find(l=>l.id===o)?.canBeDisabled===!1)&&He(o,i?.readiness[o]?.authenticated))}),Es=a.createSelector((e,t)=>t?S.select(e,t)?.readiness??{}:U.select(e)),St={},Cs=a.createSelector(e=>e.providerSettings?.profiles?.status??St),Ps=a.createSelector(e=>e.directoryPicker.source??"daemon"),Rs=a.createSelector(e=>e.directoryPicker.listing),Ms=a.createSelector(e=>e.directoryPicker.loading),Ts=a.createSelector(e=>e.directoryPicker.error),Is=a.createSelector(e=>e.directoryPicker.pathError),Fs=a.createSelector(e=>e.directoryPicker.createError),bt=N("WorkspaceValidation");async function Ds(e,t=!1,r=!1){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_repoPathRequired_error(),suggestion:n.workspace_validation_repoPathRequired_suggestion()};const s=e.trim();return mt(s)?_t(s):At(s,t,r)}function mt(e){return[/^https?:\/\/github\.com\//i,/^git@github\.com:/i,/^github\.com\//i,/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/].some(r=>r.test(e.trim()))}function vt(e){const t=e.trim(),r=[/^https?:\/\/github\.com\/([^\/]+)\/([^\/]+)$/i,/^git@github\.com:([^\/]+)\/([^\/]+)$/i,/^github\.com\/([^\/]+)\/([^\/]+)$/i];for(const i of r){const o=t.match(i);if(o){const l=o[2].replace(/\.git$/,"");return l?{owner:o[1],repo:l}:null}}const s=t.match(/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/);if(s&&!t.includes("\\")&&!t.includes(":")){const i=s[2].replace(/\.git$/,"");return i?{owner:s[1],repo:i}:null}return null}async function _t(e){return vt(e)?{valid:!0,warning:n.workspace_validation_githubCloneLocally_warning()}:{valid:!1,error:n.workspace_validation_invalidGithubUrl_error(),suggestion:n.workspace_validation_invalidGithubUrl_suggestion()}}async function At(e,t=!1,r=!1){if(e.includes("\0"))return{valid:!1,error:n.workspace_validation_nullCharacters_error()};if(!e.startsWith("/")&&!e.startsWith("~")&&!e.startsWith(".")&&!e.includes(":\\")&&!/^[a-zA-Z]:\//.test(e))return{valid:!1,error:n.workspace_validation_pathNotAbsolute_error(),suggestion:n.workspace_validation_pathNotAbsolute_suggestion()};if(typeof window<"u"&&window.electronAPI)try{const s=await D("file:getDirectoryStatus",{path:e});if(s.success&&s.data){const l=s.data;return l.exists?l.isDirectory?l.isGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l}:l.isSubdirectoryOfGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l,warning:n.workspace_validation_insideParentRepo_warning({path:l.parentGitRoot??""})}:r?{valid:!0,isNewRepo:!1,directoryStatus:l}:t?l.isEmpty?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_emptyDirInit_warning()}:{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_nonGitDirInit_warning()}:{valid:!1,error:n.workspace_repoSelector_notGitRepository_label(),directoryStatus:l}:{valid:!1,error:n.workspace_validation_notDirectory_error(),suggestion:n.workspace_validation_notDirectory_suggestion(),directoryStatus:l}:t?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExist_suggestion(),directoryStatus:l}}if(!(await D("file:exists",{path:e})).exists)return t?{valid:!0,isNewRepo:!0,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExistLegacy_suggestion()};const o=await D("git:isRepository",{path:e});if(!t&&o?.isRepository!==!0)return{valid:!1,error:o?.isRepository===!1?n.workspace_repoSelector_notGitRepository_label():n.workspace_compactInitializer_gitCheckUnknown_label()};if(!o.isRepository)return{valid:!0,isNewRepo:!0,warning:n.workspace_validation_nonGitInit_warning()}}catch(s){if(bt.warn("Could not validate path existence",s),!t)return{valid:!1,error:n.workspace_compactInitializer_gitCheckUnknown_label()}}return{valid:!0,isNewRepo:!1}}function Ls(e){if(!e||e.trim().length===0)return{valid:!0};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchPrefixInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:t==="."||t===".."||t.startsWith(".")?{valid:!1,error:n.workspace_validation_branchPrefixDot_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchPrefixConsecutive_error()}:t.startsWith("/")?{valid:!1,error:n.workspace_validation_branchPrefixSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchPrefixLock_error()}:t.length>50?{valid:!1,error:n.workspace_validation_branchPrefixTooLong_error()}:{valid:!0}}function xs(e){if(!e||e.trim().length===0)return"";let t=e.trim().replace(/^[./]+/,"").replace(/[\s~^:?*\[\]\\]/g,"-").replace(/\.{2,}/g,"-").replace(/\/{2,}/g,"/").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/\.lock$/,"").toLowerCase();return t.length>0&&!t.endsWith("/")&&!t.endsWith("-")&&(t=t.includes("/")?`${t}/`:`${t}/`),t}function Os(e){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_branchNameRequired_error()};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchNameInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:["HEAD",".",".."].includes(t)?{valid:!1,error:n.workspace_validation_branchNameReserved_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchNameConsecutive_error()}:t.startsWith("/")||t.endsWith("/")?{valid:!1,error:n.workspace_validation_branchNameSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchNameLock_error()}:{valid:!0}}function Ws(e){return!e||e.trim().length===0?{valid:!0}:e.trim().length>1e5?{valid:!1,error:n.workspace_validation_promptTooLong_error(),suggestion:n.workspace_validation_promptTooLong_suggestion()}:{valid:!0}}function Bs(e){const t=e.toLowerCase();return t.includes("maxbuffer")?n.workspace_gitError_maxBuffer():t.includes("clone")&&t.includes("timed out")?n.workspace_gitError_cloneTimeout():t.includes("json-rpc request timed out: workspace.create")?n.workspace_gitError_createTimeout():t.includes("timed out")&&["git","clone","fetch","worktree","pull","push","rebase","merge"].some(r=>t.includes(r))?n.workspace_gitError_gitTimeout():t.includes("git clone failed")?t.includes("could not read from remote")?n.workspace_gitError_cloneRemote():t.includes("authentication")||t.includes("permission denied")||t.includes("access denied")?n.workspace_gitError_cloneAuth():n.workspace_gitError_cloneFailed():t.includes("could not resolve any ref to create worktree")?n.workspace_gitError_worktreeRef():t.includes("failed to write file")?t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_writePermission():t.includes("enospc")||t.includes("disk space")?n.workspace_gitError_diskSpaceFree():t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_writeNoEnt():e:t.includes("failed to read file")?t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_readNotFound():t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_readPermission():e:t.includes("permission denied")?n.workspace_gitError_permissionDenied():t.includes("not found")||t.includes("enoent")?n.workspace_gitError_notFound():t.includes("already exists")?n.workspace_gitError_alreadyExists():t.includes("network")||t.includes("etimedout")?n.workspace_gitError_network():t.includes("authentication")||t.includes("401")?t.includes("private repositor")?e:n.workspace_gitError_authFailed():t.includes("rate limit")||t.includes("403")?n.workspace_gitError_rateLimit():t.includes("disk space")||t.includes("enospc")?n.workspace_gitError_diskSpace():e}const kt=["idle","exited"];function yt(e){return e===void 0||!kt.includes(e)}function Gs(e){return e.status==="restarting"?"restarting":yt(e.status)?"running":e.status==="idle"?"idle":e.exitCode===0?"succeeded":e.exitCode===null||e.exitCode===void 0?"exited":e.exitCode>=128?"stopped":"failed"}function wt(e){return e.engine==="os"?"os":e.isLoading||e.keyConfigured[e.provider]===!0?"daemon":e.osEngineAvailable?"os":"unavailable"}const Vs=a.createSelector(e=>e.voiceSettings.isLoading),Ns=a.createSelector(e=>e.voiceSettings.available),Us=a.createSelector(e=>e.voiceSettings.provider),Hs=a.createSelector(e=>e.voiceSettings.engine),qs=a.createSelector(e=>e.voiceSettings.osEngineAvailable),zs=a.createSelector(e=>e.voiceSettings.keyConfigured),$s=a.createSelector(e=>e.voiceSettings.vocabulary),js=a.createSelector(e=>e.voiceSettings.openaiModel),Ks=a.createSelector(e=>e.voiceSettings.language),Zs=a.createSelector(e=>e.voiceSettings.workspaceVocabularyMaxTerms),Qs=a.createSelector(e=>e.voiceSettings.inputDeviceId),Js=a.createSelector(e=>e.voiceSettings.inputDevices),Ys=a.createSelector(e=>e.voiceSettings.busyProvider),Xs=a.createSelector(e=>e.voiceSettings.error),ei=a.createSelector(e=>we.select(e)?"unavailable":wt(e.voiceSettings)),G="intent.voice.inputDevice";let V;function Et(){if(V!==void 0)return V;try{const e=localStorage.getItem(G);return typeof e=="string"&&e!==""?e:null}catch{return null}}function ti(e){V=e;try{e===null?localStorage.removeItem(G):localStorage.setItem(G,e)}catch{}}let R=null;function ri(e){R=e}function si(){const e=R;return R=null,e}function Ct(){R=null}const Pt=300,Rt=300;class Mt{constructor(t){d(this,"holdThresholdMs");d(this,"doublePressWindowMs");d(this,"onRecordStart");d(this,"onRecordStop");d(this,"currentState","idle");d(this,"timer",null);this.holdThresholdMs=t.holdThresholdMs??Pt,this.doublePressWindowMs=t.doublePressWindowMs??Rt,this.onRecordStart=t.onRecordStart,this.onRecordStop=t.onRecordStop}get state(){return this.currentState}keyDown(){switch(this.currentState){case"idle":this.currentState="first-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding"}),this.onRecordStart();break;case"await-second-press":this.clearTimer(),this.currentState="second-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding-send"});break;case"latched":this.currentState="latched-press";break;case"latched-await-second":this.clearTimer(),this.currentState="draining",this.onRecordStop({stopReason:"double-press",autoSend:!0});break}}keyUp(){switch(this.currentState){case"first-press":this.clearTimer(),this.currentState="await-second-press",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="latched"});break;case"holding":this.currentState="idle",this.onRecordStop({stopReason:"hold-release",autoSend:!1});break;case"second-press":this.clearTimer(),this.currentState="idle",this.onRecordStop({stopReason:"double-press",autoSend:!0});break;case"holding-send":this.currentState="idle",this.onRecordStop({stopReason:"double-hold-release",autoSend:!0});break;case"latched-press":this.currentState="latched-await-second",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="idle",this.onRecordStop({stopReason:"latch-stop",autoSend:!1})});break;case"draining":this.currentState="idle";break}}reset(){this.clearTimer(),this.currentState="idle"}armTimer(t,r){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,r()},t)}clearTimer(){this.timer!==null&&clearTimeout(this.timer),this.timer=null}}let M=null;function ii(e){M=e}function ai(){const e=M;return M=null,e}function Tt(){M=null}const It=66;function Ft(e,t){const r=globalThis.AudioContext;if(typeof r!="function")return()=>{};let s,i,o;try{s=new r,i=s.createMediaStreamSource(e),o=s.createAnalyser(),o.fftSize=1024,o.smoothingTimeConstant=.5,o.minDecibels=-85,o.maxDecibels=-25,i.connect(o)}catch{return i?.disconnect(),s?.close().catch(()=>{}),()=>{}}if(!s||!i)return()=>{};const l=s,c=i,g=new Uint8Array(o.frequencyBinCount),f=setInterval(()=>{o.getByteFrequencyData(g),t(Ze(g,l.sampleRate))},It);let b=!1;return()=>{b||(b=!0,clearInterval(f),c.disconnect(),l.close().catch(()=>{}))}}const Dt=12e4,Lt=["audio/webm;codecs=opus","audio/webm"];function ni(){return typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof MediaRecorder<"u"}function xt(e){return e?{audio:{deviceId:{ideal:e}}}:{audio:!0}}function Ot(){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Lt.find(e=>MediaRecorder.isTypeSupported(e))}class Wt{constructor(t){d(this,"maxDurationMs");d(this,"now");d(this,"callbacks");d(this,"deviceId");d(this,"onLevels");d(this,"stopMeter",null);d(this,"currentState","idle");d(this,"recorder",null);d(this,"stream",null);d(this,"chunks",[]);d(this,"startedAt",0);d(this,"maxTimer",null);d(this,"discardRequested",!1);d(this,"cancelRequested",!1);this.maxDurationMs=t.maxDurationMs??Dt,this.now=t.now??Date.now,this.callbacks={onFinished:t.onFinished,onError:t.onError},this.deviceId=t.deviceId??null,this.onLevels=t.onLevels}get state(){return this.currentState}async start(){if(this.currentState!=="idle")return"discarded";this.currentState="starting";let t;try{t=await navigator.mediaDevices.getUserMedia(xt(this.deviceId))}catch(i){const o=this.discardRequested;return this.currentState="stopped",o||this.callbacks.onError(i),o?"discarded":"error"}if(this.discardRequested){for(const i of t.getTracks())i.stop();return this.currentState="stopped","discarded"}this.stream=t;const r=Ot(),s=r?new MediaRecorder(t,{mimeType:r}):new MediaRecorder(t);return this.recorder=s,s.ondataavailable=i=>{i.data&&i.data.size>0&&this.chunks.push(i.data)},s.onstop=()=>this.handleRecorderStop(),s.onerror=i=>this.handleRecorderError(i),s.start(),this.startedAt=this.now(),this.currentState="recording",this.maxTimer=setTimeout(()=>this.stop(),this.maxDurationMs),this.onLevels&&(this.stopMeter=Ft(t,this.onLevels)),"recording"}stop(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&this.recorder?.stop()}cancel(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&(this.cancelRequested=!0,this.recorder?.stop())}handleRecorderStop(){const t=this.now()-this.startedAt,r=this.recorder?.mimeType||"audio/webm",s=this.chunks,i=this.cancelRequested;this.teardown(),!i&&this.callbacks.onFinished({blob:new Blob(s,{type:r}),durationMs:t,mimeType:r})}handleRecorderError(t){const r=t?.error??t;this.teardown(),this.callbacks.onError(r)}teardown(){this.maxTimer!==null&&clearTimeout(this.maxTimer),this.maxTimer=null,this.stopMeter?.(),this.stopMeter=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=null;for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null,this.chunks=[],this.currentState="stopped"}}const Bt=300;function Gt(e){const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"}const Vt={stopReason:"manual",autoSend:!1};let p=null,m=null,_=0,E=null;const I=new Mt({onRecordStart:()=>{E&&Nt(E)},onRecordStop:e=>{ie(E,e)}});function oi(){return p!==null}function ci(){return p}function li(e){E=e,_+=1,_===1&&I.keyDown()}function di(e){E=e,_!==0&&(_-=1,_===0&&I.keyUp())}function Nt(e,t="key"){if(p!==null)return;Tt(),Ct();const r=new Wt({deviceId:Et(),onLevels:s=>{p===r&&e.dispatch(fe(s))},onFinished:s=>{p===r&&(p=null);const i=m??{stopReason:"auto-stop",autoSend:!1},o=m!==null;if(m=null,e.dispatch(C()),o||I.reset(),s.durationMs<Bt){i.autoSend&&e.dispatch(B());return}e.dispatch(he({...s,stopReason:i.stopReason,autoSend:i.autoSend}))},onError:s=>{p===r&&(p=null),m=null,e.dispatch(C()),e.showHint(Gt(s)?n.hardwareConsole_ptt_micDenied_message():n.hardwareConsole_ptt_recordingFailed_message())}});p=r,e.dispatch(Se({source:t,startedAt:Date.now()})),r.start().then(s=>{if(s!=="recording"&&(p===r&&(p=null),s==="discarded")){const i=m?.autoSend===!0;m=null,e.dispatch(C()),i&&e.dispatch(B())}})}function ie(e,t){const r=p;if(r===null){t.autoSend&&e?.dispatch(B());return}m=t,r.stop()}function ui(){ie(null,Vt)}function pi(e){I.reset(),_=0,m=null;const t=p;t!==null&&(p=null,t.cancel(),e.dispatch(C()))}const Ut=N("HardwareConsoleVoiceSetupToast"),Ht="hardware-console-voice-setup";let W=null;function qt(){return W||(W=qe(()=>import("./uvhZkGDU.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url).then(e=>e.notify)),W}function zt(){ze("/settings?tab=connections#voice").catch(e=>{Ut.error("Failed to open voice settings from setup toast",e)})}function $t(){return{label:n.hardwareConsole_voice_openSettings_label(),onClick:()=>zt()}}function gi(){qt().then(e=>{e.error(n.hardwareConsole_voice_noKey_error(),{id:Ht,action:$t()})})}const hi=a.createSelector(e=>e.externalEditors.selectedAction),jt=a.createSelector(e=>e.externalEditors.editors),Kt=a.createSelector(e=>{const t=k(jt.select(e)),r=e.externalEditors.editorOrder??[];if(!r.length)return t;const s=new Map(t.map(l=>[l.id,l])),i=r.flatMap(l=>{const c=s.get(l);return c?[c]:[]}),o=new Set(r);return[...i,...t.filter(({id:l})=>!o.has(l))]}),fi=a.createSelector(e=>e.externalEditors.editorOrder??[]),Si=a.createSelector(e=>e.externalEditors.loading),bi=a.createSelector(e=>e.externalEditors.lastFetched),Zt=a.createSelector(e=>e.externalEditors.hiddenEditorIds),mi=a.createSelector((e,t)=>{if(!(t?Ee.select(e,t):Ce.select(e))||be())return[];const s=Zt.select(e);return Kt.select(e).filter(i=>i.installed&&!s.includes(i.id))}),Z={},Qt=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]?.mcpServers??[]:e.mcpSettings.servers),vi=a.createSelector((e,t,r)=>{const s=e.providerCatalog?.byWorkspaceId?.[t];return s?s.mcpServers?.find(i=>i.id===r)?.name:e.providerCatalog?.mcpServerNamesByWorkspaceId?.[t]?.[r]}),_i=a.createSelector(e=>e.mcpSettings.loading),Ai=a.createSelector(e=>e.mcpSettings.error),ki=a.createSelector(e=>e.mcpSettings.mutationError??null),yi=a.createSelector(e=>e.mcpSettings.enabled),Jt=a.createSelector(e=>e.mcpSettings.disabledServers),Yt=a.createSelector(e=>e.mcpSettings.statusMap),Xt=a.createSelector(e=>e.mcpSettings.toolsMap),er=a.createSelector((e,t)=>{if(!t)return e.mcpSettings.errorMessages;const r=e.providerCatalog?.byWorkspaceId?.[t],s=new Map(r?.mcpServers?.map(i=>[i.id,w(i)])??[]);return Object.fromEntries((r?.mcpStatuses??[]).flatMap(i=>{const o=s.get(i.serverId);return o&&i.lastError?[[o,i.lastError]]:[]}))}),tr=a.createSelector((e,t)=>t?e.mcpSettings.byWorkspaceId[t]?.disabledServers??Z:Z),wi=a.createSelector((e,t)=>Object.keys(tr.select(e,t))),Ei=a.createSelector(e=>{const t=Qt.select(e),r=Yt.select(e),s=Xt.select(e),i=Jt.select(e),o=er.select(e);return t.map(l=>{const c=w(l)in i,g=s[w(l)]||[];let f=r[w(l)]||"disconnected";return c&&(f="disabled"),{...l,disabled:c,status:f,tools:g,toolCount:g.length,errorMessage:o[w(l)]}})});a.createSelector((e,t)=>e.mcpSettings.errorMessages[t]);const Ci=a.createSelector(e=>e.mcpSettings.lastImportedCount),Pi=a.createSelector(e=>e.mcpSettings.advancedSaveStatus),Ri=a.createSelector(e=>e.mcpSettings.advancedSaveError);function h(e){return{category:"settings",...e}}const T=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},h({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),h({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),h({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),h({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),h({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),h({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),h({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),h({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),h({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["autocomplete","Autocomplete","Suggest as you type: service, model and API keys.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","token-savings"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","token-savings"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","performance"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","input"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,r,s])=>h({id:e,tab:s,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${s}#${e}`,description:r})),h({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,r])=>h({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:r})),h({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function ae(e){const t=e.indexOf("#"),r=t>=0?e.slice(t+1):e;return decodeURIComponent(r.replace(/^#/,"")).trim()}function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sr(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const s=t.split(/\{[^}]+\}/g).map(rr).join("[^/]+");return new RegExp(`^${s}$`).test(e)}function ir(e){const t=ae(e);if(!t)return;const r=T.find(i=>i.id===t||i.hashAliases?.includes(t));if(r)return r;const s=T.find(i=>i.route&&i.dynamic&&i.idPattern&&sr(t,i.idPattern));return s?{...s,id:t}:void 0}function Mi(){return T.map(e=>({...e,hashAliases:e.hashAliases?[...e.hashAliases]:void 0}))}function ar(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),r=e.indexOf("#");let s=e.length;return t>=0&&(s=Math.min(s,t)),r>=0&&(s=Math.min(s,r)),e.slice(0,s)||"/"}}const nr=new Set(T.flatMap(e=>e.route?[ar(e.route)]:[])),or=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function Ti(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let r,s;try{const i=new URL(t,"app://intent");if(i.protocol!=="app:")return!1;r=i.pathname||"/",s=ae(i.hash)}catch{return!1}return nr.has(r)?s?!!ir(s):!0:or.some(i=>i.test(r))}const Ii=["agentFeatures.backgroundHooks","agentFeatures.hostExec","agentFeatures.secretRequests","agentFeatures.scripts","agentFeatures.terminalAccess","agentFeatures.browserAutomation","agentFeatures.desktopControl","agentFeatures.richChatBlocks","agentFeatures.structuredQuestions","agentFeatures.attentionRequests","agentFeatures.stateSnapshot","agentFeatures.prMonitor","agentFeatures.taskGraph","agentFeatures.peerAgents","agentFeatures.mcpTools"],cr=[{path:"agentFeatures.backgroundHooks",label:()=>n.settings_agentFeatures_backgroundHooks_label(),description:()=>n.settings_agentFeatures_backgroundHooks_description(),defaultValue:!0},{path:"agentFeatures.hostExec",label:()=>n.settings_agentFeatures_hostExec_label(),description:()=>n.settings_agentFeatures_hostExec_description(),defaultValue:!0},{path:"agentFeatures.secretRequests",label:()=>n.settings_agentFeatures_secretRequests_label(),description:()=>n.settings_agentFeatures_secretRequests_description(),defaultValue:!1},{path:"agentFeatures.scripts",label:()=>n.settings_agentFeatures_scripts_label(),description:()=>n.settings_agentFeatures_scripts_description(),defaultValue:!0},{path:"agentFeatures.terminalAccess",label:()=>n.settings_agentFeatures_terminalAccess_label(),description:()=>n.settings_agentFeatures_terminalAccess_description(),defaultValue:!0},{path:"agentFeatures.browserAutomation",label:()=>n.settings_agentFeatures_browserAutomation_label(),description:()=>n.settings_agentFeatures_browserAutomation_description(),defaultValue:!0},{path:"agentFeatures.desktopControl",label:()=>n.settings_agentFeatures_desktopControl_label(),description:()=>n.settings_agentFeatures_desktopControl_description(),info:()=>n.settings_agentFeatures_desktopControl_info(),defaultValue:!0},{path:"agentFeatures.richChatBlocks",label:()=>n.settings_agentFeatures_richChatBlocks_label(),description:()=>n.settings_agentFeatures_richChatBlocks_description(),defaultValue:!0},{path:"agentFeatures.structuredQuestions",label:()=>n.settings_agentFeatures_structuredQuestions_label(),description:()=>n.settings_agentFeatures_structuredQuestions_description(),defaultValue:!0},{path:"agentFeatures.attentionRequests",label:()=>n.settings_agentFeatures_attentionRequests_label(),description:()=>n.settings_agentFeatures_attentionRequests_description(),defaultValue:!0},{path:"agentFeatures.stateSnapshot",label:()=>n.settings_agentFeatures_stateSnapshot_label(),description:()=>n.settings_agentFeatures_stateSnapshot_description(),defaultValue:!0},{path:"agentFeatures.prMonitor",label:()=>n.settings_agentFeatures_prMonitor_label(),description:()=>n.settings_agentFeatures_prMonitor_description(),defaultValue:!0},{path:"agentFeatures.taskGraph",label:()=>n.settings_agentFeatures_taskGraph_label(),description:()=>n.settings_agentFeatures_taskGraph_description(),defaultValue:!0},{path:"agentFeatures.peerAgents",label:()=>n.settings_agentFeatures_peerAgents_label(),description:()=>n.settings_agentFeatures_peerAgents_description(),defaultValue:!0},{path:"agentFeatures.mcpTools",label:()=>n.settings_agentFeatures_mcpTools_label(),description:()=>n.settings_agentFeatures_mcpTools_description(),defaultValue:!0}],Fi=Object.fromEntries(cr.map(e=>[e.path,e.defaultValue]));export{As as $,ni as A,Et as B,pt as C,Dr as D,vt as E,cr as F,Y as G,ds as H,cs as I,wt as J,ir as K,xs as L,ti as M,us as N,gt as O,ps as P,Or as Q,Nr as R,A as S,bs as T,re as U,q as V,Ss as W,se as X,te as Y,ks as Z,ys as _,$e as a,Ei as a$,ws as a0,Es as a1,vs as a2,_s as a3,ms as a4,Gr as a5,Hr as a6,Fs as a7,Ts as a8,Rs as a9,Ar as aA,yr as aB,Pr as aC,wr as aD,Cr as aE,kr as aF,Tr as aG,_r as aH,Fr as aI,Xr as aJ,Zt as aK,Kt as aL,mi as aM,Si as aN,Jr as aO,Yr as aP,bi as aQ,Ri as aR,Pi as aS,Jt as aT,yi as aU,Ai as aV,er as aW,Ci as aX,_i as aY,ki as aZ,Qt as a_,Ms as aa,Is as ab,Ps as ac,fi as ad,Qr as ae,rs as af,jr as ag,ei as ah,Kr as ai,Zr as aj,Wr as ak,Vr as al,H as am,Je as an,st as ao,it as ap,X as aq,rt as ar,Ye as as,Qe as at,et as au,tt as av,Er as aw,Rr as ax,Mr as ay,Ir as az,Fi as b,Yt as b0,Xt as b1,hi as b2,zr as b3,Cs as b4,gs as b5,lt as b6,is as b7,as as b8,ts as b9,ri as bA,ii as bB,gi as bC,Nt as bD,ui as bE,Os as bF,Ls as bG,Ws as bH,Ds as bI,$t as bJ,ns as bK,ss as ba,$r as bb,es as bc,v as bd,Ur as be,Br as bf,Ys as bg,Hs as bh,Qs as bi,Js as bj,zs as bk,Ks as bl,js as bm,qs as bn,Us as bo,Ns as bp,Xs as bq,Vs as br,$s as bs,Zs as bt,S as bu,ft as bv,fs as bw,hs as bx,wi as by,vi as bz,Ii as c,ls as d,pi as e,Ct as f,Tt as g,si as h,ai as i,qr as j,ct as k,ot as l,ci as m,Mi as n,Bs as o,Gs as p,Lr as q,xr as r,li as s,di as t,yt as u,ht as v,oi as w,os as x,K as y,Ti as z};
2
+ var ne=Object.defineProperty;var oe=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>oe(e,typeof t!="symbol"?t+"":t,r);import{JH as a,uC as ce,n_ as k,nZ as y,mq as le,c9 as de,c8 as ue,cn as pe,cm as ge,z6 as C,z7 as B,z4 as he,z3 as fe,z5 as Se,rV as be,o0 as w}from"./B9vHutcJ.js";import{cU as me,cJ as ve,bJ as _e,cS as Q,aJ as Ae,c3 as ke,c$ as ye,cl as we,cB as Ee,cn as Ce}from"./C2UL5Ler.js";import{a as Pe,i as Re}from"./CL3a4Hm1.js";import{c as N}from"./ChTqQfQN.js";import{x as Me,aO as Te,c as Ie,aD as Fe,B as De,y as Le,z as xe}from"./DQw0Iiac.js";import{a0 as Oe,K as J,a1 as We,ay as U,Z as Be,a3 as Ge,L as Ve,$ as Ne,aA as Ue,x as He}from"./KnkAG0HD.js";import{bm as n,_ as qe}from"./CLAmm_T1.js";import{i as D}from"./BBWuirRW.js";import{n as ze}from"./DWt5yjbU.js";const $e=5,L=120,je=4e3,j=.2,Ke=.8;function Ze(e,t,r=$e){const s=e.length>0?t/(2*e.length):0,i=je/L;return Array.from({length:r},(o,l)=>{if(s<=0)return 0;const c=L*i**(l/r),g=L*i**((l+1)/r),f=Math.min(e.length-1,Math.floor(c/s)),b=Math.min(e.length,Math.max(f+1,Math.ceil(g/s)));let z=0;for(let F=f;F<b;F+=1)z+=e[F]??0;const $=(z/(b-f)/255-j)/(Ke-j);return Number.isFinite($)?Math.min(1,Math.max(0,$)):0})}const _r=a.createSelector(e=>me.select(e)?.capabilities.gitlabCheckout===!0),Ar=a.createSelector(e=>e.gitlabAuth.host),kr=a.createSelector(e=>e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host),yr=a.createSelector(e=>ce(e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host)??""),wr=a.createSelector(e=>e.gitlabAuth.isCancelling),Er=a.createSelector(e=>e.gitlabAuth.cancelOutcome),Cr=a.createSelector(e=>e.gitlabAuth.isConfigured),Pr=a.createSelector(e=>e.gitlabAuth.isAuthenticating),Rr=a.createSelector(e=>e.gitlabAuth.deviceFlow),Mr=a.createSelector(e=>e.gitlabAuth.deviceGrantSupported),Tr=a.createSelector(e=>e.gitlabAuth.user),Ir=a.createSelector(e=>e.gitlabAuth.error);a.createSelector(e=>e.gitlabAuth.method);const Fr=a.createSelector(e=>e.gitlabAuth.statusReady===!0),A=[{id:"pr-reviewer",icon:"pr-reviewer",get name(){return n.specialists_builtin_prReviewer_name()},get description(){return n.specialists_builtin_prReviewer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"ui-designer",icon:"ui-designer",get name(){return n.specialists_builtin_uiDesigner_name()},get description(){return n.specialists_builtin_uiDesigner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"vulnerability-scanner",icon:"pr-reviewer",get name(){return n.specialists_builtin_vulnerabilityScanner_name()},get description(){return n.specialists_builtin_vulnerabilityScanner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"developer",icon:"verifier",get name(){return n.specialists_builtin_developer_name()},get description(){return n.specialists_builtin_developer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"product-manager",icon:"coordinator",get name(){return n.specialists_builtin_productManager_name()},get description(){return n.specialists_builtin_productManager_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"maintenance-coordinator",icon:"ralph",get name(){return n.specialists_builtin_maintenanceCoordinator_name()},get description(){return n.specialists_builtin_maintenanceCoordinator_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"chief-of-staff",icon:"chief-of-staff",get name(){return n.specialists_builtin_chiefOfStaff_name()},get description(){return n.specialists_builtin_chiefOfStaff_description()},hidden:!0,defaultBehaviorPrompt:"",promptUnavailable:!0}],Y=new Set(["pr-reviewer"]),Dr="developer";function Lr(e){return A.find(t=>t.id===e)}const Qe=a.createSelector(e=>e.githubAuth.mutationRequestId),Je=a.createSelector(e=>e.githubAuth.callbacksCancelled),Ye=a.createSelector(e=>e.githubAuth.isDisconnecting),X=a.createSelector(e=>e.githubAuth.isAuthenticated),Xe=a.createSelector(e=>e.githubAuth.statusSettled===!0),et=a.createSelector(e=>e.githubAuth.requiresDaemonAuth),tt=a.createSelector(e=>e.githubAuth.user),rt=a.createSelector(e=>e.githubAuth.isAuthenticating),st=a.createSelector(e=>e.githubAuth.deviceFlow),it=a.createSelector(e=>e.githubAuth.error),xr=Object.freeze(Object.defineProperty({__proto__:null,selectGitHubAuthCallbacksCancelled:Je,selectGitHubAuthDeviceFlow:st,selectGitHubAuthError:it,selectGitHubAuthIsAuthenticated:X,selectGitHubAuthIsAuthenticating:rt,selectGitHubAuthIsDisconnecting:Ye,selectGitHubAuthMutationRequestId:Qe,selectGitHubAuthRequiresDaemonAuth:et,selectGitHubAuthStatusSettled:Xe,selectGitHubAuthUser:tt},Symbol.toStringTag,{value:"Module"}));function u(e){return e??""}function at(e,t){const r=e??[],s=t??[];return r.length===s.length&&r.every((i,o)=>u(i.provider)===u(s[o].provider)&&i.model===s[o].model&&i.hint===s[o].hint&&u(i.reasoningEffort)===u(s[o].reasoningEffort))}function K(e,t){if(e.source!=="user"||!t?.ignoreModelPin&&(e.model||e.codingAgent))return!1;const r=e.bundled;return r?u(e.name)===u(r.name)&&u(e.description)===u(r.description)&&u(e.behaviorPrompt)===u(r.behaviorPrompt)&&u(e.roleReminder)===u(r.roleReminder)&&u(e.reasoningEffort)===u(r.reasoningEffort)&&at(e.modelOptions,r.modelOptions):!1}const Or=a.createSelector(e=>e.specialists.bundledSpecialists),nt=a.createSelector(e=>e.specialists.fileSpecialists),Wr=a.createSelector(e=>k(nt.select(e))),Br=a.createSelector(e=>e.specialists.userOverrides);a.createSelector(e=>e.specialists.overridesLoaded);const Gr=a.createSelector(e=>e.specialists.customSpecialistsLoaded),Vr=a.createSelector(e=>e.specialists.fileSpecialistsLoaded),Nr=a.createSelector(e=>e.specialists.bundledSpecialistsLoaded),Ur=a.createSelector(e=>e.specialists.specialistsFolderPath),Hr=a.createSelector((e,t)=>{if(!t)return e.specialists.defaultSpecialistId??"";const r=e.providerCatalog?.byWorkspaceId?.[t]?.settings.find(s=>s.path==="specialists.default")?.value;return typeof r=="string"?r:""});a.createSelector(e=>e.specialists.providerModelOverrides);const x=a.createSelector((e,t)=>!(Y.has(t)&&!X.select(e)));function ot(e,t){return t?e:e.filter(r=>!Y.has(r.id))}function ct(e,t){return ot(e,t).filter(r=>!r.hidden)}function qr(e,t){return ct(e,t).filter(r=>r.role!=="internal")}const v=a.createSelector((e,t)=>{if(t)return(e.providerCatalog?.byWorkspaceId?.[t]?.specialists??[]).map(c=>({...c,defaultModel:c.model,defaultBehaviorPrompt:c.behaviorPrompt??c.prompt??"",defaultAgentType:c.agentType}));const r=k(e.specialists.fileSpecialists),s=e.specialists.bundledSpecialists,i=new Set,o=[];for(const c of r)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push({id:c.id,name:c.name,description:c.description,codingAgent:c.codingAgent,defaultModel:c.model||void 0,defaultBehaviorPrompt:c.behaviorPrompt,roleReminder:c.roleReminder,source:c.source,importedFrom:c.importedFrom,unsupportedFields:c.unsupportedFields,requiredSkills:c.requiredSkills,missingSkills:c.missingSkills,hidden:c.hidden,resolvedModel:c.resolvedModel,resolvedProvider:c.resolvedProvider,modelOptions:c.modelOptions,reasoningEffort:c.reasoningEffort,role:c.role,teamAgents:c.teamAgents,icon:c.icon}));for(const c of s)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push(c));if(!e.specialists.bundledSpecialistsLoaded&&r.length===0&&s.length===0)for(const c of A)!i.has(c.id)&&x.select(e,c.id)&&(i.add(c.id),o.push(c));const l=new Map;for(const c of A)l.has(c.id)||l.set(c.id,l.size);for(const c of s)l.has(c.id)||l.set(c.id,l.size);return o.sort((c,g)=>{const f=l.has(c.id),b=l.has(g.id);return f&&b?(l.get(c.id)??0)-(l.get(g.id)??0):f&&!b?-1:!f&&b?1:c.name.localeCompare(g.name)}),o}),zr=a.createSelector(e=>{const t=v.select(e).filter(s=>s.role==="orchestrator");if(t.length===0)return null;const r=new Set([...A.map(({id:s})=>s),...e.specialists.bundledSpecialists.map(({id:s})=>s)]);return t.sort((s,i)=>+!r.has(s.id)-+!r.has(i.id)||s.id.localeCompare(i.id)),t[0]}),lt=a.createSelector((e,t)=>{const r=y(e.specialists.fileSpecialists,t);if(r)return{id:r.id,name:r.name,description:r.description,source:r.source};const s=e.specialists.bundledSpecialists.find(i=>i.id===t);if(s)return{id:s.id,name:s.name,description:s.description,source:"builtin"};if(!e.specialists.bundledSpecialistsLoaded&&k(e.specialists.fileSpecialists).length===0&&e.specialists.bundledSpecialists.length===0){const i=A.find(o=>o.id===t);if(i)return{id:i.id,name:i.name,description:i.description,source:"builtin"}}return null}),$r=a.createSelector((e,t)=>lt.select(e,t)?.name??null),jr=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultModel?i.defaultModel:i.resolvedModel??"":""}),Kr=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.defaultModel||void 0),Zr=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.reasoningEffort||void 0),Qr=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultBehaviorPrompt:""});function P(e,t){return t.some(r=>r.id===e)||A.some(r=>r.id===e)}const Jr=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.importedFrom?!1:s.source==="bundled"||s.source==="user"&&P(t,e.specialists.bundledSpecialists)}return P(t,e.specialists.bundledSpecialists)}),Yr=a.createSelector((e,t,r)=>r?!!H.select(e,t,r):!!y(e.specialists.fileSpecialists,t)),Xr=a.createSelector((e,t,r)=>{if(r){const o=H.select(e,t,r);return!o||o.importedFrom||o.source==="project"?!1:P(t,e.specialists.bundledSpecialists)&&!K(o)}if(!P(t,e.specialists.bundledSpecialists))return!1;const i=y(e.specialists.fileSpecialists,t);return!i||i.source!=="user"?!1:!K(i)}),H=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.source==="bundled"?void 0:{...s,source:s.source,model:s.model??"",behaviorPrompt:s.behaviorPrompt??s.prompt??"",filePath:s.path??""}}return y(e.specialists.fileSpecialists,t)}),es=a.createSelector((e,t,r)=>{const s=H.select(e,t,r);return r&&!s?e.providerCatalog?.byWorkspaceId?.[r]?.specialists.some(i=>i.id===t)?"Built-in":null:s?.source==="project"?"Project":s?.source==="user"?"User":e.specialists.bundledSpecialists.some(i=>i.id===t)?"Built-in":null}),ts=a.createSelector((e,t,r)=>{if(r)return e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(o=>o.id===t)?.path;const s=y(e.specialists.fileSpecialists,t);if(s)return s.filePath;const i=e.specialists.bundledSpecialists.find(o=>o.id===t);if(i&&"filePath"in i)return i.filePath}),rs=a.createSelector((e,t,r)=>{if(r){const i=v.select(e,r).find(c=>c.id===t),o=i?.codingAgent||i?.resolvedProvider;if(o)return ve.select(e,o,r);const l=_e.select(e,r);return e.providerCatalog?.byWorkspaceId?.[r]?.readiness[l]?.available?l:""}const s=y(e.specialists.fileSpecialists,t);return s?.codingAgent?s.codingAgent:dt.select(e,t)}),dt=a.createSelector((e,t)=>{const s=v.select(e).find(i=>i.id===t);return s?.codingAgent?s.codingAgent:Oe.select(e)?J.select(e):""}),ss=a.createSelector((e,t)=>{if(t)return e.providerCatalog?.byWorkspaceId?.[t]?.importDiagnostics??[];const r=e.specialists.importDiagnostics;return r?k(r):[]}),is=a.createSelector((e,t)=>e.specialists.creationByContext?.[t]??le),as=a.createSelector(e=>Object.values(e.specialists.creationByContext??{}).flatMap(t=>t.specialistId?[t.specialistId]:[])),O=N("Clipboard");async function ns(e){let t;if(Pe())try{const r=await Re("system:write-clipboard",{text:e});if(r?.success===!1)throw new Error(r.error||"Electron clipboard write failed");return}catch(r){t=r,O.warn("Electron clipboard write failed; falling back to browser clipboard",{error:r})}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch(r){throw O.error("Browser clipboard write failed",r,{electronError:t}),r}throw O.error("No clipboard write API is available",void 0,{electronError:t}),t instanceof Error?t:new Error("Clipboard write API unavailable")}function os(e,t){if(!e||!t||t===e.providerId)return!1;const r=e.providerSettings[t];return!!(r&&[r.defaultModel,...Object.values(r.typeOverrides??{})].some(s=>typeof s=="string"&&s.includes(":")))}let ut=0;function pt(e,t){const r=++ut;return a.dispatch(ue(e,t,r)),r}function cs(e,t,r){a.dispatch(de(e,t,r))}async function ee(e,t,r,s){const i=crypto.randomUUID(),o=s?.source??"control";try{return(await a.dispatch(pe({requestId:i,consumerId:o,agentId:e,workspaceId:t,operation:r,connection:Q.select(a.state)},{...s,intent:s?.intent??pt(e,t)}))).status==="success"}finally{a.dispatch(ge(i,o))}}async function ls(e,t,r,s,i){return ee(e,t,{kind:"effort",effort:r,previous:s},i)}async function ds(e,t,r,s,i){return ee(e,t,{kind:"reconcile",current:r??null,levels:s},i)}const gt=a.createSelector((e,t)=>k(e.agentModel.mutations).filter(r=>r.consumerId===t)),us=a.createSelector((e,t)=>gt.select(e,t).some(r=>r.status==="pending")),ps=a.createSelector((e,t,r)=>{const s=e.agentSessions.byAgentId[t],i=Ae.select(e,t),o=Me.select(e,t),l=e.daemonHealth.stats?.protocolVersion,c=Te(l),g=c?Ie(s?.model,null,o):s?.model;return{session:s,providerId:i,levels:o,legacy:c,identity:JSON.stringify([g,i]),connection:Q.select(e),canWrite:!!s&&s.workspaceId===r&&!ke.select(e,r)}});function ht(e,t,r=!1){const s=t?.available===!0&&t.viaNpx!==!0;return e!=="auggie"||s||r}const gs=a.createSelector(e=>We.select(e)?null:U.select(e)),ft=a.createSelector(e=>e.providerCatalog?.workspaceEpoch??0),S=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]:void 0),hs=a.createSelector(e=>Object.keys(e.providerCatalog?.byWorkspaceId??{})),fs=a.createSelector((e,t)=>!!S.select(e,t)&&e.providerCatalog.workspaceSnapshotEpochs?.[t]===ft.select(e)),te=a.createSelector((e,t)=>t?S.select(e,t)?.catalog.providers??[]:ye.select(e)),re=a.createSelector((e,t)=>{if(!t)return J.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="model.defaultProvider")?.value;return typeof r=="string"?r:""}),q=a.createSelector((e,t)=>{if(!t)return Be.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="providers.enabled")?.value;return r&&typeof r=="object"?r:{}}),se=a.createSelector((e,t)=>{if(!t)return Ge.select(e);const r=q.select(e,t),s=re.select(e,t),i=S.select(e,t)?.readiness??{};return te.select(e,t).filter(o=>o.visible&&(!o.canBeDisabled||r[o.id]||o.id===s)&&i[o.id]?.available).map(o=>o.id)}),Ss=a.createSelector((e,t)=>{const r=q.select(e,t),s=t?S.select(e,t)?.readiness??{}:U.select(e);return te.select(e,t).filter(i=>ht(i.id,s[i.id],r[i.id]===!0)).map(i=>i.id)}),bs=a.createSelector((e,t)=>t?se.select(e,t):Ve.select(e)),ms=a.createSelector((e,t)=>v.select(e,t)),vs=a.createSelector((e,t)=>t?!!S.select(e,t):Ne.select(e)),_s=a.createSelector((e,t)=>{if(!t)return Fe.select(e);const r=S.select(e,t)?.settings??[],s=re.select(e,t),i=r.find(c=>c.path==="model.providerDefaults")?.value,o=i&&typeof i=="object"?i[s]:void 0;if(typeof o=="string")return o;const l=r.find(c=>c.path==="model.default")?.value;return typeof l=="string"?l:""}),As=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning?[[r,s.warning]]:[])):De.select(e)),ks=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).map(([r,s])=>[r,s.stale===!0])):Le.select(e)),ys=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning&&s.warningKind?[[r,s.warningKind]]:[])):xe.select(e)),ws=a.createSelector((e,t,r)=>{if(!r)return Ue.select(e,t);const s=q.select(e,r),i=S.select(e,r);return se.select(e,r).filter(o=>o!==t&&(s[o]||i?.catalog.providers.find(l=>l.id===o)?.canBeDisabled===!1)&&He(o,i?.readiness[o]?.authenticated))}),Es=a.createSelector((e,t)=>t?S.select(e,t)?.readiness??{}:U.select(e)),St={},Cs=a.createSelector(e=>e.providerSettings?.profiles?.status??St),Ps=a.createSelector(e=>e.directoryPicker.source??"daemon"),Rs=a.createSelector(e=>e.directoryPicker.listing),Ms=a.createSelector(e=>e.directoryPicker.loading),Ts=a.createSelector(e=>e.directoryPicker.error),Is=a.createSelector(e=>e.directoryPicker.pathError),Fs=a.createSelector(e=>e.directoryPicker.createError),bt=N("WorkspaceValidation");async function Ds(e,t=!1,r=!1){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_repoPathRequired_error(),suggestion:n.workspace_validation_repoPathRequired_suggestion()};const s=e.trim();return mt(s)?_t(s):At(s,t,r)}function mt(e){return[/^https?:\/\/github\.com\//i,/^git@github\.com:/i,/^github\.com\//i,/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/].some(r=>r.test(e.trim()))}function vt(e){const t=e.trim(),r=[/^https?:\/\/github\.com\/([^\/]+)\/([^\/]+)$/i,/^git@github\.com:([^\/]+)\/([^\/]+)$/i,/^github\.com\/([^\/]+)\/([^\/]+)$/i];for(const i of r){const o=t.match(i);if(o){const l=o[2].replace(/\.git$/,"");return l?{owner:o[1],repo:l}:null}}const s=t.match(/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/);if(s&&!t.includes("\\")&&!t.includes(":")){const i=s[2].replace(/\.git$/,"");return i?{owner:s[1],repo:i}:null}return null}async function _t(e){return vt(e)?{valid:!0,warning:n.workspace_validation_githubCloneLocally_warning()}:{valid:!1,error:n.workspace_validation_invalidGithubUrl_error(),suggestion:n.workspace_validation_invalidGithubUrl_suggestion()}}async function At(e,t=!1,r=!1){if(e.includes("\0"))return{valid:!1,error:n.workspace_validation_nullCharacters_error()};if(!e.startsWith("/")&&!e.startsWith("~")&&!e.startsWith(".")&&!e.includes(":\\")&&!/^[a-zA-Z]:\//.test(e))return{valid:!1,error:n.workspace_validation_pathNotAbsolute_error(),suggestion:n.workspace_validation_pathNotAbsolute_suggestion()};if(typeof window<"u"&&window.electronAPI)try{const s=await D("file:getDirectoryStatus",{path:e});if(s.success&&s.data){const l=s.data;return l.exists?l.isDirectory?l.isGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l}:l.isSubdirectoryOfGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l,warning:n.workspace_validation_insideParentRepo_warning({path:l.parentGitRoot??""})}:r?{valid:!0,isNewRepo:!1,directoryStatus:l}:t?l.isEmpty?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_emptyDirInit_warning()}:{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_nonGitDirInit_warning()}:{valid:!1,error:n.workspace_repoSelector_notGitRepository_label(),directoryStatus:l}:{valid:!1,error:n.workspace_validation_notDirectory_error(),suggestion:n.workspace_validation_notDirectory_suggestion(),directoryStatus:l}:t?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExist_suggestion(),directoryStatus:l}}if(!(await D("file:exists",{path:e})).exists)return t?{valid:!0,isNewRepo:!0,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExistLegacy_suggestion()};const o=await D("git:isRepository",{path:e});if(!t&&o?.isRepository!==!0)return{valid:!1,error:o?.isRepository===!1?n.workspace_repoSelector_notGitRepository_label():n.workspace_compactInitializer_gitCheckUnknown_label()};if(!o.isRepository)return{valid:!0,isNewRepo:!0,warning:n.workspace_validation_nonGitInit_warning()}}catch(s){if(bt.warn("Could not validate path existence",s),!t)return{valid:!1,error:n.workspace_compactInitializer_gitCheckUnknown_label()}}return{valid:!0,isNewRepo:!1}}function Ls(e){if(!e||e.trim().length===0)return{valid:!0};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchPrefixInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:t==="."||t===".."||t.startsWith(".")?{valid:!1,error:n.workspace_validation_branchPrefixDot_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchPrefixConsecutive_error()}:t.startsWith("/")?{valid:!1,error:n.workspace_validation_branchPrefixSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchPrefixLock_error()}:t.length>50?{valid:!1,error:n.workspace_validation_branchPrefixTooLong_error()}:{valid:!0}}function xs(e){if(!e||e.trim().length===0)return"";let t=e.trim().replace(/^[./]+/,"").replace(/[\s~^:?*\[\]\\]/g,"-").replace(/\.{2,}/g,"-").replace(/\/{2,}/g,"/").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/\.lock$/,"").toLowerCase();return t.length>0&&!t.endsWith("/")&&!t.endsWith("-")&&(t=t.includes("/")?`${t}/`:`${t}/`),t}function Os(e){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_branchNameRequired_error()};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchNameInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:["HEAD",".",".."].includes(t)?{valid:!1,error:n.workspace_validation_branchNameReserved_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchNameConsecutive_error()}:t.startsWith("/")||t.endsWith("/")?{valid:!1,error:n.workspace_validation_branchNameSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchNameLock_error()}:{valid:!0}}function Ws(e){return!e||e.trim().length===0?{valid:!0}:e.trim().length>1e5?{valid:!1,error:n.workspace_validation_promptTooLong_error(),suggestion:n.workspace_validation_promptTooLong_suggestion()}:{valid:!0}}function Bs(e){const t=e.toLowerCase();return t.includes("maxbuffer")?n.workspace_gitError_maxBuffer():t.includes("clone")&&t.includes("timed out")?n.workspace_gitError_cloneTimeout():t.includes("json-rpc request timed out: workspace.create")?n.workspace_gitError_createTimeout():t.includes("timed out")&&["git","clone","fetch","worktree","pull","push","rebase","merge"].some(r=>t.includes(r))?n.workspace_gitError_gitTimeout():t.includes("git clone failed")?t.includes("could not read from remote")?n.workspace_gitError_cloneRemote():t.includes("authentication")||t.includes("permission denied")||t.includes("access denied")?n.workspace_gitError_cloneAuth():n.workspace_gitError_cloneFailed():t.includes("could not resolve any ref to create worktree")?n.workspace_gitError_worktreeRef():t.includes("failed to write file")?t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_writePermission():t.includes("enospc")||t.includes("disk space")?n.workspace_gitError_diskSpaceFree():t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_writeNoEnt():e:t.includes("failed to read file")?t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_readNotFound():t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_readPermission():e:t.includes("permission denied")?n.workspace_gitError_permissionDenied():t.includes("not found")||t.includes("enoent")?n.workspace_gitError_notFound():t.includes("already exists")?n.workspace_gitError_alreadyExists():t.includes("network")||t.includes("etimedout")?n.workspace_gitError_network():t.includes("authentication")||t.includes("401")?t.includes("private repositor")?e:n.workspace_gitError_authFailed():t.includes("rate limit")||t.includes("403")?n.workspace_gitError_rateLimit():t.includes("disk space")||t.includes("enospc")?n.workspace_gitError_diskSpace():e}const kt=["idle","exited"];function yt(e){return e===void 0||!kt.includes(e)}function Gs(e){return e.status==="restarting"?"restarting":yt(e.status)?"running":e.status==="idle"?"idle":e.exitCode===0?"succeeded":e.exitCode===null||e.exitCode===void 0?"exited":e.exitCode>=128?"stopped":"failed"}function wt(e){return e.engine==="os"?"os":e.isLoading||e.keyConfigured[e.provider]===!0?"daemon":e.osEngineAvailable?"os":"unavailable"}const Vs=a.createSelector(e=>e.voiceSettings.isLoading),Ns=a.createSelector(e=>e.voiceSettings.available),Us=a.createSelector(e=>e.voiceSettings.provider),Hs=a.createSelector(e=>e.voiceSettings.engine),qs=a.createSelector(e=>e.voiceSettings.osEngineAvailable),zs=a.createSelector(e=>e.voiceSettings.keyConfigured),$s=a.createSelector(e=>e.voiceSettings.vocabulary),js=a.createSelector(e=>e.voiceSettings.openaiModel),Ks=a.createSelector(e=>e.voiceSettings.language),Zs=a.createSelector(e=>e.voiceSettings.workspaceVocabularyMaxTerms),Qs=a.createSelector(e=>e.voiceSettings.inputDeviceId),Js=a.createSelector(e=>e.voiceSettings.inputDevices),Ys=a.createSelector(e=>e.voiceSettings.busyProvider),Xs=a.createSelector(e=>e.voiceSettings.error),ei=a.createSelector(e=>we.select(e)?"unavailable":wt(e.voiceSettings)),G="intent.voice.inputDevice";let V;function Et(){if(V!==void 0)return V;try{const e=localStorage.getItem(G);return typeof e=="string"&&e!==""?e:null}catch{return null}}function ti(e){V=e;try{e===null?localStorage.removeItem(G):localStorage.setItem(G,e)}catch{}}let R=null;function ri(e){R=e}function si(){const e=R;return R=null,e}function Ct(){R=null}const Pt=300,Rt=300;class Mt{constructor(t){d(this,"holdThresholdMs");d(this,"doublePressWindowMs");d(this,"onRecordStart");d(this,"onRecordStop");d(this,"currentState","idle");d(this,"timer",null);this.holdThresholdMs=t.holdThresholdMs??Pt,this.doublePressWindowMs=t.doublePressWindowMs??Rt,this.onRecordStart=t.onRecordStart,this.onRecordStop=t.onRecordStop}get state(){return this.currentState}keyDown(){switch(this.currentState){case"idle":this.currentState="first-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding"}),this.onRecordStart();break;case"await-second-press":this.clearTimer(),this.currentState="second-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding-send"});break;case"latched":this.currentState="latched-press";break;case"latched-await-second":this.clearTimer(),this.currentState="draining",this.onRecordStop({stopReason:"double-press",autoSend:!0});break}}keyUp(){switch(this.currentState){case"first-press":this.clearTimer(),this.currentState="await-second-press",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="latched"});break;case"holding":this.currentState="idle",this.onRecordStop({stopReason:"hold-release",autoSend:!1});break;case"second-press":this.clearTimer(),this.currentState="idle",this.onRecordStop({stopReason:"double-press",autoSend:!0});break;case"holding-send":this.currentState="idle",this.onRecordStop({stopReason:"double-hold-release",autoSend:!0});break;case"latched-press":this.currentState="latched-await-second",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="idle",this.onRecordStop({stopReason:"latch-stop",autoSend:!1})});break;case"draining":this.currentState="idle";break}}reset(){this.clearTimer(),this.currentState="idle"}armTimer(t,r){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,r()},t)}clearTimer(){this.timer!==null&&clearTimeout(this.timer),this.timer=null}}let M=null;function ii(e){M=e}function ai(){const e=M;return M=null,e}function Tt(){M=null}const It=66;function Ft(e,t){const r=globalThis.AudioContext;if(typeof r!="function")return()=>{};let s,i,o;try{s=new r,i=s.createMediaStreamSource(e),o=s.createAnalyser(),o.fftSize=1024,o.smoothingTimeConstant=.5,o.minDecibels=-85,o.maxDecibels=-25,i.connect(o)}catch{return i?.disconnect(),s?.close().catch(()=>{}),()=>{}}if(!s||!i)return()=>{};const l=s,c=i,g=new Uint8Array(o.frequencyBinCount),f=setInterval(()=>{o.getByteFrequencyData(g),t(Ze(g,l.sampleRate))},It);let b=!1;return()=>{b||(b=!0,clearInterval(f),c.disconnect(),l.close().catch(()=>{}))}}const Dt=12e4,Lt=["audio/webm;codecs=opus","audio/webm"];function ni(){return typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof MediaRecorder<"u"}function xt(e){return e?{audio:{deviceId:{ideal:e}}}:{audio:!0}}function Ot(){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Lt.find(e=>MediaRecorder.isTypeSupported(e))}class Wt{constructor(t){d(this,"maxDurationMs");d(this,"now");d(this,"callbacks");d(this,"deviceId");d(this,"onLevels");d(this,"stopMeter",null);d(this,"currentState","idle");d(this,"recorder",null);d(this,"stream",null);d(this,"chunks",[]);d(this,"startedAt",0);d(this,"maxTimer",null);d(this,"discardRequested",!1);d(this,"cancelRequested",!1);this.maxDurationMs=t.maxDurationMs??Dt,this.now=t.now??Date.now,this.callbacks={onFinished:t.onFinished,onError:t.onError},this.deviceId=t.deviceId??null,this.onLevels=t.onLevels}get state(){return this.currentState}async start(){if(this.currentState!=="idle")return"discarded";this.currentState="starting";let t;try{t=await navigator.mediaDevices.getUserMedia(xt(this.deviceId))}catch(i){const o=this.discardRequested;return this.currentState="stopped",o||this.callbacks.onError(i),o?"discarded":"error"}if(this.discardRequested){for(const i of t.getTracks())i.stop();return this.currentState="stopped","discarded"}this.stream=t;const r=Ot(),s=r?new MediaRecorder(t,{mimeType:r}):new MediaRecorder(t);return this.recorder=s,s.ondataavailable=i=>{i.data&&i.data.size>0&&this.chunks.push(i.data)},s.onstop=()=>this.handleRecorderStop(),s.onerror=i=>this.handleRecorderError(i),s.start(),this.startedAt=this.now(),this.currentState="recording",this.maxTimer=setTimeout(()=>this.stop(),this.maxDurationMs),this.onLevels&&(this.stopMeter=Ft(t,this.onLevels)),"recording"}stop(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&this.recorder?.stop()}cancel(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&(this.cancelRequested=!0,this.recorder?.stop())}handleRecorderStop(){const t=this.now()-this.startedAt,r=this.recorder?.mimeType||"audio/webm",s=this.chunks,i=this.cancelRequested;this.teardown(),!i&&this.callbacks.onFinished({blob:new Blob(s,{type:r}),durationMs:t,mimeType:r})}handleRecorderError(t){const r=t?.error??t;this.teardown(),this.callbacks.onError(r)}teardown(){this.maxTimer!==null&&clearTimeout(this.maxTimer),this.maxTimer=null,this.stopMeter?.(),this.stopMeter=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=null;for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null,this.chunks=[],this.currentState="stopped"}}const Bt=300;function Gt(e){const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"}const Vt={stopReason:"manual",autoSend:!1};let p=null,m=null,_=0,E=null;const I=new Mt({onRecordStart:()=>{E&&Nt(E)},onRecordStop:e=>{ie(E,e)}});function oi(){return p!==null}function ci(){return p}function li(e){E=e,_+=1,_===1&&I.keyDown()}function di(e){E=e,_!==0&&(_-=1,_===0&&I.keyUp())}function Nt(e,t="key"){if(p!==null)return;Tt(),Ct();const r=new Wt({deviceId:Et(),onLevels:s=>{p===r&&e.dispatch(fe(s))},onFinished:s=>{p===r&&(p=null);const i=m??{stopReason:"auto-stop",autoSend:!1},o=m!==null;if(m=null,e.dispatch(C()),o||I.reset(),s.durationMs<Bt){i.autoSend&&e.dispatch(B());return}e.dispatch(he({...s,stopReason:i.stopReason,autoSend:i.autoSend}))},onError:s=>{p===r&&(p=null),m=null,e.dispatch(C()),e.showHint(Gt(s)?n.hardwareConsole_ptt_micDenied_message():n.hardwareConsole_ptt_recordingFailed_message())}});p=r,e.dispatch(Se({source:t,startedAt:Date.now()})),r.start().then(s=>{if(s!=="recording"&&(p===r&&(p=null),s==="discarded")){const i=m?.autoSend===!0;m=null,e.dispatch(C()),i&&e.dispatch(B())}})}function ie(e,t){const r=p;if(r===null){t.autoSend&&e?.dispatch(B());return}m=t,r.stop()}function ui(){ie(null,Vt)}function pi(e){I.reset(),_=0,m=null;const t=p;t!==null&&(p=null,t.cancel(),e.dispatch(C()))}const Ut=N("HardwareConsoleVoiceSetupToast"),Ht="hardware-console-voice-setup";let W=null;function qt(){return W||(W=qe(()=>import("./uvhZkGDU.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url).then(e=>e.notify)),W}function zt(){ze("/settings?tab=connections#voice").catch(e=>{Ut.error("Failed to open voice settings from setup toast",e)})}function $t(){return{label:n.hardwareConsole_voice_openSettings_label(),onClick:()=>zt()}}function gi(){qt().then(e=>{e.error(n.hardwareConsole_voice_noKey_error(),{id:Ht,action:$t()})})}const hi=a.createSelector(e=>e.externalEditors.selectedAction),jt=a.createSelector(e=>e.externalEditors.editors),Kt=a.createSelector(e=>{const t=k(jt.select(e)),r=e.externalEditors.editorOrder??[];if(!r.length)return t;const s=new Map(t.map(l=>[l.id,l])),i=r.flatMap(l=>{const c=s.get(l);return c?[c]:[]}),o=new Set(r);return[...i,...t.filter(({id:l})=>!o.has(l))]}),fi=a.createSelector(e=>e.externalEditors.editorOrder??[]),Si=a.createSelector(e=>e.externalEditors.loading),bi=a.createSelector(e=>e.externalEditors.lastFetched),Zt=a.createSelector(e=>e.externalEditors.hiddenEditorIds),mi=a.createSelector((e,t)=>{if(!(t?Ee.select(e,t):Ce.select(e))||be())return[];const s=Zt.select(e);return Kt.select(e).filter(i=>i.installed&&!s.includes(i.id))}),Z={},Qt=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]?.mcpServers??[]:e.mcpSettings.servers),vi=a.createSelector((e,t,r)=>{const s=e.providerCatalog?.byWorkspaceId?.[t];return s?s.mcpServers?.find(i=>i.id===r)?.name:e.providerCatalog?.mcpServerNamesByWorkspaceId?.[t]?.[r]}),_i=a.createSelector(e=>e.mcpSettings.loading),Ai=a.createSelector(e=>e.mcpSettings.error),ki=a.createSelector(e=>e.mcpSettings.mutationError??null),yi=a.createSelector(e=>e.mcpSettings.enabled),Jt=a.createSelector(e=>e.mcpSettings.disabledServers),Yt=a.createSelector(e=>e.mcpSettings.statusMap),Xt=a.createSelector(e=>e.mcpSettings.toolsMap),er=a.createSelector((e,t)=>{if(!t)return e.mcpSettings.errorMessages;const r=e.providerCatalog?.byWorkspaceId?.[t],s=new Map(r?.mcpServers?.map(i=>[i.id,w(i)])??[]);return Object.fromEntries((r?.mcpStatuses??[]).flatMap(i=>{const o=s.get(i.serverId);return o&&i.lastError?[[o,i.lastError]]:[]}))}),tr=a.createSelector((e,t)=>t?e.mcpSettings.byWorkspaceId[t]?.disabledServers??Z:Z),wi=a.createSelector((e,t)=>Object.keys(tr.select(e,t))),Ei=a.createSelector(e=>{const t=Qt.select(e),r=Yt.select(e),s=Xt.select(e),i=Jt.select(e),o=er.select(e);return t.map(l=>{const c=w(l)in i,g=s[w(l)]||[];let f=r[w(l)]||"disconnected";return c&&(f="disabled"),{...l,disabled:c,status:f,tools:g,toolCount:g.length,errorMessage:o[w(l)]}})});a.createSelector((e,t)=>e.mcpSettings.errorMessages[t]);const Ci=a.createSelector(e=>e.mcpSettings.lastImportedCount),Pi=a.createSelector(e=>e.mcpSettings.advancedSaveStatus),Ri=a.createSelector(e=>e.mcpSettings.advancedSaveError);function h(e){return{category:"settings",...e}}const T=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},h({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),h({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),h({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),h({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),h({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),h({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),h({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),h({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),h({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["autocomplete","Autocomplete","Suggest as you type: service, model and API keys.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","token-savings"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","token-savings"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","performance"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","input"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,r,s])=>h({id:e,tab:s,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${s}#${e}`,description:r})),h({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,r])=>h({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:r})),h({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function ae(e){const t=e.indexOf("#"),r=t>=0?e.slice(t+1):e;return decodeURIComponent(r.replace(/^#/,"")).trim()}function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sr(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const s=t.split(/\{[^}]+\}/g).map(rr).join("[^/]+");return new RegExp(`^${s}$`).test(e)}function ir(e){const t=ae(e);if(!t)return;const r=T.find(i=>i.id===t||i.hashAliases?.includes(t));if(r)return r;const s=T.find(i=>i.route&&i.dynamic&&i.idPattern&&sr(t,i.idPattern));return s?{...s,id:t}:void 0}function Mi(){return T.map(e=>({...e,hashAliases:e.hashAliases?[...e.hashAliases]:void 0}))}function ar(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),r=e.indexOf("#");let s=e.length;return t>=0&&(s=Math.min(s,t)),r>=0&&(s=Math.min(s,r)),e.slice(0,s)||"/"}}const nr=new Set(T.flatMap(e=>e.route?[ar(e.route)]:[])),or=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function Ti(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let r,s;try{const i=new URL(t,"app://intent");if(i.protocol!=="app:")return!1;r=i.pathname||"/",s=ae(i.hash)}catch{return!1}return nr.has(r)?s?!!ir(s):!0:or.some(i=>i.test(r))}const Ii=["agentFeatures.backgroundHooks","agentFeatures.hostExec","agentFeatures.secretRequests","agentFeatures.scripts","agentFeatures.terminalAccess","agentFeatures.browserAutomation","agentFeatures.desktopControl","agentFeatures.richChatBlocks","agentFeatures.structuredQuestions","agentFeatures.attentionRequests","agentFeatures.stateSnapshot","agentFeatures.prMonitor","agentFeatures.taskGraph","agentFeatures.peerAgents","agentFeatures.mcpTools"],cr=[{path:"agentFeatures.backgroundHooks",label:()=>n.settings_agentFeatures_backgroundHooks_label(),description:()=>n.settings_agentFeatures_backgroundHooks_description(),defaultValue:!0},{path:"agentFeatures.hostExec",label:()=>n.settings_agentFeatures_hostExec_label(),description:()=>n.settings_agentFeatures_hostExec_description(),defaultValue:!0},{path:"agentFeatures.secretRequests",label:()=>n.settings_agentFeatures_secretRequests_label(),description:()=>n.settings_agentFeatures_secretRequests_description(),defaultValue:!1},{path:"agentFeatures.scripts",label:()=>n.settings_agentFeatures_scripts_label(),description:()=>n.settings_agentFeatures_scripts_description(),defaultValue:!0},{path:"agentFeatures.terminalAccess",label:()=>n.settings_agentFeatures_terminalAccess_label(),description:()=>n.settings_agentFeatures_terminalAccess_description(),defaultValue:!0},{path:"agentFeatures.browserAutomation",label:()=>n.settings_agentFeatures_browserAutomation_label(),description:()=>n.settings_agentFeatures_browserAutomation_description(),defaultValue:!0},{path:"agentFeatures.desktopControl",label:()=>n.settings_agentFeatures_desktopControl_label(),description:()=>n.settings_agentFeatures_desktopControl_description(),info:()=>n.settings_agentFeatures_desktopControl_info(),defaultValue:!0},{path:"agentFeatures.richChatBlocks",label:()=>n.settings_agentFeatures_richChatBlocks_label(),description:()=>n.settings_agentFeatures_richChatBlocks_description(),defaultValue:!0},{path:"agentFeatures.structuredQuestions",label:()=>n.settings_agentFeatures_structuredQuestions_label(),description:()=>n.settings_agentFeatures_structuredQuestions_description(),defaultValue:!0},{path:"agentFeatures.attentionRequests",label:()=>n.settings_agentFeatures_attentionRequests_label(),description:()=>n.settings_agentFeatures_attentionRequests_description(),defaultValue:!0},{path:"agentFeatures.stateSnapshot",label:()=>n.settings_agentFeatures_stateSnapshot_label(),description:()=>n.settings_agentFeatures_stateSnapshot_description(),defaultValue:!0},{path:"agentFeatures.prMonitor",label:()=>n.settings_agentFeatures_prMonitor_label(),description:()=>n.settings_agentFeatures_prMonitor_description(),defaultValue:!0},{path:"agentFeatures.taskGraph",label:()=>n.settings_agentFeatures_taskGraph_label(),description:()=>n.settings_agentFeatures_taskGraph_description(),defaultValue:!0},{path:"agentFeatures.peerAgents",label:()=>n.settings_agentFeatures_peerAgents_label(),description:()=>n.settings_agentFeatures_peerAgents_description(),defaultValue:!0},{path:"agentFeatures.mcpTools",label:()=>n.settings_agentFeatures_mcpTools_label(),description:()=>n.settings_agentFeatures_mcpTools_description(),defaultValue:!0}],Fi=Object.fromEntries(cr.map(e=>[e.path,e.defaultValue]));export{As as $,ni as A,Et as B,pt as C,Dr as D,vt as E,cr as F,Y as G,ds as H,cs as I,wt as J,ir as K,xs as L,ti as M,us as N,gt as O,ps as P,Or as Q,Nr as R,A as S,bs as T,re as U,q as V,Ss as W,se as X,te as Y,ks as Z,ys as _,$e as a,Ei as a$,ws as a0,Es as a1,vs as a2,_s as a3,ms as a4,Gr as a5,Hr as a6,Fs as a7,Ts as a8,Rs as a9,Ar as aA,yr as aB,Pr as aC,wr as aD,Cr as aE,kr as aF,Tr as aG,_r as aH,Fr as aI,Xr as aJ,Zt as aK,Kt as aL,mi as aM,Si as aN,Jr as aO,Yr as aP,bi as aQ,Ri as aR,Pi as aS,Jt as aT,yi as aU,Ai as aV,er as aW,Ci as aX,_i as aY,ki as aZ,Qt as a_,Ms as aa,Is as ab,Ps as ac,fi as ad,Qr as ae,rs as af,jr as ag,ei as ah,Kr as ai,Zr as aj,Wr as ak,Vr as al,H as am,Je as an,st as ao,it as ap,X as aq,rt as ar,Ye as as,Qe as at,et as au,tt as av,Er as aw,Rr as ax,Mr as ay,Ir as az,Fi as b,Yt as b0,Xt as b1,hi as b2,zr as b3,Cs as b4,gs as b5,lt as b6,is as b7,as as b8,ts as b9,ri as bA,ii as bB,gi as bC,Nt as bD,ui as bE,Os as bF,Ls as bG,Ws as bH,Ds as bI,$t as bJ,ns as bK,ss as ba,$r as bb,es as bc,v as bd,Ur as be,Br as bf,Ys as bg,Hs as bh,Qs as bi,Js as bj,zs as bk,Ks as bl,js as bm,qs as bn,Us as bo,Ns as bp,Xs as bq,Vs as br,$s as bs,Zs as bt,S as bu,ft as bv,fs as bw,hs as bx,wi as by,vi as bz,Ii as c,ls as d,pi as e,Ct as f,Tt as g,si as h,ai as i,qr as j,ct as k,ot as l,ci as m,Mi as n,Bs as o,Gs as p,Lr as q,xr as r,li as s,di as t,yt as u,ht as v,oi as w,os as x,K as y,Ti as z};
@@ -1,4 +1,4 @@
1
- import{p as tt}from"./gsePksRf.js";import{U as et,aZ as at,V as rt,a_ as it,Y as nt,b0 as ot,b as l,ay as E,X as st,q as lt,aX as ct,aH as dt,d as I,B as gt,r as ht,aJ as pt,O as ft}from"./DtluaQEg.js";import{p as ut}from"./nIshZjK_.js";import{o as mt}from"./DM3Yrkkb.js";var vt=ft.pie,R={sections:new Map,showData:!1},b=R.sections,H=R.showData,St=structuredClone(vt),xt=l(()=>structuredClone(St),"getConfig"),wt=l(()=>{b=new Map,H=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);b.has(t)||(b.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Ct=l(()=>b,"getSections"),yt=l(t=>{H=t},"setShowData"),Dt=l(()=>H,"getShowData"),U={getConfig:xt,clear:wt,setDiagramTitle:ot,getDiagramTitle:nt,setAccTitle:it,getAccTitle:rt,setAccDescription:at,getAccDescription:et,addSection:$t,getSections:Ct,setShowData:yt,getShowData:Dt},bt=l((t,a)=>{tt(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),Tt={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,U)},"parse")},At=l(t=>`
1
+ import{p as tt}from"./DaQPP3_d.js";import{U as et,aZ as at,V as rt,a_ as it,Y as nt,b0 as ot,b as l,ay as E,X as st,q as lt,aX as ct,aH as dt,d as I,B as gt,r as ht,aJ as pt,O as ft}from"./Cu11OjbU.js";import{p as ut}from"./nIshZjK_.js";import{o as mt}from"./BouO3S3L.js";var vt=ft.pie,R={sections:new Map,showData:!1},b=R.sections,H=R.showData,St=structuredClone(vt),xt=l(()=>structuredClone(St),"getConfig"),wt=l(()=>{b=new Map,H=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);b.has(t)||(b.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Ct=l(()=>b,"getSections"),yt=l(t=>{H=t},"setShowData"),Dt=l(()=>H,"getShowData"),U={getConfig:xt,clear:wt,setDiagramTitle:ot,getDiagramTitle:nt,setAccTitle:it,getAccTitle:rt,setAccDescription:at,getAccDescription:et,addSection:$t,getSections:Ct,setShowData:yt,getShowData:Dt},bt=l((t,a)=>{tt(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),Tt={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,U)},"parse")},At=l(t=>`
2
2
  .pieCircle{
3
3
  stroke: ${t.pieStrokeColor};
4
4
  stroke-width : ${t.pieStrokeWidth};
@@ -1,2 +1,2 @@
1
- import{t as Xt,bo as de,_ as aa,bw as Yt,bs as ge,bq as pr,b as Zt,bm as d}from"./CLAmm_T1.js";import{bs as Gt,ca as se,aD as e,bH as c,a5 as F,bA as k,W as s,bn as Jt,bV as j,c9 as i,aA as ce,c6 as Ht,ay as ve,be as ot,b$ as ct,b_ as I,bO as m,bS as g,bl as C,aB as x,bj as oa,aw as ut,ai as ia,c5 as ur,a as Lr,a7 as Ue,aj as yt,cd as na,br as la,bf as sa}from"./3SdAC2_C.js";import{i as Y}from"./BFgvMDua.js";import{k as Mr}from"./CIbfGsF-.js";import{g as Ut}from"./B1CKzIA2.js";import{c as Nt}from"./BwH4Bvte.js";import{s as Qe,g as jt,f as Kt}from"./CcJmuwXr.js";import{b as Rr}from"./Dn334wJv.js";import{JH as R,nZ as jr,wg as Ur,wf as Vr,LX as da,LY as ca,eK as ua,eL as fa,Ln as yr,m6 as nr,CI as $r,sI as kr,ol as va,Ad as pa,ad as Ir,n$ as ga,Ke as ma,Ku as _a,nz as ha,iX as wa,vI as ba,AG as xa,Lm as Pa}from"./B9vHutcJ.js";import{g as ya}from"./DWGXN6Nr.js";import{a as $a,h as ka,j as Ia,c as Sa,d as Ca,i as Fa,e as Da,f as Sr,g as Ta,b as lr}from"./ByyFoG6W.js";import{bO as Ea,b$ as La,dI as Ma}from"./C2UL5Ler.js";import{w as Cr,d as Ra}from"./wEnqV1Ol.js";import{f as ja}from"./BPQFiQQc.js";import{m as sr}from"./96V4v2iI.js";import{f as Te}from"./nxtepGjE.js";import{h as Ua}from"./TB9r2XJy.js";import"./BwNrQXlF.js";import{F as dt,ac as Va,au as za,aZ as Aa,b3 as Ot,ct as Wa,cu as Na,bm as Ba,cS as Ha,c9 as Oa}from"./DPttSllj.js";import{E as qa,b as Ka,S as Fr}from"./Dd-LQrG1.js";import{c as Xa}from"./ChTqQfQN.js";import"./BbYWP3Ow.js";import{$ as Ya}from"./0AIorxUa.js";import{i as dr,b as Za,a as Ga}from"./H2jLkRRS.js";import{C as fr,p as Ja}from"./BNJ3edFz.js";import{M as Qa}from"./DDVnHnMH.js";import{l as cr,m as zr}from"./Cu5e4npY.js";import"./DtzJzV-4.js";import"./hkJYqn41.js";import{M as Bt}from"./B6dUCFoz.js";import{V as eo}from"./BOVEEbKv.js";import{bT as to,b7 as ro}from"./BQGIKN0g.js";import{g as ao}from"./CYxt6gzD.js";import{H as oo}from"./Bqd7fdCF.js";import{g as io,W as no}from"./Jg5r77fy.js";import{b as lo,h as so}from"./C3dytrTL.js";import{u as co}from"./Cp5royN1.js";const Dr=1024*1024,uo=5e3;function fo(A,_){if(A.length>Dr||new TextEncoder().encode(A).byteLength>Dr){_(null);return}let re;try{re=new Worker(new URL("/app/immutable/workers/html-file-preview.worker-BfFljPK-.js",import.meta.url),{type:"module"})}catch{_(null);return}let Be=!1;const ee=setTimeout(()=>O(null),uo);function P(){Be||(Be=!0,clearTimeout(ee),re.terminate())}function O(ae){Be||(P(),_(ae))}return re.onmessage=({data:ae})=>O(ae),re.onerror=ae=>{ae.preventDefault(),O(null)},re.postMessage(A),P}const Ar=R.createSelector((A,_)=>jr(A.pdfPreview.previews,_));var vo=x('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),po=x('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function vr(A,_){if(new.target)return Xt({component:vr,...A});Gt(_,!0);const re=()=>ge(ye,"$preview",Be),[Be,ee]=pr();let P=de(_,"workspaceId",7),O=de(_,"filePath",7),ae=de(_,"gitRootId",7);const Ee=crypto.randomUUID(),ye=Ar(Ee),be=new WeakMap;let oe=j(null),et=j(void 0),U=j(1),B=j(1),pe=j(!0),xe=j(!1),Le=j(null),W=j(0);const $e=i(()=>re()?.error??e(Le)),Ce=i(()=>e($e)==="missing"?d.file_pdf_missing_error():e($e)==="large"?d.file_pdf_large_error():e($e)==="invalid"?d.file_pdf_invalid_error():e($e)==="password"?d.file_pdf_password_error():d.file_pdf_load_error());se(()=>{const v=P(),f=O();e(W);const ie=crypto.randomUUID();return R.dispatch(Ur(Ee,ie,v,f,...ae()?[{gitRootId:ae()}]:[])),()=>{R.dispatch(Vr(Ee,ie))}}),se(()=>{const v=re()?.url;let f=!1,ie;if(c(oe,null),c(Le,null),c(pe,!0),c(U,1),c(B,1),!!v)return(async()=>{try{const{loadPdfDocument:y}=await aa(async()=>{const{loadPdfDocument:N}=await import("./cb1JHFKl.js");return{loadPdfDocument:N}},[],import.meta.url);if(f)return;ie=y(v);const Z=await ie.promise;f||c(oe,Z)}catch(y){if(f)return;c(Le,y instanceof Error&&y.name==="PasswordException"?"password":y instanceof Error&&y.name==="InvalidPDFException"?"invalid":"load",!0)}finally{f||c(pe,!1)}})(),()=>{f=!0,ie?.destroy()}}),se(()=>{const v=e(oe),f=e(et),ie=e(U),y=e(B);if(!v||!f)return;let Z=!1,N,D;const fe=()=>{if(!D)return;const G=(be.get(D)??1)-1;G?be.set(D,G):(be.delete(D),D.cleanup()),D=void 0};return c(xe,!0),(async()=>{try{if(D=await v.getPage(ie),be.set(D,(be.get(D)??0)+1),Z){fe();return}const G=D.getViewport({scale:y}),ne=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(G.width*G.height)));f.width=Math.ceil(G.width*ne),f.height=Math.ceil(G.height*ne),f.style.width=`${G.width}px`,f.style.height=`${G.height}px`,N=D.render({canvas:f,viewport:G,transform:[ne,0,0,ne,0,0]}),await N.promise}catch{Z||c(Le,"invalid")}finally{Z||c(xe,!1)}})(),()=>{Z=!0,N?.cancel(),N?N.promise.then(fe,fe):fe()}});var qe={get workspaceId(){return P()},set workspaceId(v){P(v),ce()},get filePath(){return O()},set filePath(v){O(v),ce()},get gitRootId(){return ae()},set gitRootId(v){ae(v),ce()},$set:Yt,$on:(v,f)=>Zt(_,v,f)},Ve=po(),Ke=F(Ve);{var ue=v=>{{const f=y=>{ot();var Z=ct();I(()=>m(Z,e(Ce))),s(y,Z)};let ie=i(()=>d.ui_combobox_retry_label());qa(v,{onRetry:()=>Ht(W),get retryLabel(){return e(ie)},class:"m-auto",message:f,$$slots:{message:!0}})}},a=v=>{{let f=i(()=>d.file_pdf_loading_label());Ka(v,{get label(){return e(f)},count:1,class:"p-4"})}},l=v=>{var f=vo(),ie=ve(f),y=F(ie);{let me=i(()=>e(U)<=1);Te(y,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>Ht(U,-1),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.file_pdf_previous_label()]),s(Me,_e)},$$slots:{default:!0}})}var Z=g(y,2),N=C(Z,!0),D=g(Z,2);{let me=i(()=>e(U)>=e(oe).numPages);Te(D,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>Ht(U),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.file_pdf_next_label()]),s(Me,_e)},$$slots:{default:!0}})}var fe=g(D,2);{let me=i(()=>e(B)<=.25);Te(fe,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>c(B,Math.max(.25,e(B)-.25),!0),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.editor_fileViewer_zoomOut_tooltip()]),s(Me,_e)},$$slots:{default:!0}})}var G=g(fe,2),ne=C(G,!0),ft=g(G,2);{let me=i(()=>e(B)>=3);Te(ft,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>c(B,Math.min(3,e(B)+.25),!0),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.editor_fileViewer_zoomIn_tooltip()]),s(Me,_e)},$$slots:{default:!0}})}k(ie);var vt=g(ie,2),pt=F(vt);let bt;Rr(pt,me=>c(et,me),()=>e(et)),k(vt),I((me,Me,tt)=>{m(N,me),m(ne,Me),Qe(vt,"aria-busy",e(xe)),Qe(pt,"aria-label",tt),bt=jt(pt,"",bt,{visibility:e(xe)?"hidden":"visible"})},[()=>d.file_pdf_page_label({page:cr(e(U)),total:cr(e(oe).numPages)}),()=>zr(e(B),{style:"percent"}),()=>d.file_pdf_canvas_ariaLabel({name:O(),page:cr(e(U))})]),s(v,f)};Y(Ke,v=>{e($e)?v(ue):e(pe)||re()?.status==="loading"?v(a,1):e(oe)&&v(l,2)})}k(Ve),s(A,Ve);var q=Jt(qe);return ee(),q}const go=R.createSelector((A,_)=>jr(A.videoPreview.previews,_));var mo=x('<p role="status"> </p>'),_o=x('<p role="alert"> </p>'),ho=x('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),wo=x('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),bo=x('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Wr(A,_){if(new.target)return Xt({component:Wr,...A});Gt(_,!0);const re=()=>ge(et,"$preview",Be),[Be,ee]=pr();let P=de(_,"sourceUrl",7),O=de(_,"fileName",7),ae=de(_,"allowDownload",7),Ee=de(_,"downloading",7),ye=de(_,"onDownload",7),be=j(null);const oe=crypto.randomUUID(),et=go(oe),U=i(()=>re()?.status==="loading"),B=i(()=>e(be)??re()?.error);let pe=!1,xe=!1;oa(()=>{xe=!0,R.dispatch(da(oe))});function Le(){if(xe||e(U))return;const a=P().startsWith("workspace-file://")?new URL(P()):null;if(pe||!a||!a.pathname.toLowerCase().endsWith(".mp4")){c(be,"unsupported");return}pe=!0,a.searchParams.set("preview","h264"),R.dispatch(ca(oe,a.hostname,a.toString()))}function W(a){if(xe)return;const l=a.currentTarget.error?.code;l===2?c(be,"network"):l!==1&&Le()}var $e={get sourceUrl(){return P()},set sourceUrl(a){P(a),ce()},get fileName(){return O()},set fileName(a){O(a),ce()},get allowDownload(){return ae()},set allowDownload(a){ae(a),ce()},get downloading(){return Ee()},set downloading(a){Ee(a),ce()},get onDownload(){return ye()},set onDownload(a){ye(a),ce()},$set:Yt,$on:(a,l)=>Zt(_,a,l)},Ce=bo(),qe=F(Ce);{var Ve=a=>{var l=ho(),q=F(l),v=C(q,!0),f=g(q,2);{var ie=D=>{var fe=mo(),G=C(fe,!0);I(ne=>m(G,ne),[()=>d.editor_fileViewer_videoPreparing_label()]),s(D,fe)},y=D=>{var fe=_o(),G=C(fe,!0);I(ne=>m(G,ne),[()=>e(B)==="network"?d.editor_fileViewer_videoLoad_error():d.editor_fileViewer_videoUnsupported_label()]),s(D,fe)};Y(f,D=>{e(U)?D(ie):D(y,-1)})}var Z=g(f,2);{var N=D=>{Te(D,{variant:"secondary",size:"sm",get onclick(){return ye()},get disabled(){return Ee()},children:(fe,G)=>{ot();var ne=ct();I(ft=>m(ne,ft),[()=>d.layout_fileTab_downloadFile_label()]),s(fe,ne)},$$slots:{default:!0}})};Y(Z,D=>{ae()&&D(N)})}k(l),I(()=>m(v,O())),s(a,l)},Ke=a=>{var l=wo(),q=C(l,!0);I(v=>{Qe(l,"src",re()?.url??P()),m(q,v)},[()=>d.editor_fileViewer_videoUnsupported_label()]),ut("error",l,W),ut("loadedmetadata",l,v=>{v.currentTarget.videoWidth===0&&Le()}),s(a,l)};Y(qe,a=>{e(B)||e(U)?a(Ve):a(Ke,-1)})}k(Ce),s(A,Ce);var ue=Jt($e);return ee(),ue}var xo=x('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Po=x('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),yo=x('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),$o=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),ko=x("<!> ",1),Io=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),So=x('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),Co=x('<td class="border border-border px-2 py-1 text-xs"> </td>'),Fo=x("<tr></tr>"),Do=x('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),To=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),Eo=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),Lo=x('<div class="h-full flex flex-col"><!></div>');function qt(A,_){if(new.target)return Xt({component:qt,...A});Gt(_,!0);const re=t=>{var o=xo(),u=ve(o);{let V=i(()=>d.editor_fileViewer_zoomOut_tooltip());Te(u,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:fe,get title(){return e(V)},children:(T,K)=>{dt(T,{get icon(){return Wa},size:"sm"})},$$slots:{default:!0}})}var w=g(u,2),$=C(w,!0),E=g(w,2);{let V=i(()=>d.editor_fileViewer_zoomIn_tooltip());Te(E,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:D,get title(){return e(V)},children:(T,K)=>{dt(T,{get icon(){return Na},size:"sm"})},$$slots:{default:!0}})}ot(2),I(()=>m($,e(Le))),s(t,o)},Be=Xa("FileViewer");let ee=de(_,"filePath",7),P=de(_,"fileContent",7,""),O=de(_,"sourceUrl",7),ae=de(_,"language",7),Ee=de(_,"isBinary",7),ye=de(_,"allowDownload",7,!0),be=de(_,"onDownload",7),oe=de(_,"downloading",7,!1);const et=t=>{const o=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(o)?"image":o==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(o)?"video":["mp3","wav","ogg","m4a","flac"].includes(o)?"audio":o==="pdf"?"pdf":["md","markdown"].includes(o)?"markdown":o==="json"?"json":o==="csv"?"csv":["yaml","yml"].includes(o)?"yaml":o==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(o)?"archive":["exe","dll","so","dylib","wasm"].includes(o)?"binary":"text"},U=i(()=>et(ee())),B=i(()=>ee().split("/").pop()||d.editor_fileViewer_unknown_fallback());let pe=j(100),xe=j(0);const Le=i(()=>zr(e(pe)/100,{style:"percent",maximumFractionDigits:0}));let W=j(!1),$e=j(0),Ce=j(0),qe=j(0),Ve=j(0),Ke=j(!1),ue=null;function a(){const t=ue;ue=null,c(Ke,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function l(t){if(t.button!==0||!t.isPrimary||ue)return;const o=t.currentTarget;o.setPointerCapture(t.pointerId),ue={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:o},c(Ke,!0),t.preventDefault()}function q(t){if(!(!ue||t.pointerId!==ue.pointerId)){if((t.buttons&1)===0){a();return}c(qe,ue.viewport.scrollLeft,!0),c(Ve,ue.viewport.scrollTop,!0),c($e,e($e)+(t.clientX-ue.x)),c(Ce,e(Ce)+(t.clientY-ue.y)),ue.x=t.clientX,ue.y=t.clientY}}function v(t){t.pointerId===ue?.pointerId&&a()}se(()=>{ee(),O(),e(pe),e(xe),c(qe,0),c(Ve,0)}),se(()=>(ee(),O(),ur(()=>{a(),c($e,0),c(Ce,0)}),a));const f=t=>{const o=t.split(".").pop()?.toLowerCase();return o==="jpg"||o==="jpeg"?"image/jpeg":o==="png"?"image/png":o==="gif"?"image/gif":o==="webp"?"image/webp":"application/octet-stream"},ie=t=>{const o=t.split(".").pop()?.toLowerCase();if(o==="mp4")return"video/mp4";if(o==="webm")return"video/webm"},y=()=>{if(O())return O();if(typeof P()=="string")return P().startsWith("data:")||P().startsWith("http")?P():Ee()?`data:${f(ee())};base64,${P()}`:`data:${f(ee())};base64,${P()}`;if(P()instanceof ArrayBuffer){const o=new Uint8Array(P()).reduce((w,$)=>w+String.fromCharCode($),""),u=btoa(o);return`data:${f(ee())};base64,${u}`}return""},Z=()=>{if(O())return O();const t=ie(ee());if(!t)return"";if(typeof P()=="string")return P().startsWith("data:")||P().startsWith("http")?P():`data:${t};base64,${P()}`;const o=new Uint8Array(P()),u=[],w=32768;for(let $=0;$<o.length;$+=w)u.push(String.fromCharCode(...o.subarray($,$+w)));return`data:${t};base64,${btoa(u.join(""))}`},N=()=>{const t=typeof P()=="string"?new TextEncoder().encode(P()):new Uint8Array(P()),o=[],u=32768;for(let w=0;w<t.length;w+=u)o.push(String.fromCharCode(...t.subarray(w,w+u)));return`data:image/svg+xml;base64,${btoa(o.join(""))}`},D=()=>{c(pe,Math.min(e(pe)+25,500),!0)},fe=()=>{c(pe,Math.max(e(pe)-25,25),!0)},G=()=>{c(xe,(e(xe)+90)%360)},ne=()=>{if(!ye()||oe())return;if(be()){be()();return}const t=document.createElement("a");t.href=e(U)==="video"?Z():e(U)==="svg"?N():y(),t.download=e(B),t.click()},ft=async()=>{try{const t=y(),o=new Image;o.crossOrigin="anonymous";const u=await new Promise((w,$)=>{o.onload=()=>{const E=document.createElement("canvas");E.width=o.naturalWidth,E.height=o.naturalHeight;const V=E.getContext("2d");if(!V){$(new Error("Failed to get canvas context"));return}V.drawImage(o,0,0),E.toBlob(T=>{T?w(T):$(new Error("Failed to create blob from canvas"))},"image/png",1)},o.onerror=()=>$(new Error("Failed to load image")),o.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":u})]),c(W,!0),setTimeout(()=>c(W,!1),2e3)}catch(t){Be.error("Failed to copy image:",t)}},vt=t=>{try{const o=JSON.parse(t);return JSON.stringify(o,null,2)}catch{return t}},pt=t=>t.split(`
1
+ import{t as Xt,bo as de,_ as aa,bw as Yt,bs as ge,bq as pr,b as Zt,bm as d}from"./CLAmm_T1.js";import{bs as Gt,ca as se,aD as e,bH as c,a5 as F,bA as k,W as s,bn as Jt,bV as j,c9 as i,aA as ce,c6 as Ht,ay as ve,be as ot,b$ as ct,b_ as I,bO as m,bS as g,bl as C,aB as x,bj as oa,aw as ut,ai as ia,c5 as ur,a as Lr,a7 as Ue,aj as yt,cd as na,br as la,bf as sa}from"./3SdAC2_C.js";import{i as Y}from"./BFgvMDua.js";import{k as Mr}from"./CIbfGsF-.js";import{g as Ut}from"./B1CKzIA2.js";import{c as Nt}from"./BwH4Bvte.js";import{s as Qe,g as jt,f as Kt}from"./CcJmuwXr.js";import{b as Rr}from"./Dn334wJv.js";import{JH as R,nZ as jr,wg as Ur,wf as Vr,LX as da,LY as ca,eK as ua,eL as fa,Ln as yr,m6 as nr,CI as $r,sI as kr,ol as va,Ad as pa,ad as Ir,n$ as ga,Ke as ma,Ku as _a,nz as ha,iX as wa,vI as ba,AG as xa,Lm as Pa}from"./B9vHutcJ.js";import{g as ya}from"./DWGXN6Nr.js";import{a as $a,h as ka,j as Ia,c as Sa,d as Ca,i as Fa,e as Da,f as Sr,g as Ta,b as lr}from"./ByyFoG6W.js";import{bO as Ea,b$ as La,dI as Ma}from"./C2UL5Ler.js";import{w as Cr,d as Ra}from"./wEnqV1Ol.js";import{f as ja}from"./BPQFiQQc.js";import{m as sr}from"./96V4v2iI.js";import{f as Te}from"./nxtepGjE.js";import{h as Ua}from"./TB9r2XJy.js";import"./BwNrQXlF.js";import{F as dt,ac as Va,au as za,aZ as Aa,b3 as Ot,ct as Wa,cu as Na,bm as Ba,cS as Ha,c9 as Oa}from"./DPttSllj.js";import{E as qa,b as Ka,S as Fr}from"./Dd-LQrG1.js";import{c as Xa}from"./ChTqQfQN.js";import"./BbYWP3Ow.js";import{$ as Ya}from"./BSXmccL1.js";import{i as dr,b as Za,a as Ga}from"./H2jLkRRS.js";import{C as fr,p as Ja}from"./BNJ3edFz.js";import{M as Qa}from"./D78ptBES.js";import{l as cr,m as zr}from"./Cu5e4npY.js";import"./DtzJzV-4.js";import"./hkJYqn41.js";import{M as Bt}from"./B6dUCFoz.js";import{V as eo}from"./BOVEEbKv.js";import{bT as to,b7 as ro}from"./CQlYR8ss.js";import{g as ao}from"./CYxt6gzD.js";import{H as oo}from"./Bqd7fdCF.js";import{g as io,W as no}from"./Jg5r77fy.js";import{b as lo,h as so}from"./C3dytrTL.js";import{u as co}from"./Cp5royN1.js";const Dr=1024*1024,uo=5e3;function fo(A,_){if(A.length>Dr||new TextEncoder().encode(A).byteLength>Dr){_(null);return}let re;try{re=new Worker(new URL("/app/immutable/workers/html-file-preview.worker-BfFljPK-.js",import.meta.url),{type:"module"})}catch{_(null);return}let Be=!1;const ee=setTimeout(()=>O(null),uo);function P(){Be||(Be=!0,clearTimeout(ee),re.terminate())}function O(ae){Be||(P(),_(ae))}return re.onmessage=({data:ae})=>O(ae),re.onerror=ae=>{ae.preventDefault(),O(null)},re.postMessage(A),P}const Ar=R.createSelector((A,_)=>jr(A.pdfPreview.previews,_));var vo=x('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),po=x('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function vr(A,_){if(new.target)return Xt({component:vr,...A});Gt(_,!0);const re=()=>ge(ye,"$preview",Be),[Be,ee]=pr();let P=de(_,"workspaceId",7),O=de(_,"filePath",7),ae=de(_,"gitRootId",7);const Ee=crypto.randomUUID(),ye=Ar(Ee),be=new WeakMap;let oe=j(null),et=j(void 0),U=j(1),B=j(1),pe=j(!0),xe=j(!1),Le=j(null),W=j(0);const $e=i(()=>re()?.error??e(Le)),Ce=i(()=>e($e)==="missing"?d.file_pdf_missing_error():e($e)==="large"?d.file_pdf_large_error():e($e)==="invalid"?d.file_pdf_invalid_error():e($e)==="password"?d.file_pdf_password_error():d.file_pdf_load_error());se(()=>{const v=P(),f=O();e(W);const ie=crypto.randomUUID();return R.dispatch(Ur(Ee,ie,v,f,...ae()?[{gitRootId:ae()}]:[])),()=>{R.dispatch(Vr(Ee,ie))}}),se(()=>{const v=re()?.url;let f=!1,ie;if(c(oe,null),c(Le,null),c(pe,!0),c(U,1),c(B,1),!!v)return(async()=>{try{const{loadPdfDocument:y}=await aa(async()=>{const{loadPdfDocument:N}=await import("./cb1JHFKl.js");return{loadPdfDocument:N}},[],import.meta.url);if(f)return;ie=y(v);const Z=await ie.promise;f||c(oe,Z)}catch(y){if(f)return;c(Le,y instanceof Error&&y.name==="PasswordException"?"password":y instanceof Error&&y.name==="InvalidPDFException"?"invalid":"load",!0)}finally{f||c(pe,!1)}})(),()=>{f=!0,ie?.destroy()}}),se(()=>{const v=e(oe),f=e(et),ie=e(U),y=e(B);if(!v||!f)return;let Z=!1,N,D;const fe=()=>{if(!D)return;const G=(be.get(D)??1)-1;G?be.set(D,G):(be.delete(D),D.cleanup()),D=void 0};return c(xe,!0),(async()=>{try{if(D=await v.getPage(ie),be.set(D,(be.get(D)??0)+1),Z){fe();return}const G=D.getViewport({scale:y}),ne=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(G.width*G.height)));f.width=Math.ceil(G.width*ne),f.height=Math.ceil(G.height*ne),f.style.width=`${G.width}px`,f.style.height=`${G.height}px`,N=D.render({canvas:f,viewport:G,transform:[ne,0,0,ne,0,0]}),await N.promise}catch{Z||c(Le,"invalid")}finally{Z||c(xe,!1)}})(),()=>{Z=!0,N?.cancel(),N?N.promise.then(fe,fe):fe()}});var qe={get workspaceId(){return P()},set workspaceId(v){P(v),ce()},get filePath(){return O()},set filePath(v){O(v),ce()},get gitRootId(){return ae()},set gitRootId(v){ae(v),ce()},$set:Yt,$on:(v,f)=>Zt(_,v,f)},Ve=po(),Ke=F(Ve);{var ue=v=>{{const f=y=>{ot();var Z=ct();I(()=>m(Z,e(Ce))),s(y,Z)};let ie=i(()=>d.ui_combobox_retry_label());qa(v,{onRetry:()=>Ht(W),get retryLabel(){return e(ie)},class:"m-auto",message:f,$$slots:{message:!0}})}},a=v=>{{let f=i(()=>d.file_pdf_loading_label());Ka(v,{get label(){return e(f)},count:1,class:"p-4"})}},l=v=>{var f=vo(),ie=ve(f),y=F(ie);{let me=i(()=>e(U)<=1);Te(y,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>Ht(U,-1),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.file_pdf_previous_label()]),s(Me,_e)},$$slots:{default:!0}})}var Z=g(y,2),N=C(Z,!0),D=g(Z,2);{let me=i(()=>e(U)>=e(oe).numPages);Te(D,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>Ht(U),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.file_pdf_next_label()]),s(Me,_e)},$$slots:{default:!0}})}var fe=g(D,2);{let me=i(()=>e(B)<=.25);Te(fe,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>c(B,Math.max(.25,e(B)-.25),!0),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.editor_fileViewer_zoomOut_tooltip()]),s(Me,_e)},$$slots:{default:!0}})}var G=g(fe,2),ne=C(G,!0),ft=g(G,2);{let me=i(()=>e(B)>=3);Te(ft,{variant:"ghost",size:"compact",get disabled(){return e(me)},onclick:()=>c(B,Math.min(3,e(B)+.25),!0),children:(Me,tt)=>{ot();var _e=ct();I(Re=>m(_e,Re),[()=>d.editor_fileViewer_zoomIn_tooltip()]),s(Me,_e)},$$slots:{default:!0}})}k(ie);var vt=g(ie,2),pt=F(vt);let bt;Rr(pt,me=>c(et,me),()=>e(et)),k(vt),I((me,Me,tt)=>{m(N,me),m(ne,Me),Qe(vt,"aria-busy",e(xe)),Qe(pt,"aria-label",tt),bt=jt(pt,"",bt,{visibility:e(xe)?"hidden":"visible"})},[()=>d.file_pdf_page_label({page:cr(e(U)),total:cr(e(oe).numPages)}),()=>zr(e(B),{style:"percent"}),()=>d.file_pdf_canvas_ariaLabel({name:O(),page:cr(e(U))})]),s(v,f)};Y(Ke,v=>{e($e)?v(ue):e(pe)||re()?.status==="loading"?v(a,1):e(oe)&&v(l,2)})}k(Ve),s(A,Ve);var q=Jt(qe);return ee(),q}const go=R.createSelector((A,_)=>jr(A.videoPreview.previews,_));var mo=x('<p role="status"> </p>'),_o=x('<p role="alert"> </p>'),ho=x('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),wo=x('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),bo=x('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Wr(A,_){if(new.target)return Xt({component:Wr,...A});Gt(_,!0);const re=()=>ge(et,"$preview",Be),[Be,ee]=pr();let P=de(_,"sourceUrl",7),O=de(_,"fileName",7),ae=de(_,"allowDownload",7),Ee=de(_,"downloading",7),ye=de(_,"onDownload",7),be=j(null);const oe=crypto.randomUUID(),et=go(oe),U=i(()=>re()?.status==="loading"),B=i(()=>e(be)??re()?.error);let pe=!1,xe=!1;oa(()=>{xe=!0,R.dispatch(da(oe))});function Le(){if(xe||e(U))return;const a=P().startsWith("workspace-file://")?new URL(P()):null;if(pe||!a||!a.pathname.toLowerCase().endsWith(".mp4")){c(be,"unsupported");return}pe=!0,a.searchParams.set("preview","h264"),R.dispatch(ca(oe,a.hostname,a.toString()))}function W(a){if(xe)return;const l=a.currentTarget.error?.code;l===2?c(be,"network"):l!==1&&Le()}var $e={get sourceUrl(){return P()},set sourceUrl(a){P(a),ce()},get fileName(){return O()},set fileName(a){O(a),ce()},get allowDownload(){return ae()},set allowDownload(a){ae(a),ce()},get downloading(){return Ee()},set downloading(a){Ee(a),ce()},get onDownload(){return ye()},set onDownload(a){ye(a),ce()},$set:Yt,$on:(a,l)=>Zt(_,a,l)},Ce=bo(),qe=F(Ce);{var Ve=a=>{var l=ho(),q=F(l),v=C(q,!0),f=g(q,2);{var ie=D=>{var fe=mo(),G=C(fe,!0);I(ne=>m(G,ne),[()=>d.editor_fileViewer_videoPreparing_label()]),s(D,fe)},y=D=>{var fe=_o(),G=C(fe,!0);I(ne=>m(G,ne),[()=>e(B)==="network"?d.editor_fileViewer_videoLoad_error():d.editor_fileViewer_videoUnsupported_label()]),s(D,fe)};Y(f,D=>{e(U)?D(ie):D(y,-1)})}var Z=g(f,2);{var N=D=>{Te(D,{variant:"secondary",size:"sm",get onclick(){return ye()},get disabled(){return Ee()},children:(fe,G)=>{ot();var ne=ct();I(ft=>m(ne,ft),[()=>d.layout_fileTab_downloadFile_label()]),s(fe,ne)},$$slots:{default:!0}})};Y(Z,D=>{ae()&&D(N)})}k(l),I(()=>m(v,O())),s(a,l)},Ke=a=>{var l=wo(),q=C(l,!0);I(v=>{Qe(l,"src",re()?.url??P()),m(q,v)},[()=>d.editor_fileViewer_videoUnsupported_label()]),ut("error",l,W),ut("loadedmetadata",l,v=>{v.currentTarget.videoWidth===0&&Le()}),s(a,l)};Y(qe,a=>{e(B)||e(U)?a(Ve):a(Ke,-1)})}k(Ce),s(A,Ce);var ue=Jt($e);return ee(),ue}var xo=x('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Po=x('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),yo=x('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),$o=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),ko=x("<!> ",1),Io=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),So=x('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),Co=x('<td class="border border-border px-2 py-1 text-xs"> </td>'),Fo=x("<tr></tr>"),Do=x('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),To=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),Eo=x('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),Lo=x('<div class="h-full flex flex-col"><!></div>');function qt(A,_){if(new.target)return Xt({component:qt,...A});Gt(_,!0);const re=t=>{var o=xo(),u=ve(o);{let V=i(()=>d.editor_fileViewer_zoomOut_tooltip());Te(u,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:fe,get title(){return e(V)},children:(T,K)=>{dt(T,{get icon(){return Wa},size:"sm"})},$$slots:{default:!0}})}var w=g(u,2),$=C(w,!0),E=g(w,2);{let V=i(()=>d.editor_fileViewer_zoomIn_tooltip());Te(E,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:D,get title(){return e(V)},children:(T,K)=>{dt(T,{get icon(){return Na},size:"sm"})},$$slots:{default:!0}})}ot(2),I(()=>m($,e(Le))),s(t,o)},Be=Xa("FileViewer");let ee=de(_,"filePath",7),P=de(_,"fileContent",7,""),O=de(_,"sourceUrl",7),ae=de(_,"language",7),Ee=de(_,"isBinary",7),ye=de(_,"allowDownload",7,!0),be=de(_,"onDownload",7),oe=de(_,"downloading",7,!1);const et=t=>{const o=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(o)?"image":o==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(o)?"video":["mp3","wav","ogg","m4a","flac"].includes(o)?"audio":o==="pdf"?"pdf":["md","markdown"].includes(o)?"markdown":o==="json"?"json":o==="csv"?"csv":["yaml","yml"].includes(o)?"yaml":o==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(o)?"archive":["exe","dll","so","dylib","wasm"].includes(o)?"binary":"text"},U=i(()=>et(ee())),B=i(()=>ee().split("/").pop()||d.editor_fileViewer_unknown_fallback());let pe=j(100),xe=j(0);const Le=i(()=>zr(e(pe)/100,{style:"percent",maximumFractionDigits:0}));let W=j(!1),$e=j(0),Ce=j(0),qe=j(0),Ve=j(0),Ke=j(!1),ue=null;function a(){const t=ue;ue=null,c(Ke,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function l(t){if(t.button!==0||!t.isPrimary||ue)return;const o=t.currentTarget;o.setPointerCapture(t.pointerId),ue={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:o},c(Ke,!0),t.preventDefault()}function q(t){if(!(!ue||t.pointerId!==ue.pointerId)){if((t.buttons&1)===0){a();return}c(qe,ue.viewport.scrollLeft,!0),c(Ve,ue.viewport.scrollTop,!0),c($e,e($e)+(t.clientX-ue.x)),c(Ce,e(Ce)+(t.clientY-ue.y)),ue.x=t.clientX,ue.y=t.clientY}}function v(t){t.pointerId===ue?.pointerId&&a()}se(()=>{ee(),O(),e(pe),e(xe),c(qe,0),c(Ve,0)}),se(()=>(ee(),O(),ur(()=>{a(),c($e,0),c(Ce,0)}),a));const f=t=>{const o=t.split(".").pop()?.toLowerCase();return o==="jpg"||o==="jpeg"?"image/jpeg":o==="png"?"image/png":o==="gif"?"image/gif":o==="webp"?"image/webp":"application/octet-stream"},ie=t=>{const o=t.split(".").pop()?.toLowerCase();if(o==="mp4")return"video/mp4";if(o==="webm")return"video/webm"},y=()=>{if(O())return O();if(typeof P()=="string")return P().startsWith("data:")||P().startsWith("http")?P():Ee()?`data:${f(ee())};base64,${P()}`:`data:${f(ee())};base64,${P()}`;if(P()instanceof ArrayBuffer){const o=new Uint8Array(P()).reduce((w,$)=>w+String.fromCharCode($),""),u=btoa(o);return`data:${f(ee())};base64,${u}`}return""},Z=()=>{if(O())return O();const t=ie(ee());if(!t)return"";if(typeof P()=="string")return P().startsWith("data:")||P().startsWith("http")?P():`data:${t};base64,${P()}`;const o=new Uint8Array(P()),u=[],w=32768;for(let $=0;$<o.length;$+=w)u.push(String.fromCharCode(...o.subarray($,$+w)));return`data:${t};base64,${btoa(u.join(""))}`},N=()=>{const t=typeof P()=="string"?new TextEncoder().encode(P()):new Uint8Array(P()),o=[],u=32768;for(let w=0;w<t.length;w+=u)o.push(String.fromCharCode(...t.subarray(w,w+u)));return`data:image/svg+xml;base64,${btoa(o.join(""))}`},D=()=>{c(pe,Math.min(e(pe)+25,500),!0)},fe=()=>{c(pe,Math.max(e(pe)-25,25),!0)},G=()=>{c(xe,(e(xe)+90)%360)},ne=()=>{if(!ye()||oe())return;if(be()){be()();return}const t=document.createElement("a");t.href=e(U)==="video"?Z():e(U)==="svg"?N():y(),t.download=e(B),t.click()},ft=async()=>{try{const t=y(),o=new Image;o.crossOrigin="anonymous";const u=await new Promise((w,$)=>{o.onload=()=>{const E=document.createElement("canvas");E.width=o.naturalWidth,E.height=o.naturalHeight;const V=E.getContext("2d");if(!V){$(new Error("Failed to get canvas context"));return}V.drawImage(o,0,0),E.toBlob(T=>{T?w(T):$(new Error("Failed to create blob from canvas"))},"image/png",1)},o.onerror=()=>$(new Error("Failed to load image")),o.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":u})]),c(W,!0),setTimeout(()=>c(W,!1),2e3)}catch(t){Be.error("Failed to copy image:",t)}},vt=t=>{try{const o=JSON.parse(t);return JSON.stringify(o,null,2)}catch{return t}},pt=t=>t.split(`
2
2
  `).map(u=>u.split(",").map(w=>w.trim()));var bt={get filePath(){return ee()},set filePath(t){ee(t),ce()},get fileContent(){return P()},set fileContent(t=""){P(t),ce()},get sourceUrl(){return O()},set sourceUrl(t){O(t),ce()},get language(){return ae()},set language(t){ae(t),ce()},get isBinary(){return Ee()},set isBinary(t){Ee(t),ce()},get allowDownload(){return ye()},set allowDownload(t=!0){ye(t),ce()},get onDownload(){return be()},set onDownload(t){be(t),ce()},get downloading(){return oe()},set downloading(t=!1){oe(t),ce()},$set:Yt,$on:(t,o)=>Zt(_,t,o)},me=Lo();ut("blur",Lr,a);var Me=F(me);{var tt=t=>{var o=Po(),u=F(o),w=F(u);re(w);var $=g(w,2);{let Pe=i(()=>d.editor_fileViewer_rotate_tooltip());Te($,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:G,get title(){return e(Pe)},children:(Ae,Ye)=>{dt(Ae,{get icon(){return Va},size:"sm"})},$$slots:{default:!0}})}var E=g($,4);{let Pe=i(()=>d.editor_fileViewer_copyImage_tooltip());Te(E,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ft,get title(){return e(Pe)},children:(Ae,Ye)=>{var rt=Ue(),Ze=ve(rt);{var kt=Fe=>{dt(Fe,{get icon(){return za},size:"sm",class:"text-green-500"})},Vt=Fe=>{dt(Fe,{get icon(){return Aa},size:"sm"})};Y(Ze,Fe=>{e(W)?Fe(kt):Fe(Vt,-1)})}s(Ae,rt)},$$slots:{default:!0}})}var V=g(E,2);{let Pe=i(()=>!ye()||oe()),Ae=i(()=>d.editor_fileViewer_download_tooltip());Te(V,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ne,get disabled(){return e(Pe)},get title(){return e(Ae)},children:(Ye,rt)=>{dt(Ye,{get icon(){return Ot},size:"sm"})},$$slots:{default:!0}})}var T=g(V,2),K=C(T,!0);k(u);var L=g(u,2),he=C(L);k(o),I(Pe=>{m(K,e(B)),Kt(L,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(Ke)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),jt(L,`--pan-scroll-x: ${e(qe)??""}px; --pan-scroll-y: ${e(Ve)??""}px;`),Qe(he,"src",Pe),Qe(he,"alt",e(B)),jt(he,`translate: ${e($e)??""}px ${e(Ce)??""}px; transform: scale(${e(pe)/100}) rotate(${e(xe)??""}deg); transition: transform 0.2s;`)},[()=>y()]),yt("pointerdown",L,l),yt("pointermove",L,q),yt("pointerup",L,v),ut("pointercancel",L,v),ut("lostpointercapture",L,v),s(t,o)},_e=t=>{var o=yo(),u=F(o),w=F(u);re(w);var $=g(w,2);{let L=i(()=>!ye()||oe()),he=i(()=>d.editor_fileViewer_download_tooltip());Te($,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ne,get disabled(){return e(L)},get title(){return e(he)},children:(Pe,Ae)=>{dt(Pe,{get icon(){return Ot},size:"sm"})},$$slots:{default:!0}})}var E=g($,2),V=C(E,!0);k(u);var T=g(u,2),K=C(T);k(o),I(L=>{m(V,e(B)),Kt(T,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(Ke)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),jt(T,`--pan-scroll-x: ${e(qe)??""}px; --pan-scroll-y: ${e(Ve)??""}px;`),Qe(K,"src",L),Qe(K,"alt",e(B)),jt(K,`translate: ${e($e)??""}px ${e(Ce)??""}px; transform: scale(${e(pe)/100});`)},[()=>N()]),yt("pointerdown",T,l),yt("pointermove",T,q),yt("pointerup",T,v),ut("pointercancel",T,v),ut("lostpointercapture",T,v),s(t,o)},Re=t=>{const o=i(Z);var u=Ue(),w=ve(u);Mr(w,()=>ee()+e(o),$=>{Wr($,{get sourceUrl(){return e(o)},get fileName(){return e(B)},get allowDownload(){return ye()},get downloading(){return oe()},onDownload:ne})}),s(t,u)},Qt=t=>{var o=$o(),u=g(F(o),2),w=C(u,!0),$=g(u,2),E=F($),V=g(E);k($),k(o),I((T,K)=>{m(w,e(B)),Qe(E,"src",T),m(V,` ${K??""}`)},[()=>y(),()=>d.editor_fileViewer_audioUnsupported_label()]),s(t,o)},$t=t=>{var o=Io(),u=g(F(o),2),w=C(u,!0),$=g(u,2);{let E=i(()=>!ye()||oe());Te($,{size:"sm",variant:"secondary",onclick:ne,get disabled(){return e(E)},children:(V,T)=>{var K=ko(),L=ve(K);dt(L,{get icon(){return Ot},size:"sm",class:"mr-2"});var he=g(L);I(Pe=>m(he,` ${Pe??""}`),[()=>d.editor_fileViewer_downloadPdf_label()]),s(V,K)},$$slots:{default:!0}})}k(o),I(E=>m(w,E),[()=>d.editor_fileViewer_pdfUnavailable_label()]),s(t,o)},er=t=>{{let o=i(()=>vt(P().toString()));fr(t,{get value(){return e(o)},language:"json",get fileName(){return ee()},lineNumbers:!0,readOnly:!0})}},tr=t=>{const o=i(()=>pt(P().toString()));var u=Do(),w=F(u),$=F(w),E=F($);Ut(E,23,()=>e(o)[0]||[],(T,K)=>`header-${K}-${T}`,(T,K)=>{var L=So(),he=C(L,!0);I(()=>m(he,e(K))),s(T,L)}),k(E),k($);var V=g($);Ut(V,23,()=>e(o).slice(1),(T,K)=>`row-${K}`,(T,K,L)=>{var he=Fo();Ut(he,23,()=>e(K),(Pe,Ae)=>`cell-${e(L)}-${Ae}`,(Pe,Ae)=>{var Ye=Co(),rt=C(Ye,!0);I(()=>m(rt,e(Ae))),s(Pe,Ye)}),k(he),s(T,he)}),k(V),k(w),k(u),s(t,u)},Xe=t=>{var o=To(),u=g(F(o),2),w=C(u,!0),$=g(u,2),E=C($,!0);k(o),I(V=>{m(w,e(B)),m(E,V)},[()=>d.editor_fileViewer_archive_label()]),s(t,o)},ze=t=>{var o=Eo(),u=g(F(o),2),w=C(u,!0),$=g(u,2),E=C($,!0);k(o),I(V=>{m(w,e(B)),m(E,V)},[()=>d.editor_fileViewer_binary_label()]),s(t,o)},rr=t=>{{let o=i(()=>P().toString());fr(t,{get value(){return e(o)},get language(){return ae()},get fileName(){return ee()},lineNumbers:!0,highlightActiveLine:!0})}};Y(Me,t=>{e(U)==="image"?t(tt):e(U)==="svg"?t(_e,1):e(U)==="video"?t(Re,2):e(U)==="audio"?t(Qt,3):e(U)==="pdf"?t($t,4):e(U)==="json"?t(er,5):e(U)==="csv"?t(tr,6):e(U)==="archive"?t(Xe,7):e(U)==="binary"?t(ze,8):t(rr,-1)})}return k(me),s(A,me),Jt(bt)}ia(["pointerdown","pointermove","pointerup"]);const Mo=/access denied|permission denied|outside (?:the )?workspace/i,Ro=/file not found|no such file or directory/i;function jo(A){return Mo.test(A)?"access-denied":A===d.files_read_notFound_error()||Ro.test(A)?"not-found":"generic"}function Uo(A){switch(A){case"access-denied":return d.layout_fileTab_errorAccessDenied_label();case"not-found":return d.layout_fileTab_errorNotFound_label();case"generic":return d.layout_fileTab_errorGeneric_label()}}var Vo=x("<!> <!>",1),zo=x("<!> <!> <!>",1),Ao=x('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p> </p> <p class="text-xs"> </p></div>'),Tr=x('<div class="flex h-full items-center justify-center p-4 text-subtle"><p role="alert"> </p></div>'),Wo=x('<div class="flex h-full items-center justify-center text-subtle"><p> </p></div>'),Er=x('<div class="flex items-center justify-center h-full text-subtle"><p> </p></div>'),No=x('<div class="flex items-center gap-3"><!> <!></div>'),Bo=x('<div class="flex flex-col h-full"><div class="flex-1 p-4 space-y-2"></div></div>'),Ho=x('<p class="text-xs"> </p>'),Oo=x("<li><!></li>"),qo=x('<p class="text-xs mt-2"> </p> <ul class="flex flex-col items-center gap-1"></ul>',1),Ko=x('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p class="text-danger" role="alert"> </p> <p class="text-xs font-mono"> </p> <!> <!></div>'),Xo=x('<div class="flex flex-col items-center justify-center h-full text-subtle gap-3 p-4"><p> </p> <p class="text-xs break-all"> </p> <!></div>'),Yo=x('<div class="h-full overflow-auto p-4"><!></div>'),Zo=x("<div><!></div>"),Go=x('<iframe sandbox="" referrerpolicy="no-referrer"></iframe>'),Jo=x('<div class="absolute inset-0 flex items-center justify-center text-subtle" role="status"> </div>'),Qo=x('<div class="relative size-full"><!> <!> <!></div>');function ei(A,_){if(new.target)return Xt({component:ei,...A});Gt(_,!0);const re=()=>ge(tr,"$workspace",W),Be=()=>ge(D,"$fileContentStore",W),ee=()=>ge(fe,"$fileLoadingStore",W),P=()=>ge(G,"$fileSavingStore",W),O=()=>ge(ne,"$fileErrorStore",W),ae=()=>ge(ft,"$fileErrorInfoStore",W),Ee=()=>ge(vt,"$homeView$",W),ye=()=>ge(pt,"$fileNotFoundCandidatesStore",W),be=()=>ge(bt,"$isFileBinaryStore",W),oe=()=>ge(me,"$isFileDirtyStore",W),et=()=>ge(Me,"$fileLastUpdatedStore",W),U=()=>ge(tt,"$ftChanges$",W),B=()=>ge(er,"$gutterRead$",W),pe=()=>ge(Ke,"$lineWrapping",W),xe=()=>ge(ue,"$diffIndicators",W),Le=()=>ge(Qt,"$rootMediaPreview",W),[W,$e]=pr(),Ce=(r,n=sa)=>{var b=Or,S=qr;{let le=i(()=>xe()?e(rt):[]),ke=i(()=>n()&&v());Rr(fr(r,{get value(){return b()},set value(J){S(J)},get language(){return e(or)},get readOnly(){return e(y)},get fileName(){return a().filePath},get workspaceId(){return l()},get filePath(){return a().filePath},get lineWrapping(){return pe()},get lineChanges(){return e(le)},get jumpTo(){return e(kt)},get externalContentVersion(){return e(Pe)},get isPanelFocused(){return e(ke)}}),J=>c(Ye,J,!0),()=>e(Ye))}},qe=r=>{var n=Vo(),b=ve(n);{var S=J=>{var He=Ue(),Ge=ve(He);Nt(Ge,()=>Bt,(nt,Tt)=>{Tt(nt,{get icon(){return Ba},get label(){return e(Ae)},disabled:!0})}),s(J,He)};Y(b,J=>{!e(It)&&!e(y)&&!e(L)&&J(S)})}var le=g(b,2);{var ke=J=>{{let He=i(()=>e(_t)?d.ui_viewSettings_htmlPreview_label():void 0),Ge=i(()=>!e(We)),nt=i(()=>!e(y)&&!e(We));eo(J,{embedded:!0,showFold:!1,showSplit:!1,get showPreview(){return e(wr)},get previewLabel(){return e(He)},get previewEnabled(){return e(Fe)},onTogglePreview:()=>c(Fe,!e(Fe)),get showWrap(){return e(Ge)},get wrapEnabled(){return pe()},onToggleWrap:()=>R.dispatch(_a()),get showDiff(){return e(nt)},get diffEnabled(){return xe()},onToggleDiff:()=>R.dispatch(ma())})}};Y(le,J=>{a().filePath&&!e(It)&&!e(L)&&J(ke)})}s(r,n)},Ve=r=>{var n=Ue(),b=ve(n);{var S=le=>{var ke=zo(),J=ve(ke);{var He=Oe=>{var at=Ue(),ht=ve(at);{let Et=i(()=>d.layout_fileTab_goToChanges_tooltip());Nt(ht,()=>Bt,(Lt,Mt)=>{Mt(Lt,{get icon(){return Oa},get label(){return e(Et)},onclick:Zr})})}s(Oe,at)};Y(J,Oe=>{e(Hr)&&Oe(He)})}var Ge=g(J,2);{var nt=Oe=>{var at=Ue(),ht=ve(at);{let Et=i(()=>d.layout_fileTab_downloadFile_label()),Lt=i(()=>!e(Ct)||e(mt));Nt(ht,()=>Bt,(Mt,ir)=>{ir(Mt,{get icon(){return Ot},get label(){return e(Et)},onclick:At,get disabled(){return e(Lt)}})})}s(Oe,at)};Y(Ge,Oe=>{e(it)&&Oe(nt)})}var Tt=g(Ge,2);{let Oe=i(()=>d.layout_fileTab_deleteFile_tooltip());Nt(Tt,()=>Bt,(at,ht)=>{ht(at,{get icon(){return Ha},get label(){return e(Oe)},onclick:Gr,destructive:!0})})}s(le,ke)};Y(b,le=>{a().filePath&&!e(It)&&!e(y)&&le(S)})}s(r,n)},Ke=to(),ue=ro();let a=de(_,"tab",7),l=de(_,"workspaceId",7),q=de(_,"isActive",7),v=de(_,"isPanelFocused",7);se(()=>{const r=l();if(!(!q()||!r||e(f)))return R.dispatch(ua(r,"files")),()=>R.dispatch(fa(r,"files"))});const f=i(()=>typeof a().data?.gitRootId=="string"?a().data.gitRootId:void 0),ie=i(()=>typeof a().data?.gitRootPath=="string"?a().data.gitRootPath:void 0),y=i(()=>!!e(f)),Z=i(()=>a().filePath?ja(a().filePath,e(f)):a().filePath),N=na(e(Z));se(()=>{N.set(e(Z))});const D=$a(l(),N),fe=ka(l(),N),G=Ia(l(),N),ne=Sa(l(),N),ft=Ca(l(),N),vt=co(l()),pt=Fa(l(),N),bt=Da(l(),N),me=Sr(l(),N),Me=Ta(l(),N),tt=Ea(l()),_e=ya(),Re=crypto.randomUUID(),Qt=Ar(Re),$t=`file-gutter:${crypto.randomUUID()}`,er=La(l(),$t),tr=Ma(l()),Xe=i(()=>re()?.worktreePath||re()?.repositoryPath||re()?.path||null),ze=i(Be),rr=io();se(()=>{e(ze)!==null&&e(ze)!==void 0&&rr?.markContentLoaded()});const t=i(ee),o=i(P),u=i(O),w=i(()=>e(u)?jo(e(u)):"generic"),$=i(()=>e(u)?lo(ae()):null);let E=j(0),V=!1;se(()=>{const r=Ee();if(!r||r.unavailable){V=!1;return}e($)&&!V&&(V=!0,ur(()=>Ht(E)))});const T=5,K=i(()=>(ye()??[]).slice(0,T)),L=i(be),he=i(oe),Pe=i(et),Ae=i(()=>e(o)?d.ui_saveIndicator_saving_tooltip():e(he)?d.ui_saveIndicator_autoSaving_tooltip():d.ui_saveIndicator_saved_tooltip());let Ye=j(null),rt=j(la([])),Ze=j(null),kt=j(void 0),Vt=j(void 0),Fe=j(!0),gr=j(null);se(()=>{const r=a().data?.line,n=a().data?.jumpTimestamp;!r||n!==void 0&&n===e(Vt)||(c(Vt,n,!0),c(kt,{line:r},!0),c(Fe,!1))});const gt=i(()=>e(f)?Cr(a().filePath,e(ie)):null),It=i(()=>e(f)?!e(gt):!!(a().filePath&&(Za(a().filePath)||e(Xe)&&Ga(a().filePath,e(Xe))))),St=i(()=>a().filePath&&e(Xe)?dr(a().filePath)?a().filePath:`${e(Xe)}/${a().filePath}`:null),xt=i(()=>!!a().filePath&&/\.pdf$/i.test(a().filePath)),Pt=i(()=>!!a().filePath&&/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(a().filePath)),it=i(()=>l()&&/^[A-Za-z0-9._-]+$/.test(l())?Cr(a().filePath,e(Xe)):null),Nr=i(()=>!e(f)&&e(it)?e(it).split("/").slice(0,-1).join("/"):void 0),ar=i(()=>e(xt)||e(Pt)?e(it):null),mr=i(()=>e(f)&&e(Pt)?{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp4:"video/mp4",webm:"video/webm"}[a().filePath?.split(".").pop()?.toLowerCase()??""]:void 0);se(()=>{if(!q()||!e(f)||!e(gt)||!e(mr))return;const r=crypto.randomUUID();return R.dispatch(Ur(Re,r,l(),e(gt),{gitRootId:e(f),mimeType:e(mr)})),()=>R.dispatch(Vr(Re,r))});let mt=j(!1);const Ct=i(()=>!!e(it)&&!e(t)&&(!e(Pt)||e(Ze)===e(it))),_r=i(()=>e(Ze)&&l()?`workspace-file://${l()}/${e(Ze).split("/").map(encodeURIComponent).join("/")}`:null),or=i(()=>a().filePath?ga(a().filePath):"plaintext"),hr=i(()=>e(or)==="markdown"),_t=i(()=>/\.html?$/i.test(a().filePath??""));let Ft=j(void 0);const zt=i(()=>e(Ft)?.source===e(ze)),wr=i(()=>e(hr)||e(_t)&&!(e(zt)&&e(Ft)?.document===null)),We=i(()=>e(wr)&&e(Fe));se(()=>{if(!q()||!e(_t)||!e(We)||e(L)||e(u))return;const r=e(ze);if(!(r===null||e(zt)))return fo(r,n=>{c(Ft,{source:r,document:n}),n===null&&c(Fe,!1)})}),se(()=>{e(_t)&&!e(We)&&a().filePath&&c(gr,a().filePath,!0)}),se(()=>{if(!e(_t)||!e(We)||!q()||!v())return;function r(n){const b=n.detail?.line;b&&(c(kt,{line:b},!0),c(Fe,!1))}return window.addEventListener("workspace:go-to-line",r),()=>window.removeEventListener("workspace:go-to-line",r)}),se(()=>{if(!q()||e(xt)||e(f))return;const r=e(ar),n=a().filePath,b=l(),S=a().id;if(c(Ze,null),!r||!n||!b)return;let le=!1;const ke=()=>!le&&l()===b&&a().id===S&&a().filePath===n;return(async()=>{let J=!1;try{J=(await Ua("file.stat",{workspaceId:b,path:r}))?.isFile===!0}catch{}if(!ke())return;if(J){c(Ze,r,!0);return}if(!/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(r)){c(Ze,r,!0);return}const{candidates:He,truncated:Ge}=await Ya(b,r);if(ke()){if(!Ge&&He.length===1){R.dispatch(yr(b,n,He[0],S));return}c(Ze,r,!0)}})(),()=>{le=!0}});function Br(r,n){return!!(r.file===n||r.relativePath===n||r.relativePath&&n.endsWith("/"+r.relativePath)||r.file&&n.endsWith("/"+r.file)||r.relativePath&&r.relativePath.endsWith("/"+n)||r.file&&r.file.endsWith("/"+n))}const Dt=i(()=>e(y)||!a().filePath?null:U().find(r=>Br(r,a().filePath))??null),Hr=i(()=>!!e(Dt));se(()=>{if(e(y))return;const r=l(),n=a().filePath,b=e(Xe);return()=>{if(!r||!n)return;const S=lr.select(R.state,r,n);if(S?.kind!=="editable-text")return;const le=nr(S.localContent),ke=Sr.select(R.state,r,n),J=dr(n)?n:b?`${b}/${n}`:null;ke&&J&&R.dispatch($r(r,n,J,le))}}),se(()=>{const r=a().filePath,n=e(St),b=l();if(e(E),!q())return;const S=!e(f)&&!!r&&dr(r)&&!e(Xe);r&&b&&!e(It)&&!e(Pt)&&!e(xt)&&!S&&(e(f)&&e(gt)&&e(Z)?R.dispatch(kr(b,e(Z),n??r,{gitRoot:{id:e(f),relativePath:e(gt)}})):R.dispatch(kr(b,r,n??r)))});function Or(){return e(ze)??""}function qr(r){e(y)||e(L)||!a().filePath||!l()||!e(St)||R.dispatch(Pa(l(),a().filePath,nr(r)))}function Kr(){if(e(y)||e(L)||!a().filePath||!e(St)||e(ze)===null||e(o))return;const r=lr.select(R.state,l(),a().filePath);r?.kind==="editable-text"&&R.dispatch($r(l(),a().filePath,e(St),nr(r.localContent)))}function Xr(r){const n=a().filePath;!n||!l()||(R.dispatch(xa(l(),n)),R.dispatch(yr(l(),n,r,a().id)))}se(()=>{const r=a().filePath,n=e(Dt);if(!r||!n){c(rt,[],!0);return}if(!q())return;const b=l(),S=crypto.randomUUID();return R.dispatch(va(b,$t,S,{kind:"diffs",path:r,staged:n.stage==="staged"})),()=>{R.dispatch(pa(b,$t,S))}}),se(()=>{const r=B(),n=r?.result?.kind==="diffs"?r.result.chunks:[],b=n.find(S=>S.file===a().filePath)??n[0];c(rt,b?Ja(b.chunks.map(S=>({oldStart:S.oldStart,oldLines:S.oldLines,newStart:S.newStart,newLines:S.newLines,lines:S.lines.map(le=>(le.type===Ir.Addition?"+":le.type===Ir.Deletion?"-":" ")+le.content)}))):[],!0)});function Yr(r){const n=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent),b=ke=>oo(r,ao(ke),n);if(b("editor.save")){r.preventDefault(),e(he)&&!e(o)&&Kr();return}const S=b("editor.undo")?"undo":b("editor.redo")?"redo":b("editor.toggle-task-list")?"toggle-task-list":b("editor.copy")?"copy":b("editor.select-all")?"select-all":null;if(!S||e(y)&&S!=="copy"&&S!=="select-all")return;S!=="toggle-task-list"&&e(Ye)?.runShortcut(S)&&r.preventDefault()}function Zr(r){if(!a().filePath||!e(Dt))return;const n=r?.metaKey||r?.ctrlKey||!1,S=r?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;R.dispatch(ba(l(),e(Dt),{filePath:a().filePath,changeId:e(Dt).id,openInAdjacentPanel:n,sourcePanelId:S}))}async function At(){const r=e(it);if(!(e(y)||!r||!l()||!e(Ct)||e(mt))){c(mt,!0);try{const n=await Ra(l(),r,e(Xe));!n?.success&&!n?.canceled&&sr.error(n?.error?.message||d.layout_fileTab_downloadFailed_error())}catch{sr.error(d.layout_fileTab_downloadFailed_error())}finally{c(mt,!1)}}}function Gr(){const r=e(St);if(e(y)||!a().filePath||!l()||!r)return;const n=ha(lr.select(R.state,l(),a().filePath));if(!n){sr.error(d.ui_reversibleActions_failed_error({message:d.fileExplorer_tree_undoUnavailable_error()}));return}R.dispatch(wa(l(),a().filePath,{absolutePath:r,tabId:a().id,snapshot:n}))}se(()=>{if(!_e||!q())return;const r={isDirty:!e(y)&&e(he),isSaving:!e(y)&&e(o)};ur(()=>{_e.registerActions({display:qe,actions:Ve}),_e.registerState(r)})});var Jr={get tab(){return a()},set tab(r){a(r),ce()},get workspaceId(){return l()},set workspaceId(r){l(r),ce()},get isActive(){return q()},set isActive(r){q(r),ce()},get isPanelFocused(){return v()},set isPanelFocused(r){v(r),ce()},$set:Yt,$on:(r,n)=>Zt(_,r,n)},br=Ue();ut("keydown",Lr,r=>q()&&Yr(r));var Qr=ve(br);{var ea=r=>{var n=Ue(),b=ve(n);Mr(b,()=>a().filePath,S=>{var le=Ue(),ke=ve(le);{var J=h=>{var p=Ao(),M=F(p),X=C(M,!0),z=g(M,2),je=C(z,!0);k(p),I(te=>{m(X,te),m(je,a().filePath)},[()=>d.layout_fileTab_outsideWorkspace_label()]),s(h,p)},He=h=>{var p=Ue(),M=ve(p);{var X=z=>{vr(z,{get workspaceId(){return l()},get filePath(){return e(gt)},get gitRootId(){return e(f)}})};Y(M,z=>{q()&&z(X)})}s(h,p)},Ge=h=>{var p=Ue(),M=ve(p);{var X=te=>{var Ie=Tr(),H=F(Ie),we=C(H,!0);k(Ie),I(Q=>m(we,Q),[()=>d.layout_fileTab_errorLoading_label()]),s(te,Ie)},z=te=>{qt(te,{get filePath(){return a().filePath},get sourceUrl(){return Le().url},allowDownload:!1})},je=te=>{var Ie=Wo(),H=F(Ie),we=C(H,!0);k(Ie),I(Q=>m(we,Q),[()=>d.layout_fileTab_preparing_label()]),s(te,Ie)};Y(M,te=>{Le()?.error?te(X):Le()?.url?te(z,1):te(je,-1)})}s(h,p)},nt=h=>{var p=Ue(),M=ve(p);{var X=z=>{vr(z,{get workspaceId(){return l()},get filePath(){return e(ar)}})};Y(M,z=>{q()&&z(X)})}s(h,p)},Tt=h=>{var p=Tr(),M=F(p),X=C(M,!0);k(p),I(z=>m(X,z),[()=>d.file_pdf_load_error()]),s(h,p)},Oe=h=>{{let p=i(()=>e(Ze)??a().filePath),M=i(()=>!e(y)&&e(Ct));qt(h,{get filePath(){return e(p)},get sourceUrl(){return e(_r)},onDownload:At,get allowDownload(){return e(M)},get downloading(){return e(mt)}})}},at=h=>{var p=Er(),M=F(p),X=C(M,!0);k(p),I(z=>m(X,z),[()=>d.layout_fileTab_preparing_label()]),s(h,p)},ht=h=>{var p=Bo(),M=F(p);Ut(M,20,()=>[...Array(20).keys()],X=>X,(X,z)=>{var je=No(),te=F(je);Fr(te,{class:"h-3 w-8 shrink-0"});var Ie=g(te,2);Fr(Ie,{class:"h-3",style:`width: ${30+Math.random()*60}%`}),k(je),s(X,je)}),k(M),k(p),s(h,p)},Et=h=>{{let p=i(()=>so(e($)));no(h,{get view(){return e(p)}})}},Lt=h=>{var p=Ko(),M=F(p),X=C(M,!0),z=g(M,2),je=C(z,!0),te=g(z,2);{var Ie=Q=>{var lt=Ho(),Je=C(lt,!0);I(()=>m(Je,e(u))),s(Q,lt)};Y(te,Q=>{e(w)==="generic"&&Q(Ie)})}var H=g(te,2);{var we=Q=>{var lt=qo(),Je=ve(lt),Rt=C(Je,!0),Wt=g(Je,2);Ut(Wt,20,()=>e(K),wt=>wt,(wt,De)=>{var Se=Oo(),Ne=F(Se);Te(Ne,{variant:"link",size:"compact",class:"h-auto p-0 font-mono text-xs",onclick:()=>Xr(De),children:(st,xr)=>{ot();var Pr=ct();I(()=>m(Pr,De)),s(st,Pr)},$$slots:{default:!0}}),k(Se),s(wt,Se)}),k(Wt),I(wt=>m(Rt,wt),[()=>d.layout_fileTab_didYouMean_label()]),s(Q,lt)};Y(H,Q=>{e(K).length>0&&Q(we)})}k(p),I(Q=>{m(X,Q),m(je,a().filePath)},[()=>Uo(e(w))]),s(h,p)},Mt=h=>{var p=Xo(),M=F(p),X=C(M,!0),z=g(M,2),je=C(z,!0),te=g(z,2);{var Ie=H=>{{let we=i(()=>!e(Ct)||e(mt));Te(H,{variant:"secondary",size:"sm",onclick:At,get disabled(){return e(we)},children:(Q,lt)=>{ot();var Je=ct();I(Rt=>m(Je,Rt),[()=>d.layout_fileTab_downloadFile_label()]),s(Q,Je)},$$slots:{default:!0}})}};Y(te,H=>{!e(y)&&e(it)&&H(Ie)})}k(p),I(H=>{m(X,H),m(je,a().filePath)},[()=>d.editor_fileViewer_binary_label()]),s(h,p)},ir=h=>{const p=i(()=>a().filePath?.toLowerCase().endsWith(".svg"));var M=Ue(),X=ve(M);{var z=H=>{{let we=i(()=>a().filePath||""),Q=i(()=>!e(y)&&e(Ct));qt(H,{get filePath(){return e(we)},get fileContent(){return e(ze)},get language(){return e(or)},get isBinary(){return e(L)},onDownload:At,get allowDownload(){return e(Q)},get downloading(){return e(mt)}})}},je=H=>{var we=Yo(),Q=F(we);Qa(Q,{get content(){return e(ze)},get workspaceId(){return l()},get relativeMediaBase(){return e(Nr)},renderRichFencesAsCode:!0,renderDiagrams:!0}),k(we),s(H,we)},te=H=>{var we=Qo(),Q=F(we);{var lt=De=>{var Se=Zo();let Ne;var st=F(Se);Ce(st,()=>!e(We)),k(Se),I(()=>{Ne=Kt(Se,1,"size-full",null,Ne,{invisible:e(We)}),Se.inert=e(We)}),s(De,Se)};Y(Q,De=>{(!e(We)||e(gr)===a().filePath)&&De(lt)})}var Je=g(Q,2);{var Rt=De=>{const Se=i(()=>e(We)&&e(zt));var Ne=Go();let st;I(xr=>{Qe(Ne,"title",xr),Qe(Ne,"srcdoc",e(Ft).document),st=Kt(Ne,1,"absolute inset-0 block size-full border-0 bg-background",null,st,{invisible:!e(Se)}),Ne.inert=!e(Se)},[()=>d.ui_viewSettings_htmlPreview_label()]),s(De,Ne)};Y(Je,De=>{e(Ft)?.document!=null&&De(Rt)})}var Wt=g(Je,2);{var wt=De=>{var Se=Jo(),Ne=C(Se,!0);I(st=>m(Ne,st),[()=>d.layout_fileTab_preparing_label()]),s(De,Se)};Y(Wt,De=>{e(We)&&!e(zt)&&De(wt)})}k(we),s(H,we)},Ie=H=>{Ce(H,()=>!0)};Y(X,H=>{e(p)?H(z):e(hr)&&e(We)?H(je,1):e(_t)?H(te,2):H(Ie,-1)})}s(h,M)},ra=h=>{var p=Er(),M=F(p),X=C(M,!0);k(p),I(z=>m(X,z),[()=>d.layout_fileTab_preparing_label()]),s(h,p)};Y(ke,h=>{e(It)?h(J):e(f)&&e(xt)&&e(gt)?h(He,1):e(f)&&e(Pt)?h(Ge,2):e(xt)&&e(ar)?h(nt,3):e(xt)?h(Tt,4):e(_r)?h(Oe,5):e(Pt)?h(at,6):e(t)&&(!e(_t)||e(ze)===null)?h(ht,7):e($)?h(Et,8):e(u)?h(Lt,9):e(L)?h(Mt,10):e(ze)!==null?h(ir,11):h(ra,-1)})}s(S,le)}),s(r,n)};Y(Qr,r=>{a().filePath&&r(ea)})}s(A,br);var ta=Jt(Jr);return $e(),ta}export{ei as default};
@@ -1 +1 @@
1
- import{aB as v,b as y}from"./DtluaQEg.js";var w=5,O=1e-5,X=2,Y=.6,R=1e-6;function N(t){const e=[];for(let s=0;s<t.length-1;s++)e.push({a:t[s],b:t[s+1]});return e}y(N,"buildSegmentList");function T(t,e,s,a){const r=e.x-t.x,o=e.y-t.y,i=a.x-s.x,d=a.y-s.y,u=r*d-o*i;if(u===0)return null;const n=s.x-t.x,c=s.y-t.y,p=(n*d-c*i)/u,f=(n*o-c*r)/u;return p<=R||p>=1-R||f<=R||f>=1-R?null:{point:{x:t.x+p*r,y:t.y+p*o},tA:p,tB:f}}y(T,"segmentIntersection");function P(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}y(P,"isHorizontalSeg");function B(t,e,s){if(t.curve!=="rounded")return!1;const a=t.points,r=a[e],o=a[e+1];if(!r||!o)return!1;const i=Math.hypot(o.x-r.x,o.y-r.y),d=s*i,u=e>0?L(a[e-1],r,o,w):null;if(u&&d<u.cutLen)return!0;const n=e+2<a.length?L(r,o,a[e+2],w):null;return n!==null&&i-d<n.cutLen}y(B,"crossingSitsInRoundedCorner");function C(t){const e=[];for(let s=0;s<t.length;s++){const a=t[s],r=N(a.points);for(let o=s+1;o<t.length;o++){const i=t[o],d=N(i.points);for(const[u,n]of r.entries())for(const[c,p]of d.entries()){const f=T(n.a,n.b,p.a,p.b);if(!f||B(a,u,f.tA)||B(i,c,f.tB))continue;const g=P(n),S=P(p);(g!==S?g:!1)?e.push({jumpEdgeId:a.id,otherEdgeId:i.id,segIndex:u,t:f.tA,point:f.point}):e.push({jumpEdgeId:i.id,otherEdgeId:a.id,segIndex:c,t:f.tB,point:f.point})}}}return e}y(C,"findEdgeIntersections");function M(t){const e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}y(M,"fmt");function A(t){return`${M(t.x)},${M(t.y)}`}y(A,"pointToString");function D(t){const e=t.b.x-t.a.x,s=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(s)?e>=0?1:0:s>=0?1:0}y(D,"getArcSweepFlag");function _(t,e){if(t.length<2)return t.map(o=>({...o}));const s=t.map(o=>({...o})),a=e.arrowTypeStart&&v[e.arrowTypeStart];if(a){const o=t[0],i=t[1],d=Math.atan2(i.y-o.y,i.x-o.x);s[0].x=o.x+a*Math.cos(d),s[0].y=o.y+a*Math.sin(d)}const r=e.arrowTypeEnd&&v[e.arrowTypeEnd];if(r){const o=t.length,i=t[o-2],d=t[o-1],u=Math.atan2(d.y-i.y,d.x-i.x);s[o-1].x=d.x-r*Math.cos(u),s[o-1].y=d.y-r*Math.sin(u)}return s}y(_,"applyMarkerOffsets");function k(t,e,s,a,r){const o=t.point.x,i=t.point.y,d={x:o-e*t.r,y:i-s*t.r},u={x:o+e*t.r,y:i+s*t.r},n=[`L${A(d)}`];return r==="arc"?n.push(`A${M(t.r)},${M(t.r)} 0 0 ${a} ${A(u)}`):n.push(`M${A(u)}`),n}y(k,"emitJump");function L(t,e,s,a){const r=e.x-t.x,o=e.y-t.y,i=s.x-e.x,d=s.y-e.y,u=Math.hypot(r,o),n=Math.hypot(i,d);if(u<O||n<O)return null;const c=r/u,p=o/u,f=i/n,g=d/n,S=c*f+p*g,b=Math.max(-1,Math.min(1,S)),m=Math.acos(b);if(m<O||Math.abs(Math.PI-m)<O)return null;const h=Math.min(a/Math.sin(m/2),u/2,n/2);return{startX:e.x-c*h,startY:e.y-p*h,endX:e.x+f*h,endY:e.y+g*h,ctrlX:e.x,ctrlY:e.y,cutLen:h}}y(L,"computeRoundedCorner");function H(t,e,s){const a=t.points;if(a.length<2)return"";const r=_(a,t),o=t.curve==="rounded",i=N(r),d=new Map;for(const n of e){const c=i[n.segIndex];if(!c)continue;const p=Math.hypot(c.b.x-c.a.x,c.b.y-c.a.y),f=d.get(n.segIndex)??[];f.push({t:n.t,point:n.point,d:n.t*p,r:s.jumpRadius}),d.set(n.segIndex,f)}const u=[`M${A(r[0])}`];for(let n=0;n<i.length;n++){const c=i[n],p=Math.hypot(c.b.x-c.a.x,c.b.y-c.a.y),f=p===0?0:(c.b.x-c.a.x)/p,g=p===0?0:(c.b.y-c.a.y)/p,S=D(c);let b=0;if(o&&n>0){const l=L(r[n-1],r[n],r[n+1]??r[n],w);l&&(b=l.cutLen)}let m=p,h=null;o&&n<i.length-1&&(h=L(r[n],r[n+1],r[n+2]??r[n+1],w),h&&(m=p-h.cutLen));const $=s.jumpRadius*Y,x=[...d.get(n)??[]].sort((l,E)=>l.t-E.t).filter(l=>{const E=Math.min(l.d-b,m-l.d)-X;return l.r=Math.min(l.r,E),l.r>=$});for(let l=0;l<x.length-1;l++){const E=x[l+1].d-x[l].d;if(x[l].r+x[l+1].r>E){const I=E/2;x[l].r=Math.min(x[l].r,I),x[l+1].r=Math.min(x[l+1].r,I)}}for(const l of x)l.r<$||u.push(...k(l,f,g,S,s.jumpStyle));o&&h?(u.push(`L${M(h.startX)},${M(h.startY)}`),u.push(`Q${M(h.ctrlX)},${M(h.ctrlY)} ${M(h.endX)},${M(h.endY)}`)):u.push(`L${A(c.b)}`)}return u.join(" ")}y(H,"rewriteEdgePath");function J(t){return/^[\d\s+,.LMelm-]*$/.test(t)}y(J,"isStraightPath");function U(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}y(U,"curveSupportsLineHops");function j(t){if(!t)return null;try{const e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),s=JSON.parse(e);if(!Array.isArray(s))return null;const a=[];for(const r of s)r&&typeof r.x=="number"&&typeof r.y=="number"&&a.push({x:r.x,y:r.y});return a.length>=2?a:null}catch{return null}}y(j,"decodeDataPoints");function F(t,e,s){if(!s.enabled)return;const a=t.node();if(!a)return;const r=new Map;for(const n of e)r.set(n.id,n);const o=new Map;for(const n of a.querySelectorAll("path[data-id]")){const c=n.getAttribute("data-id");c!==null&&!o.has(c)&&o.set(c,n)}const i=[];for(const n of e){const c=o.get(n.id);if(!c)continue;const f=j(c.getAttribute("data-points"))??n.points;i.push({...n,points:f})}const d=C(i);if(d.length===0)return;const u=new Map;for(const n of d){const c=u.get(n.jumpEdgeId)??[];c.push(n),u.set(n.jumpEdgeId,c)}for(const n of i){const c=u.get(n.id);if(!c||c.length===0)continue;const f=r.get(n.id)?.curve;if(f!==void 0&&!U(f))continue;const g=o.get(n.id);if(!g)continue;if(f===void 0){const x=g.getAttribute("d")??"";if(!J(x))continue}const S=g.getAttribute("style")??"",b=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(S),m=b?Number.parseFloat(b[1]):null,h=b?Number.parseFloat(b[2]):null,$=H(n,c,s);if(g.setAttribute("d",$),m!==null&&h!==null&&typeof g.getTotalLength=="function"){const x=g.getTotalLength(),l=Math.max(0,x-m-h),E=`0 ${m} ${l} ${h}`,I=S.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${E};`).replace(/;\s*;+/g,";");g.setAttribute("style",I)}}}y(F,"applyLineJumpsToSvg");export{F as a};
1
+ import{aB as v,b as y}from"./Cu11OjbU.js";var w=5,O=1e-5,X=2,Y=.6,R=1e-6;function N(t){const e=[];for(let s=0;s<t.length-1;s++)e.push({a:t[s],b:t[s+1]});return e}y(N,"buildSegmentList");function T(t,e,s,a){const r=e.x-t.x,o=e.y-t.y,i=a.x-s.x,d=a.y-s.y,u=r*d-o*i;if(u===0)return null;const n=s.x-t.x,c=s.y-t.y,p=(n*d-c*i)/u,f=(n*o-c*r)/u;return p<=R||p>=1-R||f<=R||f>=1-R?null:{point:{x:t.x+p*r,y:t.y+p*o},tA:p,tB:f}}y(T,"segmentIntersection");function P(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}y(P,"isHorizontalSeg");function B(t,e,s){if(t.curve!=="rounded")return!1;const a=t.points,r=a[e],o=a[e+1];if(!r||!o)return!1;const i=Math.hypot(o.x-r.x,o.y-r.y),d=s*i,u=e>0?L(a[e-1],r,o,w):null;if(u&&d<u.cutLen)return!0;const n=e+2<a.length?L(r,o,a[e+2],w):null;return n!==null&&i-d<n.cutLen}y(B,"crossingSitsInRoundedCorner");function C(t){const e=[];for(let s=0;s<t.length;s++){const a=t[s],r=N(a.points);for(let o=s+1;o<t.length;o++){const i=t[o],d=N(i.points);for(const[u,n]of r.entries())for(const[c,p]of d.entries()){const f=T(n.a,n.b,p.a,p.b);if(!f||B(a,u,f.tA)||B(i,c,f.tB))continue;const g=P(n),S=P(p);(g!==S?g:!1)?e.push({jumpEdgeId:a.id,otherEdgeId:i.id,segIndex:u,t:f.tA,point:f.point}):e.push({jumpEdgeId:i.id,otherEdgeId:a.id,segIndex:c,t:f.tB,point:f.point})}}}return e}y(C,"findEdgeIntersections");function M(t){const e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}y(M,"fmt");function A(t){return`${M(t.x)},${M(t.y)}`}y(A,"pointToString");function D(t){const e=t.b.x-t.a.x,s=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(s)?e>=0?1:0:s>=0?1:0}y(D,"getArcSweepFlag");function _(t,e){if(t.length<2)return t.map(o=>({...o}));const s=t.map(o=>({...o})),a=e.arrowTypeStart&&v[e.arrowTypeStart];if(a){const o=t[0],i=t[1],d=Math.atan2(i.y-o.y,i.x-o.x);s[0].x=o.x+a*Math.cos(d),s[0].y=o.y+a*Math.sin(d)}const r=e.arrowTypeEnd&&v[e.arrowTypeEnd];if(r){const o=t.length,i=t[o-2],d=t[o-1],u=Math.atan2(d.y-i.y,d.x-i.x);s[o-1].x=d.x-r*Math.cos(u),s[o-1].y=d.y-r*Math.sin(u)}return s}y(_,"applyMarkerOffsets");function k(t,e,s,a,r){const o=t.point.x,i=t.point.y,d={x:o-e*t.r,y:i-s*t.r},u={x:o+e*t.r,y:i+s*t.r},n=[`L${A(d)}`];return r==="arc"?n.push(`A${M(t.r)},${M(t.r)} 0 0 ${a} ${A(u)}`):n.push(`M${A(u)}`),n}y(k,"emitJump");function L(t,e,s,a){const r=e.x-t.x,o=e.y-t.y,i=s.x-e.x,d=s.y-e.y,u=Math.hypot(r,o),n=Math.hypot(i,d);if(u<O||n<O)return null;const c=r/u,p=o/u,f=i/n,g=d/n,S=c*f+p*g,b=Math.max(-1,Math.min(1,S)),m=Math.acos(b);if(m<O||Math.abs(Math.PI-m)<O)return null;const h=Math.min(a/Math.sin(m/2),u/2,n/2);return{startX:e.x-c*h,startY:e.y-p*h,endX:e.x+f*h,endY:e.y+g*h,ctrlX:e.x,ctrlY:e.y,cutLen:h}}y(L,"computeRoundedCorner");function H(t,e,s){const a=t.points;if(a.length<2)return"";const r=_(a,t),o=t.curve==="rounded",i=N(r),d=new Map;for(const n of e){const c=i[n.segIndex];if(!c)continue;const p=Math.hypot(c.b.x-c.a.x,c.b.y-c.a.y),f=d.get(n.segIndex)??[];f.push({t:n.t,point:n.point,d:n.t*p,r:s.jumpRadius}),d.set(n.segIndex,f)}const u=[`M${A(r[0])}`];for(let n=0;n<i.length;n++){const c=i[n],p=Math.hypot(c.b.x-c.a.x,c.b.y-c.a.y),f=p===0?0:(c.b.x-c.a.x)/p,g=p===0?0:(c.b.y-c.a.y)/p,S=D(c);let b=0;if(o&&n>0){const l=L(r[n-1],r[n],r[n+1]??r[n],w);l&&(b=l.cutLen)}let m=p,h=null;o&&n<i.length-1&&(h=L(r[n],r[n+1],r[n+2]??r[n+1],w),h&&(m=p-h.cutLen));const $=s.jumpRadius*Y,x=[...d.get(n)??[]].sort((l,E)=>l.t-E.t).filter(l=>{const E=Math.min(l.d-b,m-l.d)-X;return l.r=Math.min(l.r,E),l.r>=$});for(let l=0;l<x.length-1;l++){const E=x[l+1].d-x[l].d;if(x[l].r+x[l+1].r>E){const I=E/2;x[l].r=Math.min(x[l].r,I),x[l+1].r=Math.min(x[l+1].r,I)}}for(const l of x)l.r<$||u.push(...k(l,f,g,S,s.jumpStyle));o&&h?(u.push(`L${M(h.startX)},${M(h.startY)}`),u.push(`Q${M(h.ctrlX)},${M(h.ctrlY)} ${M(h.endX)},${M(h.endY)}`)):u.push(`L${A(c.b)}`)}return u.join(" ")}y(H,"rewriteEdgePath");function J(t){return/^[\d\s+,.LMelm-]*$/.test(t)}y(J,"isStraightPath");function U(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}y(U,"curveSupportsLineHops");function j(t){if(!t)return null;try{const e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),s=JSON.parse(e);if(!Array.isArray(s))return null;const a=[];for(const r of s)r&&typeof r.x=="number"&&typeof r.y=="number"&&a.push({x:r.x,y:r.y});return a.length>=2?a:null}catch{return null}}y(j,"decodeDataPoints");function F(t,e,s){if(!s.enabled)return;const a=t.node();if(!a)return;const r=new Map;for(const n of e)r.set(n.id,n);const o=new Map;for(const n of a.querySelectorAll("path[data-id]")){const c=n.getAttribute("data-id");c!==null&&!o.has(c)&&o.set(c,n)}const i=[];for(const n of e){const c=o.get(n.id);if(!c)continue;const f=j(c.getAttribute("data-points"))??n.points;i.push({...n,points:f})}const d=C(i);if(d.length===0)return;const u=new Map;for(const n of d){const c=u.get(n.jumpEdgeId)??[];c.push(n),u.set(n.jumpEdgeId,c)}for(const n of i){const c=u.get(n.id);if(!c||c.length===0)continue;const f=r.get(n.id)?.curve;if(f!==void 0&&!U(f))continue;const g=o.get(n.id);if(!g)continue;if(f===void 0){const x=g.getAttribute("d")??"";if(!J(x))continue}const S=g.getAttribute("style")??"",b=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(S),m=b?Number.parseFloat(b[1]):null,h=b?Number.parseFloat(b[2]):null,$=H(n,c,s);if(g.setAttribute("d",$),m!==null&&h!==null&&typeof g.getTotalLength=="function"){const x=g.getTotalLength(),l=Math.max(0,x-m-h),E=`0 ${m} ${l} ${h}`,I=S.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${E};`).replace(/;\s*;+/g,";");g.setAttribute("style",I)}}}y(F,"applyLineJumpsToSvg");export{F as a};