orcaq 1.1.6 → 1.1.7

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 (154) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{Lh0RfwhV.js → 1VXrIDkr.js} +1 -1
  3. package/.output/public/_nuxt/{ZVYA9HBl.js → 1fIGBJPQ.js} +1 -1
  4. package/.output/public/_nuxt/{BbawOYVr.js → 1kY3DHv7.js} +1 -1
  5. package/.output/public/_nuxt/{DDsaDrGo.js → 2TwRWQjG.js} +1 -1
  6. package/.output/public/_nuxt/{wrneOCBW.js → 39ZZCZCn.js} +1 -1
  7. package/.output/public/_nuxt/{BmEIj9l9.js → 3vYvhEat.js} +1 -1
  8. package/.output/public/_nuxt/{CEoM97rJ.js → 9bnMBg54.js} +1 -1
  9. package/.output/public/_nuxt/{ZNDxw-7x.js → B-u0WX5Q.js} +1 -1
  10. package/.output/public/_nuxt/{uDsvlLN0.js → B41tp0B8.js} +1 -1
  11. package/.output/public/_nuxt/{4LC09zKL.js → BCm7jnPt.js} +1 -1
  12. package/.output/public/_nuxt/{D29mzs5t.js → BFMjnjgH.js} +1 -1
  13. package/.output/public/_nuxt/{BEvswgw7.js → BGAd-CMD.js} +1 -1
  14. package/.output/public/_nuxt/{CP-7VdtS.js → BG_B-fo0.js} +1 -1
  15. package/.output/public/_nuxt/{Dd89Vyx8.js → BLEKzUmC.js} +1 -1
  16. package/.output/public/_nuxt/{DoNLWeqB.js → BN2mQ8OV.js} +1 -1
  17. package/.output/public/_nuxt/{DP6Az3fC.js → BNnChlxR.js} +1 -1
  18. package/.output/public/_nuxt/{BKAEFZqP.js → BNyWhB4W.js} +1 -1
  19. package/.output/public/_nuxt/{Bibtvqd8.js → BO-QgaRL.js} +1 -1
  20. package/.output/public/_nuxt/{DViCRsmA.js → BOVFFCPB.js} +1 -1
  21. package/.output/public/_nuxt/{BWg3wiuc.js → BRVpLa1E.js} +1 -1
  22. package/.output/public/_nuxt/{BJ8qQpib.js → BV4g1sVY.js} +1 -1
  23. package/.output/public/_nuxt/{_TExiQQQ.js → BXziI6Bt.js} +1 -1
  24. package/.output/public/_nuxt/{Df4wU3r0.js → BZQUF1W4.js} +1 -1
  25. package/.output/public/_nuxt/BZmEvFAZ.js +28 -0
  26. package/.output/public/_nuxt/B_G752SV.js +20 -0
  27. package/.output/public/_nuxt/{BusLuQ4Q.js → Ba_fqsW2.js} +1 -1
  28. package/.output/public/_nuxt/{DZFq5yqu.js → BbzZxPNQ.js} +1 -1
  29. package/.output/public/_nuxt/{BxZgIpkD.js → BhT0iBlH.js} +1 -1
  30. package/.output/public/_nuxt/{CoX1_N4R.js → Bhm1GL_M.js} +1 -1
  31. package/.output/public/_nuxt/{27ZsWTm2.js → BiSZmDoN.js} +1 -1
  32. package/.output/public/_nuxt/{DZVfXu09.js → BjK8Fug8.js} +1 -1
  33. package/.output/public/_nuxt/{G40WRC_L.js → BjpSpz5C.js} +1 -1
  34. package/.output/public/_nuxt/{Bok35x_B.js → BkqB6n0T.js} +1 -1
  35. package/.output/public/_nuxt/{6NXhlm49.js → BoPjUGS6.js} +1 -1
  36. package/.output/public/_nuxt/{B10QBDL6.js → BtwwqY0e.js} +1 -1
  37. package/.output/public/_nuxt/{FHx3Ejt6.js → BvD9dW-2.js} +1 -1
  38. package/.output/public/_nuxt/{Cvkyd5iW.js → Bw-4PosZ.js} +1 -1
  39. package/.output/public/_nuxt/C0l_59dE.js +1 -0
  40. package/.output/public/_nuxt/{__PEYcIB.js → C1TOiVRQ.js} +1 -1
  41. package/.output/public/_nuxt/{BoUZO_NV.js → C7A87LE3.js} +1 -1
  42. package/.output/public/_nuxt/{o60RgyTd.js → C80Zs8U0.js} +1 -1
  43. package/.output/public/_nuxt/{BnZ5qYkP.js → CB56S0b2.js} +9 -9
  44. package/.output/public/_nuxt/{CNPNWuzz.js → CBgbjsPd.js} +1 -1
  45. package/.output/public/_nuxt/{BCazdlgN.js → CCk2r9DD.js} +1 -1
  46. package/.output/public/_nuxt/{CCOlJAKS.js → CFZerEKx.js} +2 -2
  47. package/.output/public/_nuxt/{Bgj8Q52i.js → CG4v011f.js} +1 -1
  48. package/.output/public/_nuxt/{C4-wpUAK.js → CJnTtXrv.js} +1 -1
  49. package/.output/public/_nuxt/{DHyymmeR.js → CRDIOG8r.js} +1 -1
  50. package/.output/public/_nuxt/{XETGYn3c.js → CSPqdI4x.js} +1 -1
  51. package/.output/public/_nuxt/{DyDU0wFf.js → CTYqoFvv.js} +1 -1
  52. package/.output/public/_nuxt/{BbLqUOHs.js → CWGzL6OE.js} +1 -1
  53. package/.output/public/_nuxt/{CZLVBTJx.js → CYJEOEaU.js} +1 -1
  54. package/.output/public/_nuxt/{BTvOPFKG.js → CYu-xp_f.js} +1 -1
  55. package/.output/public/_nuxt/CZvnl0uO.js +52 -0
  56. package/.output/public/_nuxt/{DsPClaxV.js → CadjlDLt.js} +1 -1
  57. package/.output/public/_nuxt/{BJoSd_uV.js → CczQKYUP.js} +1 -1
  58. package/.output/public/_nuxt/{CHAVZu6b.js → CeXr_3vU.js} +2 -2
  59. package/.output/public/_nuxt/{BAasx5OS.js → Ch-A9iSC.js} +1 -1
  60. package/.output/public/_nuxt/{Bap1X7GD.js → Cj9tYr3P.js} +1 -1
  61. package/.output/public/_nuxt/Clm3Z8VL.js +1 -0
  62. package/.output/public/_nuxt/{F8eHh68O.js → CpkrwN3Q.js} +8 -8
  63. package/.output/public/_nuxt/{CO0Pa76w.js → CrwM3gOU.js} +1 -1
  64. package/.output/public/_nuxt/{DeVs4gEL.js → Culm7V2R.js} +1 -1
  65. package/.output/public/_nuxt/{Cl3VX8Um.js → CxZK-Vs6.js} +1 -1
  66. package/.output/public/_nuxt/{DLA-ioQ4.js → Cym7bWgs.js} +1 -1
  67. package/.output/public/_nuxt/CzBFxx8v.js +1 -0
  68. package/.output/public/_nuxt/{BCa-NKh0.js → D0oaRUYx.js} +1 -1
  69. package/.output/public/_nuxt/{DgGwe7jd.js → D7uoAo-G.js} +133 -133
  70. package/.output/public/_nuxt/{CvDZBOay.js → D8KJQqug.js} +1 -1
  71. package/.output/public/_nuxt/{DlymFQ5D.js → D8Z5BXgG.js} +3 -3
  72. package/.output/public/_nuxt/{DdbhVPqD.js → DDK9-_jm.js} +1 -1
  73. package/.output/public/_nuxt/{CnQob-tn.js → DDQU7vSH.js} +1 -1
  74. package/.output/public/_nuxt/{BuSZbOQO.js → DEjwIQuc.js} +1 -1
  75. package/.output/public/_nuxt/{yLATXAxG.js → DLIUYAz9.js} +1 -1
  76. package/.output/public/_nuxt/{DYPm3mWQ.js → DQdL5Jcl.js} +1 -1
  77. package/.output/public/_nuxt/{EZ0owjER.js → DRuCf0Sx.js} +1 -1
  78. package/.output/public/_nuxt/DSEkO8kW.js +1 -0
  79. package/.output/public/_nuxt/{DYqShb5v.js → DSOwr8Hs.js} +4 -4
  80. package/.output/public/_nuxt/{Cf6n9dsT.js → DStg2VwN.js} +1 -1
  81. package/.output/public/_nuxt/{Ci7hrFNN.js → DTlu-CJn.js} +1 -1
  82. package/.output/public/_nuxt/{CCK1so3F.js → DUvUg_V7.js} +1 -1
  83. package/.output/public/_nuxt/{CBjcd4cE.js → D_fdC3mJ.js} +1 -1
  84. package/.output/public/_nuxt/{BhzzQZRC.js → Da1F0IxL.js} +1 -1
  85. package/.output/public/_nuxt/{C6bwwZAc.js → DcXAnOS1.js} +1 -1
  86. package/.output/public/_nuxt/DdtQIDaq.js +1 -0
  87. package/.output/public/_nuxt/Dfz8k_Rn.js +1 -0
  88. package/.output/public/_nuxt/{Dpm6rnHk.js → DitYzGT4.js} +1 -1
  89. package/.output/public/_nuxt/{NMm6Vanu.js → Djh3G2Nf.js} +1 -1
  90. package/.output/public/_nuxt/DmWFeTaU.js +1 -0
  91. package/.output/public/_nuxt/{x85BV7y_.js → DtgJAz2h.js} +1 -1
  92. package/.output/public/_nuxt/{3jfBYqJb.js → DuKway_J.js} +1 -1
  93. package/.output/public/_nuxt/{7nPLTDFM.js → DxF9DsEl.js} +1 -1
  94. package/.output/public/_nuxt/{C9ZBCJdc.js → DyFXtlg0.js} +1 -1
  95. package/.output/public/_nuxt/DzN4YRfa.js +7 -0
  96. package/.output/public/_nuxt/{B_hWP06g.js → DzaPC1WB.js} +1 -1
  97. package/.output/public/_nuxt/{wH-P-_6A.js → DzjHXopz.js} +1 -1
  98. package/.output/public/_nuxt/{CE0zlNDo.js → LUfaevBS.js} +1 -1
  99. package/.output/public/_nuxt/{DRX1aIGD.js → RFRrMFyH.js} +1 -1
  100. package/.output/public/_nuxt/{CROH8wgk.js → RTN5rY4m.js} +1 -1
  101. package/.output/public/_nuxt/{Un5zjlKE.js → XVZ0obUR.js} +1 -1
  102. package/.output/public/_nuxt/{B5HZeat4.js → Z5g5B4NJ.js} +1 -1
  103. package/.output/public/_nuxt/_ltJfz1p.js +1 -0
  104. package/.output/public/_nuxt/builds/latest.json +1 -1
  105. package/.output/public/_nuxt/builds/meta/1cbed594-12e2-48e6-bea9-7a9159c3c1d3.json +1 -0
  106. package/.output/public/_nuxt/{DtOg0Asw.js → dkyHOJLf.js} +1 -1
  107. package/.output/public/_nuxt/entry.D1DMaixs.css +1 -0
  108. package/.output/public/_nuxt/{habs8oz6.js → gWmEw6BT.js} +1 -1
  109. package/.output/public/_nuxt/ixgiI20S.js +1 -0
  110. package/.output/public/_nuxt/{C6CFIGob.js → jJeqAxmP.js} +1 -1
  111. package/.output/public/_nuxt/{P_2SRa71.js → lisFd8W1.js} +2 -2
  112. package/.output/public/_nuxt/{CoQ_oOia.js → nrlEwpIH.js} +1 -1
  113. package/.output/public/_nuxt/{6wO6CbCo.js → uHyBIwWw.js} +1 -1
  114. package/.output/public/_nuxt/{dDqgUqt5.js → vGkKA7iH.js} +1 -1
  115. package/.output/public/_nuxt/{C445d10Z.js → z1xPtaLw.js} +1 -1
  116. package/.output/server/chunks/_/registry.mjs +116 -0
  117. package/.output/server/chunks/_/registry.mjs.map +1 -0
  118. package/.output/server/chunks/_/{native-backup.mjs → runtime.mjs} +325 -164
  119. package/.output/server/chunks/_/runtime.mjs.map +1 -0
  120. package/.output/server/chunks/_/{native-backup-jobs.mjs → service.mjs} +185 -248
  121. package/.output/server/chunks/_/service.mjs.map +1 -0
  122. package/.output/server/chunks/build/client.manifest.mjs +734 -723
  123. package/.output/server/chunks/build/client.manifest.mjs.map +1 -1
  124. package/.output/server/chunks/nitro/nitro.mjs +659 -652
  125. package/.output/server/chunks/routes/api/database-backup/capability.get.mjs +7 -2
  126. package/.output/server/chunks/routes/api/database-backup/capability.get.mjs.map +1 -1
  127. package/.output/server/chunks/routes/api/database-export/export-database.mjs +4 -3
  128. package/.output/server/chunks/routes/api/database-export/export-database.mjs.map +1 -1
  129. package/.output/server/chunks/routes/api/database-export/jobs/_jobId/download.get.mjs +1 -20
  130. package/.output/server/chunks/routes/api/database-export/jobs/_jobId/download.get.mjs.map +1 -1
  131. package/.output/server/chunks/routes/api/database-export/jobs/_jobId_.get.mjs +1 -20
  132. package/.output/server/chunks/routes/api/database-export/jobs/_jobId_.get.mjs.map +1 -1
  133. package/.output/server/chunks/routes/api/database-import/import-database.mjs +14 -3
  134. package/.output/server/chunks/routes/api/database-import/import-database.mjs.map +1 -1
  135. package/.output/server/chunks/routes/api/database-import/jobs/_jobId_.get.mjs +1 -20
  136. package/.output/server/chunks/routes/api/database-import/jobs/_jobId_.get.mjs.map +1 -1
  137. package/.output/server/package.json +1 -1
  138. package/package.json +1 -1
  139. package/.output/public/_nuxt/4OV_5qQE.js +0 -1
  140. package/.output/public/_nuxt/B3iNzG14.js +0 -1
  141. package/.output/public/_nuxt/Bf2bW_MY.js +0 -7
  142. package/.output/public/_nuxt/C7C1kq_N.js +0 -1
  143. package/.output/public/_nuxt/CN8b9qPP.js +0 -1
  144. package/.output/public/_nuxt/CUws2Uv7.js +0 -1
  145. package/.output/public/_nuxt/Cl5p4EQY.js +0 -1
  146. package/.output/public/_nuxt/D9MMtvTu.js +0 -52
  147. package/.output/public/_nuxt/DM8LJTsg.js +0 -1
  148. package/.output/public/_nuxt/ORit_vRp.js +0 -1
  149. package/.output/public/_nuxt/ZhP2FY6Y.js +0 -1
  150. package/.output/public/_nuxt/builds/meta/47c294b1-d6b3-4974-bd50-5046ae0a393e.json +0 -1
  151. package/.output/public/_nuxt/dSX5D8ur.js +0 -28
  152. package/.output/public/_nuxt/entry.CGwcggc4.css +0 -1
  153. package/.output/server/chunks/_/native-backup-jobs.mjs.map +0 -1
  154. package/.output/server/chunks/_/native-backup.mjs.map +0 -1
@@ -1 +1 @@
1
- import{r as o,E as f,c as b}from"./DgGwe7jd.js";const y=t=>{const a=o(!1),e=o(null),r=o([]),i=async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const n=await $fetch("/api/database-roles/get-roles",{method:"POST",body:{...f(t.value)}});r.value=n}catch(n){e.value=n instanceof Error?n.message:"Failed to fetch roles",console.error("Error fetching database roles:",n)}finally{a.value=!1}},s=()=>i(),d=b(()=>{const n=[],l=[],c=[];for(const u of r.value)u.isSuperuser?n.push(u):u.canLogin?l.push(u):c.push(u);return{superusers:n,users:l,roles:c}});return{isLoading:a,error:e,roles:r,categorizedRoles:d,fetchRoles:i,refresh:s}},P=t=>{const a=o(!1),e=o(!1),r=o(null),i=n=>{const l="control plane:",c=n.indexOf(l);if(c===-1)return null;const u=n.slice(c+l.length).trim(),m=u.indexOf("{"),v=u.lastIndexOf("}");if(m===-1||v===-1)return null;const p=u.slice(m,v+1);try{const h=JSON.parse(p);if(h!=null&&h.error&&typeof h.error=="string")return h.error}catch{return null}return null};return{isCreating:a,isDeleting:e,error:r,createRole:async n=>{var l;if(!t.value)return r.value="No database connection provided",null;a.value=!0,r.value=null;try{return await $fetch("/api/database-roles/create-role",{method:"POST",body:{...n,...f(t.value)}})}catch(c){const u=((l=c==null?void 0:c.data)==null?void 0:l.message)||(c instanceof Error?c.message:"Failed to create role"),v=i(u)||u.replace(/^Failed to create role:\s*/i,"").trim();return r.value=v,console.error("Error creating role:",c),{success:!1,message:v,sql:""}}finally{a.value=!1}},deleteRole:async n=>{if(!t.value)return r.value="No database connection provided",null;e.value=!0,r.value=null;try{return await $fetch("/api/database-roles/delete-role",{method:"POST",body:{...f(t.value),roleName:n}})}catch(l){return r.value=l instanceof Error?l.message:"Failed to delete role",console.error("Error deleting role:",l),null}finally{e.value=!1}}}},E=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,databasePermissions:r,fetchDatabasePermissions:async s=>{if(!t.value||!s){e.value="Missing connection or role name";return}a.value=!0,e.value=null;try{const d=await $fetch("/api/database-roles/get-databases-with-permissions",{method:"POST",body:{...f(t.value),roleName:s}});r.value=d}catch(d){e.value=d instanceof Error?d.message:"Failed to fetch database permissions",console.error("Error fetching database permissions:",d)}finally{a.value=!1}}}},O=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,databases:r,fetchDatabases:async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const s=await $fetch("/api/database-roles/get-databases",{method:"POST",body:{...f(t.value)}});r.value=s}catch(s){e.value=s instanceof Error?s.message:"Failed to fetch databases",console.error("Error fetching databases:",s)}finally{a.value=!1}}}},S=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,schemas:r,fetchSchemas:async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const s=await $fetch("/api/database-roles/get-schemas",{method:"POST",body:{...f(t.value)}});r.value=s}catch(s){e.value=s instanceof Error?s.message:"Failed to fetch schemas",console.error("Error fetching schemas:",s)}finally{a.value=!1}}}},w=t=>{const a=o(!1),e=o(null);return{isGranting:a,error:e,grantBulkPermissions:async i=>{if(!t.value)return e.value="No database connection provided",null;a.value=!0,e.value=null;try{return await $fetch("/api/database-roles/grant-bulk-permissions",{method:"POST",body:{...i,...f(t.value)}})}catch(s){return e.value=s instanceof Error?s.message:"Failed to grant permissions",console.error("Error granting bulk permissions:",s),null}finally{a.value=!1}}}};export{y as a,P as b,O as c,S as d,w as e,E as u};
1
+ import{r as o,E as f,c as b}from"./D7uoAo-G.js";const y=t=>{const a=o(!1),e=o(null),r=o([]),i=async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const n=await $fetch("/api/database-roles/get-roles",{method:"POST",body:{...f(t.value)}});r.value=n}catch(n){e.value=n instanceof Error?n.message:"Failed to fetch roles",console.error("Error fetching database roles:",n)}finally{a.value=!1}},s=()=>i(),d=b(()=>{const n=[],l=[],c=[];for(const u of r.value)u.isSuperuser?n.push(u):u.canLogin?l.push(u):c.push(u);return{superusers:n,users:l,roles:c}});return{isLoading:a,error:e,roles:r,categorizedRoles:d,fetchRoles:i,refresh:s}},P=t=>{const a=o(!1),e=o(!1),r=o(null),i=n=>{const l="control plane:",c=n.indexOf(l);if(c===-1)return null;const u=n.slice(c+l.length).trim(),m=u.indexOf("{"),v=u.lastIndexOf("}");if(m===-1||v===-1)return null;const p=u.slice(m,v+1);try{const h=JSON.parse(p);if(h!=null&&h.error&&typeof h.error=="string")return h.error}catch{return null}return null};return{isCreating:a,isDeleting:e,error:r,createRole:async n=>{var l;if(!t.value)return r.value="No database connection provided",null;a.value=!0,r.value=null;try{return await $fetch("/api/database-roles/create-role",{method:"POST",body:{...n,...f(t.value)}})}catch(c){const u=((l=c==null?void 0:c.data)==null?void 0:l.message)||(c instanceof Error?c.message:"Failed to create role"),v=i(u)||u.replace(/^Failed to create role:\s*/i,"").trim();return r.value=v,console.error("Error creating role:",c),{success:!1,message:v,sql:""}}finally{a.value=!1}},deleteRole:async n=>{if(!t.value)return r.value="No database connection provided",null;e.value=!0,r.value=null;try{return await $fetch("/api/database-roles/delete-role",{method:"POST",body:{...f(t.value),roleName:n}})}catch(l){return r.value=l instanceof Error?l.message:"Failed to delete role",console.error("Error deleting role:",l),null}finally{e.value=!1}}}},E=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,databasePermissions:r,fetchDatabasePermissions:async s=>{if(!t.value||!s){e.value="Missing connection or role name";return}a.value=!0,e.value=null;try{const d=await $fetch("/api/database-roles/get-databases-with-permissions",{method:"POST",body:{...f(t.value),roleName:s}});r.value=d}catch(d){e.value=d instanceof Error?d.message:"Failed to fetch database permissions",console.error("Error fetching database permissions:",d)}finally{a.value=!1}}}},O=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,databases:r,fetchDatabases:async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const s=await $fetch("/api/database-roles/get-databases",{method:"POST",body:{...f(t.value)}});r.value=s}catch(s){e.value=s instanceof Error?s.message:"Failed to fetch databases",console.error("Error fetching databases:",s)}finally{a.value=!1}}}},S=t=>{const a=o(!1),e=o(null),r=o([]);return{isLoading:a,error:e,schemas:r,fetchSchemas:async()=>{if(!t.value){e.value="No database connection provided";return}a.value=!0,e.value=null;try{const s=await $fetch("/api/database-roles/get-schemas",{method:"POST",body:{...f(t.value)}});r.value=s}catch(s){e.value=s instanceof Error?s.message:"Failed to fetch schemas",console.error("Error fetching schemas:",s)}finally{a.value=!1}}}},w=t=>{const a=o(!1),e=o(null);return{isGranting:a,error:e,grantBulkPermissions:async i=>{if(!t.value)return e.value="No database connection provided",null;a.value=!0,e.value=null;try{return await $fetch("/api/database-roles/grant-bulk-permissions",{method:"POST",body:{...i,...f(t.value)}})}catch(s){return e.value=s instanceof Error?s.message:"Failed to grant permissions",console.error("Error granting bulk permissions:",s),null}finally{a.value=!1}}}};export{y as a,P as b,O as c,S as d,w as e,E as u};
@@ -1,4 +1,4 @@
1
- import{Q as S,T as z,ax as j,_ as p,g as q,s as Q,a as Z,b as H,t as J,q as K,l as F,c as X,G as Y,L as ee,a4 as te,e as ae,A as re,I as ne}from"./DYqShb5v.js";import{p as ie}from"./Bibtvqd8.js";import{p as se}from"./B_hWP06g.js";import{d as P}from"./BEvswgw7.js";import{o as le}from"./CmKTTxBW.js";import"./DgGwe7jd.js";import"./Gi6I4Gst.js";function oe(e,a){return a<e?-1:a>e?1:a>=e?0:NaN}function ce(e){return e}function ue(){var e=ce,a=oe,f=null,x=S(0),s=S(z),o=S(0);function l(t){var n,c=(t=j(t)).length,g,y,m=0,u=new Array(c),i=new Array(c),v=+x.apply(this,arguments),A=Math.min(z,Math.max(-z,s.apply(this,arguments)-v)),h,C=Math.min(Math.abs(A)/c,o.apply(this,arguments)),$=C*(A<0?-1:1),d;for(n=0;n<c;++n)(d=i[u[n]=n]=+e(t[n],n,t))>0&&(m+=d);for(a!=null?u.sort(function(w,D){return a(i[w],i[D])}):f!=null&&u.sort(function(w,D){return f(t[w],t[D])}),n=0,y=m?(A-c*$)/m:0;n<c;++n,v=h)g=u[n],d=i[g],h=v+(d>0?d*y:0)+$,i[g]={data:t[g],index:n,value:d,startAngle:v,endAngle:h,padAngle:C};return i}return l.value=function(t){return arguments.length?(e=typeof t=="function"?t:S(+t),l):e},l.sortValues=function(t){return arguments.length?(a=t,f=null,l):a},l.sort=function(t){return arguments.length?(f=t,a=null,l):f},l.startAngle=function(t){return arguments.length?(x=typeof t=="function"?t:S(+t),l):x},l.endAngle=function(t){return arguments.length?(s=typeof t=="function"?t:S(+t),l):s},l.padAngle=function(t){return arguments.length?(o=typeof t=="function"?t:S(+t),l):o},l}var pe=ne.pie,G={sections:new Map,showData:!1},T=G.sections,N=G.showData,ge=structuredClone(pe),de=p(()=>structuredClone(ge),"getConfig"),fe=p(()=>{T=new Map,N=G.showData,re()},"clear"),he=p(({label:e,value:a})=>{if(a<0)throw new Error(`"${e}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(e)||(T.set(e,a),F.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),me=p(()=>T,"getSections"),ve=p(e=>{N=e},"setShowData"),Se=p(()=>N,"getShowData"),R={getConfig:de,clear:fe,setDiagramTitle:K,getDiagramTitle:J,setAccTitle:H,getAccTitle:Z,setAccDescription:Q,getAccDescription:q,addSection:he,getSections:me,setShowData:ve,getShowData:Se},xe=p((e,a)=>{ie(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),ye={parse:p(async e=>{const a=await se("pie",e);F.debug(a),xe(a,R)},"parse")},Ae=p(e=>`
1
+ import{Q as S,T as z,ax as j,_ as p,g as q,s as Q,a as Z,b as H,t as J,q as K,l as F,c as X,G as Y,L as ee,a4 as te,e as ae,A as re,I as ne}from"./DSOwr8Hs.js";import{p as ie}from"./BO-QgaRL.js";import{p as se}from"./DzaPC1WB.js";import{d as P}from"./BGAd-CMD.js";import{o as le}from"./CmKTTxBW.js";import"./D7uoAo-G.js";import"./Gi6I4Gst.js";function oe(e,a){return a<e?-1:a>e?1:a>=e?0:NaN}function ce(e){return e}function ue(){var e=ce,a=oe,f=null,x=S(0),s=S(z),o=S(0);function l(t){var n,c=(t=j(t)).length,g,y,m=0,u=new Array(c),i=new Array(c),v=+x.apply(this,arguments),A=Math.min(z,Math.max(-z,s.apply(this,arguments)-v)),h,C=Math.min(Math.abs(A)/c,o.apply(this,arguments)),$=C*(A<0?-1:1),d;for(n=0;n<c;++n)(d=i[u[n]=n]=+e(t[n],n,t))>0&&(m+=d);for(a!=null?u.sort(function(w,D){return a(i[w],i[D])}):f!=null&&u.sort(function(w,D){return f(t[w],t[D])}),n=0,y=m?(A-c*$)/m:0;n<c;++n,v=h)g=u[n],d=i[g],h=v+(d>0?d*y:0)+$,i[g]={data:t[g],index:n,value:d,startAngle:v,endAngle:h,padAngle:C};return i}return l.value=function(t){return arguments.length?(e=typeof t=="function"?t:S(+t),l):e},l.sortValues=function(t){return arguments.length?(a=t,f=null,l):a},l.sort=function(t){return arguments.length?(f=t,a=null,l):f},l.startAngle=function(t){return arguments.length?(x=typeof t=="function"?t:S(+t),l):x},l.endAngle=function(t){return arguments.length?(s=typeof t=="function"?t:S(+t),l):s},l.padAngle=function(t){return arguments.length?(o=typeof t=="function"?t:S(+t),l):o},l}var pe=ne.pie,G={sections:new Map,showData:!1},T=G.sections,N=G.showData,ge=structuredClone(pe),de=p(()=>structuredClone(ge),"getConfig"),fe=p(()=>{T=new Map,N=G.showData,re()},"clear"),he=p(({label:e,value:a})=>{if(a<0)throw new Error(`"${e}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(e)||(T.set(e,a),F.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),me=p(()=>T,"getSections"),ve=p(e=>{N=e},"setShowData"),Se=p(()=>N,"getShowData"),R={getConfig:de,clear:fe,setDiagramTitle:K,getDiagramTitle:J,setAccTitle:H,getAccTitle:Z,setAccDescription:Q,getAccDescription:q,addSection:he,getSections:me,setShowData:ve,getShowData:Se},xe=p((e,a)=>{ie(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),ye={parse:p(async e=>{const a=await se("pie",e);F.debug(a),xe(a,R)},"parse")},Ae=p(e=>`
2
2
  .pieCircle{
3
3
  stroke: ${e.pieStrokeColor};
4
4
  stroke-width : ${e.pieStrokeWidth};
@@ -1 +1 @@
1
- import{d as h,O as C,ad as S,ae as y,c as o,E as D,e as E,o as O,f as i,g as n,af as g}from"./DgGwe7jd.js";import{b as I,a as M,D as B,_ as T}from"./Bok35x_B.js";import{b as x,a as L}from"./BVmBXPoG.js";import{u as N}from"./CE0zlNDo.js";import"./__PEYcIB.js";import"./uDsvlLN0.js";import"./6wO6CbCo.js";import"./DyDU0wFf.js";import"./B5rxJs06.js";import"./DP6Az3fC.js";const R={class:"h-full relative p-1"},G=h({__name:"TableOverview",props:{connectionId:{}},setup(m){const l=["name","schema","kind","owner","estimated_row","total_size","data_size","index_size","comment"],s=m,a=C(),u=S(),{schemaId:c}=y(u),d=o(()=>s.connectionId?a.connections.find(e=>e.id===s.connectionId):a.selectedConnection),r=o(()=>({...D(d.value),schema:c.value})),{data:t,status:p}=N("/api/tables/overview",{method:"POST",body:r,watch:[c,r]},"$x2_S2ch44V"),_=o(()=>{const e=t.value||[];return e.length>0?x(e):L(l)}),f=o(()=>I({columns:_.value,rows:t.value||[],columnKeyBy:"field"})),v=o(()=>M(t.value||[]));return(e,V)=>{const w=g,b=T;return O(),E("div",R,[i(w,{visible:n(p)==="pending"},null,8,["visible"]),i(b,{"column-defs":n(f),"row-data":n(v),"column-types":n(B),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])}}});export{G as default};
1
+ import{d as h,O as C,ad as S,ae as y,c as o,E as D,e as E,o as O,f as i,g as n,af as g}from"./D7uoAo-G.js";import{b as I,a as M,D as B,_ as T}from"./BkqB6n0T.js";import{b as x,a as L}from"./BVmBXPoG.js";import{u as N}from"./LUfaevBS.js";import"./C1TOiVRQ.js";import"./B41tp0B8.js";import"./uHyBIwWw.js";import"./CTYqoFvv.js";import"./B5rxJs06.js";import"./BNnChlxR.js";const R={class:"h-full relative p-1"},G=h({__name:"TableOverview",props:{connectionId:{}},setup(m){const l=["name","schema","kind","owner","estimated_row","total_size","data_size","index_size","comment"],s=m,a=C(),u=S(),{schemaId:c}=y(u),d=o(()=>s.connectionId?a.connections.find(e=>e.id===s.connectionId):a.selectedConnection),r=o(()=>({...D(d.value),schema:c.value})),{data:t,status:p}=N("/api/tables/overview",{method:"POST",body:r,watch:[c,r]},"$x2_S2ch44V"),_=o(()=>{const e=t.value||[];return e.length>0?x(e):L(l)}),f=o(()=>I({columns:_.value,rows:t.value||[],columnKeyBy:"field"})),v=o(()=>M(t.value||[]));return(e,V)=>{const w=g,b=T;return O(),E("div",R,[i(w,{visible:n(p)==="pending"},null,8,["visible"]),i(b,{"column-defs":n(f),"row-data":n(v),"column-types":n(B),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])}}});export{G as default};
@@ -1,4 +1,4 @@
1
- import{_ as b,G as m,L as B,e as C,l as w,b as S,a as D,q as T,t as P,g as z,s as A,H as E,I as F,A as W}from"./DYqShb5v.js";import{p as _}from"./Bibtvqd8.js";import{p as L}from"./B_hWP06g.js";import"./DgGwe7jd.js";var N=F.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=P,this.getAccDescription=z,this.setAccDescription=A}getConfig(){const t=m({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},b(u,"PacketDB"),u),I=1e4,M=b((e,t)=>{_(e,t);let s=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??(a=s+1),a!==s+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${s+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??(i=a+(d??1)-1),d??(d=i-a+1),s=i,w.debug(`Packet block ${a} - ${s} with label ${c}`);r.length<=l+1&&t.getPacket().length<I;){const[p,o]=Y({start:a,end:i,bits:d,label:c},n,l);if(r.push(p),p.end+1===n*l&&(t.pushWord(r),r=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}t.pushWord(r)},"populate"),Y=b((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const r=t*s-1,n=t*s;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await L("packet",e),s=(r=x.parser)==null?void 0:r.yy;if(!(s instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),M(t,s)},"parse")},G=b((e,t,s,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=B(t);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())H(f,$,y,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),H=b((e,t,s,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=s*(r+l)+l;for(const o of t){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),O={draw:G},j={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},q=b(({packet:e}={})=>{const t=m(j,e);return`
1
+ import{_ as b,G as m,L as B,e as C,l as w,b as S,a as D,q as T,t as P,g as z,s as A,H as E,I as F,A as W}from"./DSOwr8Hs.js";import{p as _}from"./BO-QgaRL.js";import{p as L}from"./DzaPC1WB.js";import"./D7uoAo-G.js";var N=F.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=P,this.getAccDescription=z,this.setAccDescription=A}getConfig(){const t=m({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},b(u,"PacketDB"),u),I=1e4,M=b((e,t)=>{_(e,t);let s=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??(a=s+1),a!==s+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${s+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??(i=a+(d??1)-1),d??(d=i-a+1),s=i,w.debug(`Packet block ${a} - ${s} with label ${c}`);r.length<=l+1&&t.getPacket().length<I;){const[p,o]=Y({start:a,end:i,bits:d,label:c},n,l);if(r.push(p),p.end+1===n*l&&(t.pushWord(r),r=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}t.pushWord(r)},"populate"),Y=b((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const r=t*s-1,n=t*s;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await L("packet",e),s=(r=x.parser)==null?void 0:r.yy;if(!(s instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),M(t,s)},"parse")},G=b((e,t,s,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=B(t);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())H(f,$,y,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),H=b((e,t,s,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=s*(r+l)+l;for(const o of t){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),O={draw:G},j={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},q=b(({packet:e}={})=>{const t=m(j,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{bv as w1,fk as bx,fl as Dl,fm as x1,fn as yx,fo as cm,fp as jx,fq as wx,ah as xx,fr as Ai,L as um,aZ as Ul,eb as kx,fs as _x,ft as Sx,fu as $x,fv as Cx,fw as Ex,fx as Ox,fy as Px,fz as Tx,fA as Mx,fB as Ax,fC as Nx,fD as Rx,fE as Ix,fF as qx,fG as zx,ej as Ni,ea as Dx,fH as Ux,fI as Lx,fJ as Fx,fK as Bx,fL as Vx,fM as Wx,fN as Hx,fO as Kx,fP as Jx,fQ as Gx,fR as Qx,fS as dm,fT as Yx,fU as Lf,fV as fm,ec as Xx,fW as Zx,fX as e2,fY as t2,fZ as n2,f_ as r2,f$ as o2,g0 as a2,d as s2,aK as i2,r as Ff,aD as l2,c as vm,as as c2,aE as u2,ao as d2,an as Bf,g as f2}from"./DgGwe7jd.js";function mr(e){return Array.isArray(e)}function _r(e){return e!==null&&typeof e=="object"&&(e.constructor===void 0||e.constructor.name==="Object")}function k1(e){return e&&typeof e=="object"?e.op==="add":!1}function _1(e){return e&&typeof e=="object"?e.op==="remove":!1}function Kp(e){return e&&typeof e=="object"?e.op==="replace":!1}function Lv(e){return e&&typeof e=="object"?e.op==="copy":!1}function si(e){return e&&typeof e=="object"?e.op==="move":!1}function v2(e,t){return JSON.stringify(e)===JSON.stringify(t)}function p2(e,t){return e===t}function S1(e){return e.slice(0,e.length-1)}function h2(e){return e[e.length-1]}function m2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p2;if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(!n(e[r],t[r]))return!1;return!0}function $1(e){return typeof e=="object"&&e!==null}function Jp(e){if(mr(e)){const t=e.slice();return Object.getOwnPropertySymbols(e).forEach(n=>{t[n]=e[n]}),t}if(_r(e)){const t={...e};return Object.getOwnPropertySymbols(e).forEach(n=>{t[n]=e[n]}),t}return e}function Gp(e,t,n){if(e[t]===n)return e;const r=Jp(e);return r[t]=n,r}function et(e,t){let n=e,r=0;for(;r<t.length;)_r(n)?n=n[t[r]]:mr(n)?n=n[Number.parseInt(t[r])]:n=void 0,r++;return n}function bo(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t.length===0)return n;const s=t[0],a=bo(e?e[s]:void 0,t.slice(1),n,r);if(_r(e)||mr(e))return Gp(e,s,a);if(r){const i=g2.test(s)?[]:{};return i[s]=a,i}throw new Error("Path does not exist")}const g2=/^\d+$/;function Qp(e,t,n){if(t.length===0)return n(e);if(!$1(e))throw new Error("Path doesn't exist");const r=t[0],s=Qp(e[r],t.slice(1),n);return Gp(e,r,s)}function of(e,t){if(t.length===0)return e;if(!$1(e))throw new Error("Path does not exist");if(t.length===1){const s=t[0];if(!(s in e))return e;const a=Jp(e);return mr(a)&&a.splice(Number.parseInt(s),1),_r(a)&&delete a[s],a}const n=t[0],r=of(e[n],t.slice(1));return Gp(e,n,r)}function Yp(e,t,n){const r=t.slice(0,t.length-1),s=t[t.length-1];return Qp(e,r,a=>{if(!Array.isArray(a))throw new TypeError(`Array expected at path ${JSON.stringify(r)}`);const i=Jp(a);return i.splice(Number.parseInt(s),0,n),i})}function _o(e,t){return e===void 0?!1:t.length===0?!0:e===null?!1:_o(e[t[0]],t.slice(1))}function So(e){const t=e.split("/");return t.shift(),t.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function gt(e){return e.map(C1).join("")}function C1(e){return`/${String(e).replace(/~/g,"~0").replace(/\//g,"~1")}`}function nu(e,t){return e+C1(t)}function na(e,t,n){let r=e;for(let s=0;s<t.length;s++){S2(t[s]);let a=t[s];if(n!=null&&n.before){const c=n.before(r,a);if(c!==void 0){if(c.document!==void 0&&(r=c.document),c.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');c.operation!==void 0&&(a=c.operation)}}const i=r,l=ra(r,a.path);if(a.op==="add")r=j2(r,l,a.value);else if(a.op==="remove")r=y2(r,l);else if(a.op==="replace")r=b2(r,l,a.value);else if(a.op==="copy")r=w2(r,l,Fv(a.from));else if(a.op==="move")r=x2(r,l,Fv(a.from));else if(a.op==="test")k2(r,l,a.value);else throw new Error(`Unknown JSONPatch operation ${JSON.stringify(a)}`);if(n!=null&&n.after){const c=n.after(r,a,i);c!==void 0&&(r=c)}}return r}function b2(e,t,n){return _o(e,t)?bo(e,t,n):e}function y2(e,t){return of(e,t)}function j2(e,t,n){return Ic(e,t)?Yp(e,t,n):bo(e,t,n)}function w2(e,t,n){const r=et(e,n);return Ic(e,t)?Yp(e,t,r):bo(e,t,r)}function x2(e,t,n){const r=et(e,n),s=of(e,n);return Ic(s,t)?Yp(s,t,r):bo(s,t,r)}function k2(e,t,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${gt(t)}")`);if(!_o(e,t))throw new Error(`Test failed: path not found (path: "${gt(t)}")`);const r=et(e,t);if(!v2(r,n))throw new Error(`Test failed, value differs (path: "${gt(t)}")`)}function Ic(e,t){if(t.length===0)return!1;const n=et(e,S1(t));return Array.isArray(n)}function _2(e,t){if(h2(t)!=="-")return t;const n=S1(t),r=et(e,n);return n.concat(r.length)}function S2(e){if(!["add","remove","replace","copy","move","test"].includes(e.op))throw new Error(`Unknown JSONPatch op ${JSON.stringify(e.op)}`);if(typeof e.path!="string")throw new Error(`Required property "path" missing or not a string in operation ${JSON.stringify(e)}`);if((e.op==="copy"||e.op==="move")&&typeof e.from!="string")throw new Error(`Required property "from" missing or not a string in operation ${JSON.stringify(e)}`)}function ra(e,t){return _2(e,So(t))}function Fv(e){return So(e)}function E1(e,t,n){let r=[];return na(e,t,{before:(a,i)=>{let l;const c=ra(a,i.path);if(i.op==="add")l=T1(a,c);else if(i.op==="remove")l=P1(a,c);else if(i.op==="replace")l=O1(a,c);else if(i.op==="copy")l=$2(a,c);else if(i.op==="move")l=C2(a,c,Fv(i.from));else if(i.op==="test")l=[];else throw new Error(`Unknown JSONPatch operation ${JSON.stringify(i)}`);let d;if(n!=null&&n.before){const u=n.before(a,i,l);if(u!=null&&u.revertOperations&&(l=u.revertOperations),u!=null&&u.document&&(d=u.document),u!=null&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=l.concat(r),d!==void 0)return{document:d}}}),r}function O1(e,t){return _o(e,t)?[{op:"replace",path:gt(t),value:et(e,t)}]:[]}function P1(e,t){return[{op:"add",path:gt(t),value:et(e,t)}]}function T1(e,t){return Ic(e,t)||!_o(e,t)?[{op:"remove",path:gt(t)}]:O1(e,t)}function $2(e,t){return T1(e,t)}function C2(e,t,n){if(t.length<n.length&&m2(n,t))return[{op:"replace",path:gt(t),value:e}];const r={op:"move",from:gt(t),path:gt(n)};return!Ic(e,t)&&_o(e,t)?[r,...P1(e,t)]:[r]}var ru={},pm;function E2(){if(pm)return ru;pm=1;var e={b:"\b",f:"\f",n:`
1
+ import{bv as w1,fk as bx,fl as Dl,fm as x1,fn as yx,fo as cm,fp as jx,fq as wx,ah as xx,fr as Ai,L as um,aZ as Ul,eb as kx,fs as _x,ft as Sx,fu as $x,fv as Cx,fw as Ex,fx as Ox,fy as Px,fz as Tx,fA as Mx,fB as Ax,fC as Nx,fD as Rx,fE as Ix,fF as qx,fG as zx,ej as Ni,ea as Dx,fH as Ux,fI as Lx,fJ as Fx,fK as Bx,fL as Vx,fM as Wx,fN as Hx,fO as Kx,fP as Jx,fQ as Gx,fR as Qx,fS as dm,fT as Yx,fU as Lf,fV as fm,ec as Xx,fW as Zx,fX as e2,fY as t2,fZ as n2,f_ as r2,f$ as o2,g0 as a2,d as s2,aK as i2,r as Ff,aD as l2,c as vm,as as c2,aE as u2,ao as d2,an as Bf,g as f2}from"./D7uoAo-G.js";function mr(e){return Array.isArray(e)}function _r(e){return e!==null&&typeof e=="object"&&(e.constructor===void 0||e.constructor.name==="Object")}function k1(e){return e&&typeof e=="object"?e.op==="add":!1}function _1(e){return e&&typeof e=="object"?e.op==="remove":!1}function Kp(e){return e&&typeof e=="object"?e.op==="replace":!1}function Lv(e){return e&&typeof e=="object"?e.op==="copy":!1}function si(e){return e&&typeof e=="object"?e.op==="move":!1}function v2(e,t){return JSON.stringify(e)===JSON.stringify(t)}function p2(e,t){return e===t}function S1(e){return e.slice(0,e.length-1)}function h2(e){return e[e.length-1]}function m2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p2;if(e.length<t.length)return!1;for(let r=0;r<t.length;r++)if(!n(e[r],t[r]))return!1;return!0}function $1(e){return typeof e=="object"&&e!==null}function Jp(e){if(mr(e)){const t=e.slice();return Object.getOwnPropertySymbols(e).forEach(n=>{t[n]=e[n]}),t}if(_r(e)){const t={...e};return Object.getOwnPropertySymbols(e).forEach(n=>{t[n]=e[n]}),t}return e}function Gp(e,t,n){if(e[t]===n)return e;const r=Jp(e);return r[t]=n,r}function et(e,t){let n=e,r=0;for(;r<t.length;)_r(n)?n=n[t[r]]:mr(n)?n=n[Number.parseInt(t[r])]:n=void 0,r++;return n}function bo(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t.length===0)return n;const s=t[0],a=bo(e?e[s]:void 0,t.slice(1),n,r);if(_r(e)||mr(e))return Gp(e,s,a);if(r){const i=g2.test(s)?[]:{};return i[s]=a,i}throw new Error("Path does not exist")}const g2=/^\d+$/;function Qp(e,t,n){if(t.length===0)return n(e);if(!$1(e))throw new Error("Path doesn't exist");const r=t[0],s=Qp(e[r],t.slice(1),n);return Gp(e,r,s)}function of(e,t){if(t.length===0)return e;if(!$1(e))throw new Error("Path does not exist");if(t.length===1){const s=t[0];if(!(s in e))return e;const a=Jp(e);return mr(a)&&a.splice(Number.parseInt(s),1),_r(a)&&delete a[s],a}const n=t[0],r=of(e[n],t.slice(1));return Gp(e,n,r)}function Yp(e,t,n){const r=t.slice(0,t.length-1),s=t[t.length-1];return Qp(e,r,a=>{if(!Array.isArray(a))throw new TypeError(`Array expected at path ${JSON.stringify(r)}`);const i=Jp(a);return i.splice(Number.parseInt(s),0,n),i})}function _o(e,t){return e===void 0?!1:t.length===0?!0:e===null?!1:_o(e[t[0]],t.slice(1))}function So(e){const t=e.split("/");return t.shift(),t.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function gt(e){return e.map(C1).join("")}function C1(e){return`/${String(e).replace(/~/g,"~0").replace(/\//g,"~1")}`}function nu(e,t){return e+C1(t)}function na(e,t,n){let r=e;for(let s=0;s<t.length;s++){S2(t[s]);let a=t[s];if(n!=null&&n.before){const c=n.before(r,a);if(c!==void 0){if(c.document!==void 0&&(r=c.document),c.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');c.operation!==void 0&&(a=c.operation)}}const i=r,l=ra(r,a.path);if(a.op==="add")r=j2(r,l,a.value);else if(a.op==="remove")r=y2(r,l);else if(a.op==="replace")r=b2(r,l,a.value);else if(a.op==="copy")r=w2(r,l,Fv(a.from));else if(a.op==="move")r=x2(r,l,Fv(a.from));else if(a.op==="test")k2(r,l,a.value);else throw new Error(`Unknown JSONPatch operation ${JSON.stringify(a)}`);if(n!=null&&n.after){const c=n.after(r,a,i);c!==void 0&&(r=c)}}return r}function b2(e,t,n){return _o(e,t)?bo(e,t,n):e}function y2(e,t){return of(e,t)}function j2(e,t,n){return Ic(e,t)?Yp(e,t,n):bo(e,t,n)}function w2(e,t,n){const r=et(e,n);return Ic(e,t)?Yp(e,t,r):bo(e,t,r)}function x2(e,t,n){const r=et(e,n),s=of(e,n);return Ic(s,t)?Yp(s,t,r):bo(s,t,r)}function k2(e,t,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${gt(t)}")`);if(!_o(e,t))throw new Error(`Test failed: path not found (path: "${gt(t)}")`);const r=et(e,t);if(!v2(r,n))throw new Error(`Test failed, value differs (path: "${gt(t)}")`)}function Ic(e,t){if(t.length===0)return!1;const n=et(e,S1(t));return Array.isArray(n)}function _2(e,t){if(h2(t)!=="-")return t;const n=S1(t),r=et(e,n);return n.concat(r.length)}function S2(e){if(!["add","remove","replace","copy","move","test"].includes(e.op))throw new Error(`Unknown JSONPatch op ${JSON.stringify(e.op)}`);if(typeof e.path!="string")throw new Error(`Required property "path" missing or not a string in operation ${JSON.stringify(e)}`);if((e.op==="copy"||e.op==="move")&&typeof e.from!="string")throw new Error(`Required property "from" missing or not a string in operation ${JSON.stringify(e)}`)}function ra(e,t){return _2(e,So(t))}function Fv(e){return So(e)}function E1(e,t,n){let r=[];return na(e,t,{before:(a,i)=>{let l;const c=ra(a,i.path);if(i.op==="add")l=T1(a,c);else if(i.op==="remove")l=P1(a,c);else if(i.op==="replace")l=O1(a,c);else if(i.op==="copy")l=$2(a,c);else if(i.op==="move")l=C2(a,c,Fv(i.from));else if(i.op==="test")l=[];else throw new Error(`Unknown JSONPatch operation ${JSON.stringify(i)}`);let d;if(n!=null&&n.before){const u=n.before(a,i,l);if(u!=null&&u.revertOperations&&(l=u.revertOperations),u!=null&&u.document&&(d=u.document),u!=null&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=l.concat(r),d!==void 0)return{document:d}}}),r}function O1(e,t){return _o(e,t)?[{op:"replace",path:gt(t),value:et(e,t)}]:[]}function P1(e,t){return[{op:"add",path:gt(t),value:et(e,t)}]}function T1(e,t){return Ic(e,t)||!_o(e,t)?[{op:"remove",path:gt(t)}]:O1(e,t)}function $2(e,t){return T1(e,t)}function C2(e,t,n){if(t.length<n.length&&m2(n,t))return[{op:"replace",path:gt(t),value:e}];const r={op:"move",from:gt(t),path:gt(n)};return!Ic(e,t)&&_o(e,t)?[r,...P1(e,t)]:[r]}var ru={},pm;function E2(){if(pm)return ru;pm=1;var e={b:"\b",f:"\f",n:`
2
2
  `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},t=97;ru.parse=function(h,j,p){var b={},g=0,w=0,x=0,m=p&&p.bigint&&typeof BigInt<"u";return{data:k("",!0),pointers:b};function k(R,S){E();var T;Me(R,"value");var re=G();switch(re){case"t":L("rue"),T=!0;break;case"f":L("alse"),T=!1;break;case"n":L("ull"),T=null;break;case'"':T=A();break;case"[":T=B(R);break;case"{":T=V(R);break;default:je(),"-0123456789".indexOf(re)>=0?T=M():W()}return Me(R,"valueEnd"),E(),S&&x<h.length&&W(),T}function E(){e:for(;x<h.length;){switch(h[x]){case" ":w++;break;case" ":w+=4;break;case"\r":w=0;break;case`
3
3
  `:w=0,g++;break;default:break e}x++}}function A(){for(var R="",S;S=G(),S!='"';)S=="\\"?(S=G(),S in e?R+=e[S]:S=="u"?R+=ce():F()):R+=S;return R}function M(){var R="",S=!0;h[x]=="-"&&(R+=G()),R+=h[x]=="0"?G():Te(),h[x]=="."&&(R+=G()+Te(),S=!1),(h[x]=="e"||h[x]=="E")&&(R+=G(),(h[x]=="+"||h[x]=="-")&&(R+=G()),R+=Te(),S=!1);var T=+R;return m&&S&&(T>Number.MAX_SAFE_INTEGER||T<Number.MIN_SAFE_INTEGER)?BigInt(R):T}function B(R){E();var S=[],T=0;if(G()=="]")return S;for(je();;){var re=R+"/"+T;S.push(k(re)),E();var Se=G();if(Se=="]")break;Se!=","&&F(),E(),T++}return S}function V(R){E();var S={};if(G()=="}")return S;for(je();;){var T=ne();G()!='"'&&F();var re=A(),Se=R+"/"+f(re);de(Se,"key",T),Me(Se,"keyEnd"),E(),G()!=":"&&F(),E(),S[re]=k(Se),E();var oe=G();if(oe=="}")break;oe!=","&&F(),E()}return S}function L(R){for(var S=0;S<R.length;S++)G()!==R[S]&&F()}function G(){le();var R=h[x];return x++,w++,R}function je(){x--,w--}function ce(){for(var R=4,S=0;R--;){S<<=4;var T=G().toLowerCase();T>="a"&&T<="f"?S+=T.charCodeAt()-t+10:T>="0"&&T<="9"?S+=+T:F()}return String.fromCharCode(S)}function Te(){for(var R="";h[x]>="0"&&h[x]<="9";)R+=G();if(R.length)return R;le(),W()}function Me(R,S){de(R,S,ne())}function de(R,S,T){b[R]=b[R]||{},b[R][S]=T}function ne(){return{line:g,column:w,pos:x}}function W(){throw new SyntaxError("Unexpected token "+h[x]+" in JSON at position "+x)}function F(){je(),W()}function le(){if(x>=h.length)throw new SyntaxError("Unexpected end of JSON input")}},ru.stringify=function(h,j,p){if(!r(h))return;var b=0,g,w,x=typeof p=="object"?p.space:p;switch(typeof x){case"number":var m=x>10?10:x<0?0:Math.floor(x);x=m&&de(m," "),g=m,w=m;break;case"string":x=x.slice(0,10),g=0,w=0;for(var k=0;k<x.length;k++){var E=x[k];switch(E){case" ":w++;break;case" ":w+=4;break;case"\r":w=0;break;case`
4
4
  `:w=0,b++;break;default:throw new Error("whitespace characters not allowed in JSON")}g++}break;default:x=void 0}var A="",M={},B=0,V=0,L=0,G=p&&p.es6&&typeof Map=="function";return je(h,0,""),{json:A,pointers:M};function je(ne,W,F){switch(Me(F,"value"),typeof ne){case"number":case"bigint":case"boolean":ce(""+ne);break;case"string":ce(u(ne));break;case"object":ne===null?ce("null"):typeof ne.toJSON=="function"?ce(u(ne.toJSON())):Array.isArray(ne)?le():G?ne.constructor.BYTES_PER_ELEMENT?le():ne instanceof Map?S():ne instanceof Set?S(!0):R():R()}Me(F,"valueEnd");function le(){if(ne.length){ce("[");for(var T=W+1,re=0;re<ne.length;re++){re&&ce(","),Te(T);var Se=r(ne[re])?ne[re]:null,oe=F+"/"+re;je(Se,T,oe)}Te(W),ce("]")}else ce("[]")}function R(){var T=Object.keys(ne);if(T.length){ce("{");for(var re=W+1,Se=0;Se<T.length;Se++){var oe=T[Se],Y=ne[oe];if(r(Y)){Se&&ce(",");var ye=F+"/"+f(oe);Te(re),Me(ye,"key"),ce(u(oe)),Me(ye,"keyEnd"),ce(":"),x&&ce(" "),je(Y,re,ye)}}Te(W),ce("}")}else ce("{}")}function S(T){if(ne.size){ce("{");for(var re=W+1,Se=!0,oe=ne.entries(),Y=oe.next();!Y.done;){var ye=Y.value,P=ye[0],z=T?!0:ye[1];if(r(z)){Se||ce(","),Se=!1;var D=F+"/"+f(P);Te(re),Me(D,"key"),ce(u(P)),Me(D,"keyEnd"),ce(":"),x&&ce(" "),je(z,re,D)}Y=oe.next()}Te(W),ce("}")}else ce("{}")}}function ce(ne){V+=ne.length,L+=ne.length,A+=ne}function Te(ne){if(x){for(A+=`
@@ -1,4 +1,4 @@
1
- import{g as gt}from"./CBjcd4cE.js";import{a as mt,g as lt,h as xt,d as kt}from"./BbLqUOHs.js";import{_ as n,g as _t,s as vt,a as bt,b as wt,t as Tt,q as St,c as R,d as G,e as $t,A as Mt}from"./DYqShb5v.js";import{d as et}from"./BEvswgw7.js";import"./DgGwe7jd.js";var U=function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var X="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
1
+ import{g as gt}from"./D_fdC3mJ.js";import{a as mt,g as lt,h as xt,d as kt}from"./CWGzL6OE.js";import{_ as n,g as _t,s as vt,a as bt,b as wt,t as Tt,q as St,c as R,d as G,e as $t,A as Mt}from"./DSOwr8Hs.js";import{d as et}from"./BGAd-CMD.js";import"./D7uoAo-G.js";var U=function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var X="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+z.join(", ")+", got '"+(this.terminals_[v]||v)+"'":X="Parse error on line "+(C+1)+": Unexpected "+(v==Q?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[v]||v,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+v);switch(T[0]){case 1:l.push(v),p.push(_.yytext),o.push(_.yylloc),l.push(T[1]),v=null,K=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=p[p.length-M],F._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},ft&&(F._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),q=this.performAction.apply(F,[k,K,C,I.yy,T[1],p,o].concat(yt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),p=p.slice(0,-1*M),o=o.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),p.push(F.$),o.push(F._$),tt=b[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},m=function(){var h={EOF:1,parseError:n(function(a,l){if(this.yy.parser)this.yy.parser.parseError(a,l);else throw new Error(a)},"parseError"),setInput:n(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:n(function(i){var a=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===d.length?this.yylloc.first_column:0)+d[d.length-l.length].length-l[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(i){this.unput(this.match.slice(i))},"less"),pastInput:n(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{G as Ye,d as X,r as B,an as re,c as I,e as g,m as e,l as O,f as w,a4 as ce,w as E,z as N,t as i,g as t,o as f,A as me,n as oe,cg as He,bh as Ve,i as le,a8 as Ie,cz as Je,cj as Ce,ck as Te,cp as Le,E as ne,K as be,O as $e,k as J,q as Re,I as te,aF as se,bf as xe,bj as Ae,bx as Pe,by as Be,F as H,s as V,bz as De,ae as je,R as ue,T as Ze,N as et}from"./DgGwe7jd.js";import{g as Ke}from"./CP-7VdtS.js";import{t as G,i as tt,a as st,b as nt,m as ot,k as at,g as Ue,h as Ge,c as it,d as Me,e as rt,f as lt,j as dt,n as ut,l as ct,S as mt,o as pt,p as ft,_ as qe,q as gt,r as Oe,s as vt,C as bt,u as _t,v as ht,E as we,w as yt,x as xt,y as $t,z as St,A as wt,B as kt}from"./DeVs4gEL.js";import{a as It}from"./D9Ycznwo.js";import{b as pe,a as fe,_ as Se,D as ge}from"./Bok35x_B.js";import{b as _e,a as Qe}from"./BVmBXPoG.js";import{u as Ct}from"./DDsaDrGo.js";import{_ as Tt}from"./DViCRsmA.js";import{_ as Ee}from"./Lh0RfwhV.js";import{_ as Lt,u as Rt}from"./G40WRC_L.js";import"./__PEYcIB.js";import"./uDsvlLN0.js";import"./6wO6CbCo.js";import"./DyDU0wFf.js";import"./B5rxJs06.js";import"./DP6Az3fC.js";var Fe={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},At=function(){function n(r){var u=this._condVal=Me(r)?new RegExp(r):rt(r)?r:null;if(u==null){var s="";G(s)}}return n.prototype.evaluate=function(r){var u=typeof r;return Me(u)?this._condVal.test(r):lt(u)?this._condVal.test(r+""):!1},n}(),Pt=function(){function n(){}return n.prototype.evaluate=function(){return this.value},n}(),Bt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=this.children,u=0;u<r.length;u++)if(!r[u].evaluate())return!1;return!0},n}(),Dt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=this.children,u=0;u<r.length;u++)if(r[u].evaluate())return!0;return!1},n}(),Et=function(){function n(){}return n.prototype.evaluate=function(){return!this.child.evaluate()},n}(),Nt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=!!this.valueParser,u=this.getValue,s=u(this.valueGetterParam),o=r?this.valueParser(s):null,v=0;v<this.subCondList.length;v++)if(!this.subCondList[v].evaluate(r?o:s))return!1;return!0},n}();function Ne(n,r){if(n===!0||n===!1){var u=new Pt;return u.value=n,u}var s="";return Xe(n)||G(s),n.and?ze("and",n,r):n.or?ze("or",n,r):n.not?Mt(n,r):Ot(n,r)}function ze(n,r,u){var s=r[n],o="";nt(s)||G(o),s.length||G(o);var v=n==="and"?new Bt:new Dt;return v.children=ot(s,function(c){return Ne(c,u)}),v.children.length||G(o),v}function Mt(n,r){var u=n.not,s="";Xe(u)||G(s);var o=new Et;return o.child=Ne(u,r),o.child||G(s),o}function Ot(n,r){for(var u="",s=r.prepareGetValue(n),o=[],v=at(n),c=n.parser,x=c?Ue(c):null,h=0;h<v.length;h++){var m=v[h];if(!(m==="parser"||r.valueGetterAttrMap.get(m))){var _=Ge(Fe,m)?Fe[m]:m,$=n[m],b=x?x($):$,p=it(_,b)||_==="reg"&&new At(b);p||G(u),o.push(p)}}o.length||G(u);var S=new Nt;return S.valueGetterParam=s,S.valueParser=x,S.getValue=r.getValue,S.subCondList=o,S}function Xe(n){return tt(n)&&!st(n)}var Ft=function(){function n(r,u){this._cond=Ne(r,u)}return n.prototype.evaluate=function(){return this._cond.evaluate()},n}();function zt(n,r){return new Ft(n,r)}var Ht={type:"echarts:filter",transform:function(n){for(var r=n.upstream,u,s=zt(n.config,{valueGetterAttrMap:dt({dimension:!0}),prepareGetValue:function(x){var h="",m=x.dimension;Ge(x,"dimension")||G(h);var _=r.getDimensionInfo(m);return _||G(h),{dimIdx:_.index}},getValue:function(x){return r.retrieveValueFromItem(u,x.dimIdx)}}),o=[],v=0,c=r.count();v<c;v++)u=r.getRawDataItem(v),s.evaluate()&&o.push(u);return{data:o}}},Vt={type:"echarts:sort",transform:function(n){var r=n.upstream,u=n.config,s="",o=ut(u);o.length||G(s);var v=[];ct(o,function(_){var $=_.dimension,b=_.order,p=_.parser,S=_.incomparable;if($==null&&G(s),b!=="asc"&&b!=="desc"&&G(s),S&&S!=="min"&&S!=="max"){var l="";G(l)}if(b!=="asc"&&b!=="desc"){var a="";G(a)}var d=r.getDimensionInfo($);d||G(s);var T=p?Ue(p):null;p&&!T&&G(s),v.push({dimIdx:d.index,parser:T,comparator:new mt(b,S)})});var c=r.sourceFormat;c!==pt&&c!==ft&&G(s);for(var x=[],h=0,m=r.count();h<m;h++)x.push(r.getRawDataItem(h));return x.sort(function(_,$){for(var b=0;b<v.length;b++){var p=v[b],S=r.retrieveValueFromItem(_,p.dimIdx),l=r.retrieveValueFromItem($,p.dimIdx);p.parser&&(S=p.parser(S),l=p.parser(l));var a=p.comparator.evaluate(S,l);if(a!==0)return a}return 0}),{data:x}}};function jt(n){n.registerTransform(Ht),n.registerTransform(Vt)}var Kt=function(n){qe(r,n);function r(){var u=n!==null&&n.apply(this,arguments)||this;return u.type="dataset",u}return r.prototype.init=function(u,s,o){n.prototype.init.call(this,u,s,o),this._sourceManager=new gt(this),Oe(this)},r.prototype.mergeOption=function(u,s){n.prototype.mergeOption.call(this,u,s),Oe(this)},r.prototype.optionUpdated=function(){this._sourceManager.dirty()},r.prototype.getSourceManager=function(){return this._sourceManager},r.type="dataset",r.defaultOption={seriesLayoutBy:vt},r}(bt),Ut=function(n){qe(r,n);function r(){var u=n!==null&&n.apply(this,arguments)||this;return u.type="dataset",u}return r.type="dataset",r}(_t);function Gt(n){n.registerComponentModel(Kt),n.registerComponentView(Ut)}const de=n=>It(n??0),ie=n=>n==null?"0.00/s":`${n.toFixed(2)}/s`,ke=n=>n==null?"0%":`${n.toFixed(2)}%`,he=n=>{if(!n)return"-";const r=new Date(n);return Number.isNaN(r.getTime())?n:r.toLocaleString()},We=n=>{if(n==null)return"-";if(n<60)return`${n}s`;const r=Math.floor(n/60),u=n%60;if(r<60)return`${r}m ${u}s`;const s=Math.floor(r/60),o=r%60;return`${s}h ${o}m`},qt=n=>n==null||n<=0?"0 B":Ye(n).replace(" bytes"," B"),Qt=n=>{if(!n)return"-";const r=n.replace(/\s+/g," ").trim();return r?r.length>320?`${r.slice(0,320)}...`:r:"-"},Xt=n=>(n||"").toLowerCase().includes("idle in transaction"),Wt={class:"space-y-4"},Yt={class:"flex items-center justify-between"},Jt={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Zt={class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},es={class:"h-full border rounded-lg p-2.5 space-y-2"},ts={class:"flex items-center gap-1"},ss={class:"text-sm font-semibold leading-none tabular-nums"},ns={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},os={class:"text-muted-foreground"},as={class:"tabular-nums text-foreground"},is={class:"text-muted-foreground"},rs={class:"tabular-nums text-foreground"},ls={class:"text-muted-foreground"},ds={class:"tabular-nums text-foreground"},us={class:"text-muted-foreground"},cs={class:"tabular-nums text-foreground"},ms={class:"h-full border rounded-lg p-2.5 space-y-2"},ps={class:"flex items-center gap-1"},fs={class:"text-sm font-semibold leading-none tabular-nums"},gs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},vs={class:"text-muted-foreground"},bs={class:"tabular-nums text-foreground"},_s={class:"text-muted-foreground"},hs={class:"tabular-nums text-foreground"},ys={class:"text-muted-foreground"},xs={class:"tabular-nums text-foreground"},$s={class:"text-muted-foreground"},Ss={class:"tabular-nums text-foreground"},ws={class:"h-full border rounded-lg p-2.5 space-y-2"},ks={class:"flex items-center gap-1"},Is={class:"text-sm font-semibold leading-none tabular-nums"},Cs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},Ts={class:"text-muted-foreground"},Ls={class:"tabular-nums text-foreground"},Rs={class:"text-muted-foreground"},As={class:"tabular-nums text-foreground"},Ps={class:"text-muted-foreground"},Bs={class:"tabular-nums text-foreground"},Ds={class:"text-muted-foreground"},Es={class:"tabular-nums text-foreground"},Ns={class:"h-full border rounded-lg p-2.5 space-y-2"},Ms={class:"flex items-center gap-1"},Os={class:"text-sm font-semibold leading-none tabular-nums"},Fs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},zs={class:"text-muted-foreground"},Hs={class:"tabular-nums text-foreground"},Vs={class:"text-muted-foreground"},js={class:"tabular-nums text-foreground"},Ks={class:"text-muted-foreground"},Us={class:"tabular-nums text-foreground"},Gs={class:"text-muted-foreground"},qs={class:"tabular-nums text-foreground"},Qs={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Xs={class:"border rounded-lg p-2.5"},Ws={class:"insights-chart-container"},Ys={class:"border rounded-lg p-2.5"},Js={class:"insights-chart-container"},Zs={class:"border rounded-lg p-2.5"},en={class:"insights-chart-container"},tn=X({__name:"InstanceInsightsActivitySection",props:{dashboard:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},setup(n){ht([yt,xt,$t,Gt,jt,St,wt,kt]);const r=n,u=B({}),s=B({}),o=B({}),v=(l,a)=>{a!=null&&a.selected&&(l.value={...a.selected})},c=l=>v(u,l),x=l=>v(s,l),h=l=>v(o,l),m=B([]);re(()=>r.dashboard,l=>{if(!(l!=null&&l.capturedAt))return;const a=new Date(l.capturedAt).toLocaleTimeString(),d={capturedAt:l.capturedAt,label:a,sessionsTotal:l.sessions.total,sessionsActive:l.sessions.active,sessionsIdle:l.sessions.idle,tps:l.transactions.tps,commits:l.transactions.commitsPerSec,rollbacks:l.transactions.rollbacksPerSec,reads:l.blockIO.readsPerSec,hits:l.blockIO.hitsPerSec,hitRatio:l.blockIO.bufferHitRatio},T=m.value.findIndex(j=>j.capturedAt===d.capturedAt);if(T>=0){m.value[T]=d;return}m.value.push(d),m.value.length>80&&(m.value=m.value.slice(-80))},{immediate:!0,deep:!0});const _=I(()=>m.value.map((l,a)=>({...l,idx:a}))),$=l=>Object.keys(l).length?l:void 0,b=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(u.value)},dataset:[{id:"sessions_raw",source:_.value},{id:"sessions_filtered",fromDatasetId:"sessions_raw",transform:{type:"filter",config:{dimension:"idx",gte:0}}}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},series:[{name:"Total",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsTotal"}},{name:"Active",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsActive"}},{name:"Idle",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsIdle"}}]})),p=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(s.value)},dataset:[{id:"transactions_dataset",source:_.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"TPS"},{type:"value",name:"Commit/Rollback"}],series:[{name:"TPS",type:"line",smooth:!0,yAxisIndex:0,datasetId:"transactions_dataset",encode:{x:"label",y:"tps"}},{name:"Commits/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"commits"}},{name:"Rollbacks/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"rollbacks"}}]})),S=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(o.value)},dataset:[{id:"block_io_dataset",source:_.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"Blocks/s"},{type:"value",name:"Hit %",min:0,max:100}],series:[{name:"Reads/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"reads"}},{name:"Hits/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"hits"}},{name:"Buffer Hit Ratio",type:"line",smooth:!0,yAxisIndex:1,datasetId:"block_io_dataset",encode:{x:"label",y:"hitRatio"}}]}));return(l,a)=>{var j,R,F,U,q,k,M,z,y,L,K,A,P,Q,Z,ae,ve,C,D,Y,W;const d=me,T=ce;return f(),g("div",Wt,[e("div",Yt,[a[2]||(a[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Activity Dashboard"),e("p",{class:"text-xs text-muted-foreground"}," Sessions, TPS, tuples and block I/O ")],-1)),w(T,{variant:"outline",size:"xs",disabled:l.isLoading||l.isActionLoading,class:"font-normal",onClick:a[0]||(a[0]=ye=>l.onRefresh())},{default:E(()=>[w(d,{name:"hugeicons:redo",class:oe(["size-4",l.isLoading&&"animate-spin"])},null,8,["class"]),a[1]||(a[1]=N(" Refresh Activity "))]),_:1},8,["disabled"])]),(j=l.dashboard)!=null&&j.sessions.exceedsThreshold?(f(),g("div",Jt,[a[3]||(a[3]=N(" Total connections are at ")),e("strong",null,i(t(ke)(l.dashboard.sessions.usagePercent)),1),a[4]||(a[4]=N(" of ")),a[5]||(a[5]=e("strong",null,"max_connections",-1)),a[6]||(a[6]=N(". Investigate connection pool usage. "))])):O("",!0),e("div",Zt,[e("div",es,[e("div",ts,[a[7]||(a[7]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Sessions:",-1)),e("p",ss,i(t(de)((R=l.dashboard)==null?void 0:R.sessions.total)),1)]),e("div",ns,[e("p",os,[a[8]||(a[8]=e("span",null,"Active: ",-1)),e("span",as,i(t(de)((F=l.dashboard)==null?void 0:F.sessions.active)),1)]),e("p",is,[a[9]||(a[9]=e("span",null,"Idle: ",-1)),e("span",rs,i(t(de)((U=l.dashboard)==null?void 0:U.sessions.idle)),1)]),e("p",ls,[a[10]||(a[10]=e("span",null,"Max: ",-1)),e("span",ds,i(t(de)((q=l.dashboard)==null?void 0:q.sessions.maxConnections)),1)]),e("p",us,[a[11]||(a[11]=e("span",null,"Usage: ",-1)),e("span",cs,i(t(ke)((k=l.dashboard)==null?void 0:k.sessions.usagePercent)),1)])])]),e("div",ms,[e("div",ps,[a[12]||(a[12]=e("p",{class:"text-xs uppercase text-muted-foreground"},"TPS:",-1)),e("p",fs,i(t(ie)((M=l.dashboard)==null?void 0:M.transactions.tps)),1)]),e("div",gs,[e("p",vs,[a[13]||(a[13]=e("span",null,"Commits/sec: ",-1)),e("span",bs,i(t(ie)((z=l.dashboard)==null?void 0:z.transactions.commitsPerSec)),1)]),e("p",_s,[a[14]||(a[14]=e("span",null,"Rollbacks/sec: ",-1)),e("span",hs,i(t(ie)((y=l.dashboard)==null?void 0:y.transactions.rollbacksPerSec)),1)]),e("p",ys,[a[15]||(a[15]=e("span",null,"Total Commits: ",-1)),e("span",xs,i(t(de)((L=l.dashboard)==null?void 0:L.transactions.totalCommits)),1)]),e("p",$s,[a[16]||(a[16]=e("span",null,"Total Rollbacks: ",-1)),e("span",Ss,i(t(de)((K=l.dashboard)==null?void 0:K.transactions.totalRollbacks)),1)])])]),e("div",ws,[e("div",ks,[a[17]||(a[17]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Tuples:",-1)),e("p",Is,i(t(ie)((A=l.dashboard)==null?void 0:A.tuples.insertsPerSec)),1)]),e("div",Cs,[e("p",Ts,[a[18]||(a[18]=e("span",null,"Updates: ",-1)),e("span",Ls,i(t(ie)((P=l.dashboard)==null?void 0:P.tuples.updatesPerSec)),1)]),e("p",Rs,[a[19]||(a[19]=e("span",null,"Deletes: ",-1)),e("span",As,i(t(ie)((Q=l.dashboard)==null?void 0:Q.tuples.deletesPerSec)),1)]),e("p",Ps,[a[20]||(a[20]=e("span",null,"Fetched: ",-1)),e("span",Bs,i(t(ie)((Z=l.dashboard)==null?void 0:Z.tuples.fetchedPerSec)),1)]),e("p",Ds,[a[21]||(a[21]=e("span",null,"Returned: ",-1)),e("span",Es,i(t(ie)((ae=l.dashboard)==null?void 0:ae.tuples.returnedPerSec)),1)])])]),e("div",Ns,[e("div",Ms,[a[22]||(a[22]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Block I/O:",-1)),e("p",Os,i(t(ke)((ve=l.dashboard)==null?void 0:ve.blockIO.bufferHitRatio)),1)]),e("div",Fs,[e("p",zs,[a[23]||(a[23]=e("span",null,"Reads/sec: ",-1)),e("span",Hs,i(t(ie)((C=l.dashboard)==null?void 0:C.blockIO.readsPerSec)),1)]),e("p",Vs,[a[24]||(a[24]=e("span",null,"Hits/sec: ",-1)),e("span",js,i(t(ie)((D=l.dashboard)==null?void 0:D.blockIO.hitsPerSec)),1)]),e("p",Ks,[a[25]||(a[25]=e("span",null,"Total Reads: ",-1)),e("span",Us,i(t(de)((Y=l.dashboard)==null?void 0:Y.blockIO.totalReads)),1)]),e("p",Gs,[a[26]||(a[26]=e("span",null,"Total Hits: ",-1)),e("span",qs,i(t(de)((W=l.dashboard)==null?void 0:W.blockIO.totalHits)),1)])])])]),e("div",Qs,[e("div",Xs,[a[27]||(a[27]=e("p",{class:"text-sm font-medium mb-1.5"},"Sessions Timeline",-1)),e("div",Ws,[w(t(we),{option:t(b),autoresize:"",class:"insights-chart",onLegendselectchanged:c},null,8,["option"])])]),e("div",Ys,[a[28]||(a[28]=e("p",{class:"text-sm font-medium mb-1.5"},"Transactions Timeline",-1)),e("div",Js,[w(t(we),{option:t(p),autoresize:"",class:"insights-chart",onLegendselectchanged:x},null,8,["option"])])])]),e("div",Zs,[a[29]||(a[29]=e("p",{class:"text-sm font-medium mb-1.5"},"Block I/O Timeline",-1)),e("div",en,[w(t(we),{option:t(S),autoresize:"",class:"insights-chart",onLegendselectchanged:h},null,8,["option"])])])])}}}),sn=He(tn,[["__scopeId","data-v-ba36a884"]]),nn={class:"space-y-4 h-full flex flex-col overflow-auto"},on={class:"flex items-center justify-between gap-2 flex-wrap"},an={class:"h-full"},rn={class:"flex flex-col sm:flex-row sm:items-center gap-2 mb-2"},ln={class:"relative flex-1"},dn=X({__name:"InstanceInsightsConfigurationSection",props:{configuration:{},search:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},emits:["update:search"],setup(n,{emit:r}){const u=n,s=r,o=I({get:()=>u.search,set:_=>s("update:search",_)}),v=I(()=>{var _;return((_=u.configuration)==null?void 0:_.rows)||[]}),c=I(()=>v.value.map(_=>({name:_.name,category:_.category,value:_.value,unit:_.unit||"-",requires_restart:_.pendingRestart?"yes":"no",description:_.description}))),x=I(()=>_e(c.value)),h=I(()=>pe({columns:x.value,rows:c.value,columnKeyBy:"field"})),m=I(()=>fe(c.value));return(_,$)=>{const b=me,p=ce,S=Ve,l=Se;return f(),g("div",nn,[e("div",on,[$[3]||($[3]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Configuration"),e("p",{class:"text-xs text-muted-foreground"},"Searchable pg_settings")],-1)),w(p,{variant:"outline",size:"xs",disabled:_.isLoading||_.isActionLoading,class:"font-normal",onClick:$[0]||($[0]=a=>_.onRefresh())},{default:E(()=>[w(b,{name:"hugeicons:redo",class:oe(["size-4",_.isLoading&&"animate-spin"])},null,8,["class"]),$[2]||($[2]=N(" Refresh Configuration "))]),_:1},8,["disabled"])]),e("div",an,[e("div",rn,[e("div",ln,[w(b,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(S,{type:"text",placeholder:"Search setting name, category, or description...",class:"h-8 w-full pl-8 pr-3",modelValue:t(o),"onUpdate:modelValue":$[1]||($[1]=a=>le(o)?o.value=a:null)},null,8,["modelValue"])])]),w(l,{"column-defs":t(h),"row-data":t(m),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])])}}}),un={class:"space-y-4"},cn={class:"flex items-center justify-between"},mn={key:0,class:"border border-orange-300 bg-orange-50 text-orange-700 rounded-lg p-3 text-sm"},pn={class:"space-y-1.5"},fn={class:"space-y-1.5"},gn={key:1,class:"border rounded-lg p-2.5"},vn={class:"flex items-center justify-between gap-3 flex-wrap"},bn={class:"text-sm font-medium"},_n={class:"flex items-center gap-2"},hn=300,yn=120,xn=44,$n=36,Sn=X({__name:"InstanceInsightsReplicationSection",props:{replication:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onToggleSlotStatus:{type:Function},onDropSlot:{type:Function}},setup(n){const r=n,u=I(()=>{var k;return((k=r.replication)==null?void 0:k.replicationStats)||[]}),s=I(()=>{var k;return((k=r.replication)==null?void 0:k.replicationSlots)||[]}),o=B([]),v=k=>{o.value=k},c=I(()=>u.value.map(k=>({pid:k.pid,client_addr:k.clientAddr||"-",application:k.applicationName||"-",state:k.state||"-",sync_state:k.syncState||"-",reply_time:he(k.replyTime),write_lag:k.writeLag||"-",flush_lag:k.flushLag||"-",replay_lag:k.replayLag||"-"}))),x=["pid","client_addr","application","state","sync_state","reply_time","write_lag","flush_lag","replay_lag"],h=I(()=>c.value.length>0?_e(c.value):Qe(x)),m=I(()=>pe({columns:h.value,rows:c.value,columnKeyBy:"field"})),_=I(()=>fe(c.value)),$=I(()=>s.value.map(k=>({slot_name:k.slotName,slot_type:k.slotType,status:k.active?"on":"off",active_pid:k.activePid??"-",restart_lsn:k.restartLsn||"-",retained_wal:qt(k.retainedBytes),temporary:k.temporary?"yes":"no"}))),b=I(()=>_e($.value)),p=I(()=>pe({columns:b.value,rows:$.value,columnKeyBy:"field"})),S=I(()=>fe($.value)),l=k=>k<=0?yn:Math.min(hn,xn+k*$n),a=I(()=>`${l(c.value.length)}px`),d=I(()=>`${l($.value.length)}px`),T=I(()=>{var M;const k=String(((M=o.value[0])==null?void 0:M.slot_name)||"");return k&&s.value.find(z=>z.slotName===k)||null}),j=I(()=>{var k;return(k=T.value)!=null&&k.active?"off":"on"}),R=I(()=>j.value==="off"?"Turn Off Slot":"Turn On Slot"),F=k=>window.confirm(k),U=async()=>{T.value&&F(`Drop replication slot "${T.value.slotName}"? This action cannot be undone.`)&&await r.onDropSlot(T.value.slotName)},q=async()=>{T.value&&F(`Switch replication slot "${T.value.slotName}" to ${j.value.toUpperCase()} status?`)&&await r.onToggleSlotStatus({slotName:T.value.slotName,desiredStatus:j.value,activePid:T.value.activePid,slotType:T.value.slotType})};return(k,M)=>{var K;const z=me,y=ce,L=Se;return f(),g("div",un,[e("div",cn,[M[2]||(M[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Replication"),e("p",{class:"text-xs text-muted-foreground"},"Replication stats and slots")],-1)),w(y,{variant:"outline",size:"xs",disabled:k.isLoading||k.isActionLoading,class:"font-normal",onClick:M[0]||(M[0]=A=>k.onRefresh())},{default:E(()=>[w(z,{name:"hugeicons:redo",class:oe(["size-4",k.isLoading&&"animate-spin"])},null,8,["class"]),M[1]||(M[1]=N(" Refresh Replication "))]),_:1},8,["disabled"])]),(K=k.replication)!=null&&K.staleSlotWarning?(f(),g("div",mn,i(k.replication.staleSlotWarning),1)):O("",!0),e("div",pn,[M[3]||(M[3]=e("p",{class:"text-sm"},"Replication Stats",-1)),e("div",{class:"max-h-[300px] min-h-[200px]",style:Ie({height:t(a)})},[w(L,{"column-defs":t(m),"row-data":t(_),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])],4)]),e("div",fn,[M[4]||(M[4]=e("h4",{class:"text-sm font-normal"},"Replication Slots",-1)),e("div",{class:"max-h-[300px] min-h-[200px]",style:Ie({height:t(d)})},[w(L,{"column-defs":t(p),"row-data":t(S),"column-types":t(ge),"selected-rows":t(o),class:"h-full border rounded-md",onSelectionChanged:v},null,8,["column-defs","row-data","column-types","selected-rows"])],4)]),t(T)?(f(),g("div",gn,[e("div",vn,[e("p",bn," Selected Slot: "+i(t(T).slotName)+" ("+i(t(T).active?"on":"off")+") · Active PID: "+i(t(T).activePid??"-"),1),e("div",_n,[w(y,{variant:"outline",size:"sm",disabled:k.isActionLoading,onClick:q},{default:E(()=>[N(i(t(R)),1)]),_:1},8,["disabled"]),w(y,{variant:"outline",size:"sm",disabled:k.isActionLoading,onClick:U},{default:E(()=>M[5]||(M[5]=[N(" Drop Slot ")])),_:1},8,["disabled"])])])])):O("",!0)])}}}),wn={class:"space-y-4"},kn={class:"flex items-center justify-between"},In={class:"space-y-1.5"},Cn={class:"h-[360px]"},Tn={key:0,class:"border rounded-lg p-2.5 space-y-2"},Ln={class:"flex items-center justify-between gap-3 flex-wrap"},Rn={class:"text-sm font-medium"},An={class:"flex gap-2"},Pn=["innerHTML"],Bn={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Dn={class:"space-y-1.5"},En={class:"h-[300px]"},Nn={class:"space-y-1.5"},Mn={class:"h-[300px]"},On=X({__name:"InstanceInsightsStateSection",props:{state:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onCancelQuery:{type:Function},onTerminateConnection:{type:Function}},setup(n){const r=n,{highlightSql:u}=Ct(),s=I(()=>{var y;return((y=r.state)==null?void 0:y.sessions)||[]}),o=I(()=>{var y;return((y=r.state)==null?void 0:y.locks)||[]}),v=I(()=>{var y;return((y=r.state)==null?void 0:y.preparedTransactions)||[]}),c=B([]),x=y=>{c.value=y},h=I(()=>s.value.map(y=>({pid:y.pid,user:y.user,application:y.application||"-",client:y.client||"-",state:y.state||"-",wait_event:y.waitEvent||"-",blocking_pids:y.blockingPids.length?y.blockingPids.join(", "):"-",backend_start:he(y.backendStart),transaction_start:he(y.transactionStart),query_duration:We(y.durationSeconds),sql:Qt(y.sql)}))),m=I(()=>_e(h.value)),_=I(()=>pe({columns:m.value,rows:h.value,columnKeyBy:"field",getCellClass:q})),$=I(()=>fe(h.value)),b=I(()=>o.value.map(y=>({lock_type:y.lockType,target_relation:y.targetRelation||"-",mode:y.mode,granted:y.granted?"yes":"no",pid:y.pid??"-",user:y.user||"-",state:y.state||"-"}))),p=I(()=>_e(b.value)),S=I(()=>pe({columns:p.value,rows:b.value,columnKeyBy:"field"})),l=I(()=>fe(b.value)),a=I(()=>v.value.map(y=>({gid:y.gid,transaction:y.transaction,prepared:he(y.prepared),owner:y.owner,database:y.database}))),d=I(()=>_e(a.value)),T=I(()=>pe({columns:d.value,rows:a.value,columnKeyBy:"field"})),j=I(()=>fe(a.value)),R=I(()=>{var L;const y=Number(((L=c.value[0])==null?void 0:L.pid)||0);return y&&s.value.find(K=>K.pid===y)||null}),F=y=>{if(!y||!y.trim())return"<pre><code>-</code></pre>";const L=y.replace(/\s+/g," ").trim(),K=L.length>900?`${L.slice(0,900)} ...`:L;return u(K)},U=I(()=>{var y;return F(((y=R.value)==null?void 0:y.sql)||null)}),q=(y,L)=>{const K=String(L.state||"");return Xt(K)?"insights-danger-cell":void 0},k=y=>window.confirm(y),M=async()=>{R.value&&k(`Cancel query for PID ${R.value.pid}?`)&&await r.onCancelQuery(R.value.pid)},z=async()=>{R.value&&k(`Terminate connection for PID ${R.value.pid}?`)&&await r.onTerminateConnection(R.value.pid)};return(y,L)=>{const K=me,A=ce,P=Se;return f(),g("div",wn,[e("div",kn,[L[2]||(L[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"State"),e("p",{class:"text-xs text-muted-foreground"}," Active sessions, locks, prepared transactions ")],-1)),w(A,{variant:"outline",size:"xs",disabled:y.isLoading||y.isActionLoading,class:"font-normal",onClick:L[0]||(L[0]=Q=>y.onRefresh())},{default:E(()=>[w(K,{name:"hugeicons:redo",class:oe(["size-4",y.isLoading&&"animate-spin"])},null,8,["class"]),L[1]||(L[1]=N(" Refresh State "))]),_:1},8,["disabled"])]),e("div",In,[L[3]||(L[3]=e("h4",{class:"text-sm font-normal"},"Active Sessions",-1)),e("div",Cn,[w(P,{"column-defs":t(_),"row-data":t($),"column-types":t(ge),"selected-rows":t(c),class:"h-full border rounded-md",onSelectionChanged:x},null,8,["column-defs","row-data","column-types","selected-rows"])])]),t(R)?(f(),g("div",Tn,[e("div",Ln,[e("p",Rn," Selected PID: "+i(t(R).pid)+" ("+i(t(R).state||"-")+") ",1),e("div",An,[w(A,{variant:"outline",size:"sm",disabled:y.isActionLoading,onClick:M},{default:E(()=>L[4]||(L[4]=[N(" Cancel Query ")])),_:1},8,["disabled"]),w(A,{variant:"outline",size:"sm",disabled:y.isActionLoading,onClick:z},{default:E(()=>L[5]||(L[5]=[N(" Terminate Connection ")])),_:1},8,["disabled"])])]),e("div",null,[L[6]||(L[6]=e("p",{class:"text-xs text-muted-foreground mb-1"},"SQL Preview",-1)),e("div",{class:"sql-preview border rounded-md overflow-hidden",innerHTML:t(U)},null,8,Pn)])])):O("",!0),e("div",Bn,[e("div",Dn,[L[7]||(L[7]=e("h4",{class:"text-sm font-normal"},"Locks",-1)),e("div",En,[w(P,{"column-defs":t(S),"row-data":t(l),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])]),e("div",Nn,[L[8]||(L[8]=e("h4",{class:"text-sm font-normal"},"Prepared Transactions",-1)),e("div",Mn,[w(P,{"column-defs":t(T),"row-data":t(j),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])])])])}}}),Fn=He(On,[["__scopeId","data-v-07dc1849"]]),zn=5e3;function Hn(n){const r=B("activity"),u=B(!0),s=B(zn),o=B(null),v=B(!1),c=B(!1),x=B(!1),h=B(!1),m=B(!1),_=B(!1),$=B(null),b=B(null),p=B(null),S=B(null),l=B(""),a=Je(l,350),d=I(()=>!!n.value),T=B(!0);Ce(()=>{T.value=!1}),Te(()=>{T.value=!0});const j=()=>{o.value=null,$.value=null,b.value=null,p.value=null,S.value=null},R=async(C,D)=>{var Y;try{return o.value=null,await C()}catch(W){const ye=((Y=W==null?void 0:W.data)==null?void 0:Y.message)||(W==null?void 0:W.message)||(W==null?void 0:W.statusMessage)||D;return o.value=ye,null}},F=async(C={})=>{if(!d.value)return null;C.silent||(x.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/dashboard",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch activity dashboard");return D&&($.value=D),C.silent||(x.value=!1),D},U=async(C={})=>{if(!d.value)return null;C.silent||(h.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/state",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch active sessions and locks");return D&&(b.value=D),C.silent||(h.value=!1),D},q=async(C={})=>{if(!d.value)return null;C.silent||(m.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/configuration",{method:"POST",body:{...ne(n.value),search:a.value||void 0}}),"Failed to fetch PostgreSQL settings");return D&&(p.value=D),C.silent||(m.value=!1),D},k=async(C={})=>{if(!d.value)return null;C.silent||(_.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/replication",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch replication status");return D&&(S.value=D),C.silent||(_.value=!1),D},M=async(C=r.value,D={})=>{switch(C){case"activity":await F(D);break;case"state":await Promise.all([F({silent:!0}),U(D)]);break;case"configuration":await Promise.all([F({silent:!0}),q(D)]);break;case"replication":await Promise.all([F({silent:!0}),k(D)]);break;default:await F(D);break}},z=async(C={})=>{await Promise.all([F(C),U(C),q(C),k(C)])},y=async(C,D)=>{if(!d.value)return!1;c.value=!0;const Y=await R(C,"Action failed");return c.value=!1,Y?(Y.success?be(D,{description:Y.message}):be(Y.message,{description:"The server did not complete this action."}),Y.success):(be(o.value||"Action failed",{description:"Check database permissions and try again."}),!1)},L=async C=>{await y(async()=>await $fetch("/api/instance-insights/cancel-query",{method:"POST",body:{...ne(n.value),pid:C}}),`Cancelled query for PID ${C}`)&&await U({silent:!0})},K=async C=>{await y(async()=>await $fetch("/api/instance-insights/terminate-connection",{method:"POST",body:{...ne(n.value),pid:C}}),`Terminated connection for PID ${C}`)&&(await U({silent:!0}),await F({silent:!0}))},A=async C=>{await y(async()=>await $fetch("/api/instance-insights/drop-slot",{method:"POST",body:{...ne(n.value),slotName:C}}),`Dropped replication slot "${C}"`)&&await k({silent:!0})},P=async C=>{await y(async()=>await $fetch("/api/instance-insights/toggle-slot-status",{method:"POST",body:{...ne(n.value),slotName:C.slotName,desiredStatus:C.desiredStatus,activePid:C.activePid??null,slotType:C.slotType??null}}),`Turned ${C.desiredStatus} slot "${C.slotName}"`)&&await k({silent:!0})},Q=async()=>{if(!d.value){j();return}v.value=!0,await z(),v.value=!1};re(()=>n.value,async C=>{if(!C){j();return}await Q()},{immediate:!0}),re(()=>a.value,async()=>{r.value!=="configuration"||!d.value||await q({silent:!0})}),re(()=>r.value,async C=>{d.value&&(C==="state"&&!b.value&&await U(),C==="configuration"&&!p.value&&await q(),C==="replication"&&!S.value&&await k())});const{pause:Z,resume:ae,isActive:ve}=Le(async()=>{!d.value||!T.value||await M(r.value,{silent:!0})},s,{immediate:!1});return re(()=>u.value,C=>{C?ae():Z()},{immediate:!0}),{activeSection:r,autoRefresh:u,isAutoRefreshRunning:ve,error:o,isInitialLoading:v,isActionLoading:c,isDashboardLoading:x,isStateLoading:h,isConfigurationLoading:m,isReplicationLoading:_,dashboard:$,state:b,configuration:p,replication:S,configurationSearch:l,refreshSection:M,refreshAll:z,fetchDashboard:F,fetchState:U,fetchConfiguration:q,fetchReplication:k,cancelQuery:L,terminateConnection:K,dropReplicationSlot:A,toggleReplicationSlotStatus:P}}const Vn={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},jn={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Kn={class:"space-y-1"},Un={class:"flex items-center gap-2"},Gn={class:"text-sm text-muted-foreground flex items-center gap-0.5"},qn={class:"flex items-center gap-0.5"},Qn={class:"font-medium text-foreground"},Xn={key:0,class:"flex items-center gap-1.5 mt-0.5"},Wn={class:"flex items-center gap-2 flex-wrap"},Yn={class:"text-xs flex items-center gap-2"},Jn={class:"flex items-center justify-between gap-2"},Zn={class:"text-xs text-muted-foreground"},eo={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},to={key:1,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},so={key:2,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},no=X({__name:"InstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const r=[{id:"activity",tabLabel:"Activity",subtitle:"Sessions, TPS, tuples and block I/O",icon:"hugeicons:artificial-intelligence-08"},{id:"state",tabLabel:"State",subtitle:"Active sessions, locks, prepared transactions",icon:"hugeicons:shield-01"},{id:"configuration",tabLabel:"Config",subtitle:"Searchable pg_settings",icon:"hugeicons:settings-01"},{id:"replication",tabLabel:"Replication",subtitle:"Replication stats and slots",icon:"hugeicons:database"}],u=$e(),s=I(()=>u.selectedConnection),{activeSection:o,autoRefresh:v,error:c,isInitialLoading:x,isActionLoading:h,isDashboardLoading:m,isStateLoading:_,isConfigurationLoading:$,isReplicationLoading:b,dashboard:p,state:S,configuration:l,replication:a,configurationSearch:d,refreshSection:T,refreshAll:j,cancelQuery:R,terminateConnection:F,dropReplicationSlot:U,toggleReplicationSlotStatus:q}=Hn(s);I(()=>r.find(A=>A.id===o.value));const k=I(()=>{var A,P,Q,Z;return o.value==="activity"?(A=p.value)==null?void 0:A.capturedAt:o.value==="state"?(P=S.value)==null?void 0:P.capturedAt:o.value==="configuration"?(Q=l.value)==null?void 0:Q.capturedAt:(Z=a.value)==null?void 0:Z.capturedAt}),M=()=>T("activity"),z=()=>T("state"),y=()=>T("configuration"),L=()=>T("replication"),K=A=>q(A);return(A,P)=>{var W,ye;const Q=me,Z=xe,ae=Ae,ve=ce,C=De,D=Be,Y=Pe;return f(),g("div",Vn,[e("div",jn,[e("div",Kn,[e("div",Un,[w(Q,{name:"hugeicons:database",class:"size-5 text-primary"}),P[4]||(P[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",Gn,[P[5]||(P[5]=N(" connection: ")),e("div",qn,[A.dbType?(f(),J(Re((W=t(Ke)(A.dbType))==null?void 0:W.icon),{key:0,class:"size-4!"})):O("",!0),e("span",Qn,i(A.databaseName),1)])]),(ye=t(p))!=null&&ye.version?(f(),g("div",Xn,[w(Z,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[N(" PostgreSQL "+i(t(p).version),1)]),_:1})])):O("",!0)]),e("div",Wn,[e("div",Yn,[w(ae,{id:"insights-auto-refresh","model-value":t(v),"onUpdate:modelValue":P[0]||(P[0]=ee=>le(v)?v.value=ee:null),class:"cursor-pointer"},null,8,["model-value"]),P[6]||(P[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(ve,{variant:"outline",size:"sm",disabled:t(x)||t(h),onClick:P[1]||(P[1]=ee=>t(j)()),class:"font-normal"},{default:E(()=>[w(Q,{name:"hugeicons:redo",class:"size-4"}),P[7]||(P[7]=N(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Jn,[w(Y,{modelValue:t(o),"onUpdate:modelValue":P[2]||(P[2]=ee=>le(o)?o.value=ee:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[w(D,{size:"sm",class:"max-w-full overflow-x-auto justify-start!"},{default:E(()=>[(f(),g(H,null,V(r,ee=>w(C,{size:"xs",key:ee.id,value:ee.id,class:"rounded-sm cursor-pointer min-w-fit shrink-0",onClick:gr=>t(T)(ee.id,{silent:!0})},{default:E(()=>[w(Q,{name:ee.icon,class:"size-3.5!"},null,8,["name"]),N(" "+i(ee.tabLabel),1)]),_:2},1032,["value","onClick"])),64))]),_:1})]),_:1},8,["modelValue"]),e("div",Zn," Last updated: "+i(t(he)(t(k))),1)]),t(c)?(f(),g("div",eo,i(t(c)),1)):O("",!0),t(x)&&!t(p)?(f(),g("div",to,[w(Q,{name:"hugeicons:redo",class:"size-4 animate-spin"}),P[8]||(P[8]=N(" Loading instance insights... "))])):(f(),g("div",so,[te(w(sn,{dashboard:t(p),isLoading:t(m),isActionLoading:t(h),onRefresh:M},null,8,["dashboard","isLoading","isActionLoading"]),[[se,t(o)==="activity"]]),te(w(Fn,{state:t(S),isLoading:t(_),isActionLoading:t(h),onRefresh:z,onCancelQuery:t(R),onTerminateConnection:t(F)},null,8,["state","isLoading","isActionLoading","onCancelQuery","onTerminateConnection"]),[[se,t(o)==="state"]]),te(w(dn,{search:t(d),"onUpdate:search":P[3]||(P[3]=ee=>le(d)?d.value=ee:null),configuration:t(l),isLoading:t($),isActionLoading:t(h),onRefresh:y},null,8,["search","configuration","isLoading","isActionLoading"]),[[se,t(o)==="configuration"]]),te(w(Sn,{replication:t(a),isLoading:t(b),isActionLoading:t(h),onRefresh:L,onDropSlot:t(U),onToggleSlotStatus:K},null,8,["replication","isLoading","isActionLoading","onDropSlot"]),[[se,t(o)==="replication"]])]))])}}}),oo={key:0,class:"space-y-4"},ao={class:"flex items-start justify-between gap-3 flex-wrap"},io={class:"text-sm font-medium"},ro={class:"text-xs text-muted-foreground"},lo={key:1,class:"flex gap-2 flex-wrap"},uo={key:2,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},co={class:"text-xs uppercase text-muted-foreground"},mo={class:"text-sm font-semibold leading-none tabular-nums"},po={key:0,class:"text-[11px] text-muted-foreground"},fo={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2.5"},go={class:"text-xs uppercase text-muted-foreground"},vo={class:"text-sm font-medium leading-tight break-words"},bo={key:0,class:"text-[11px] text-muted-foreground"},_o={key:4,class:"space-y-2"},ho={class:"font-medium"},yo={class:"text-xs mt-1"},xo={class:"text-sm font-normal"},$o={key:0,class:"text-xs text-muted-foreground"},So={key:0,class:"text-xs text-muted-foreground"},wo=360,ko=120,Io=44,Co=36,To=X({__name:"InstanceInsightsSectionRenderer",props:{section:{},search:{}},setup(n){const r=n,u=I(()=>{var m;return((m=r.search)==null?void 0:m.trim().toLowerCase())||""}),s=I(()=>r.section?!r.section.searchable||!u.value?r.section.tables||[]:(r.section.tables||[]).map(m=>({...m,rows:m.rows.filter(_=>Object.values(_).some($=>String($??"").toLowerCase().includes(u.value)))})):[]),o=m=>m<=0?ko:Math.min(wo,Io+m*Co),v=m=>m==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":m==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700",c=m=>m==="success"?"border-emerald-200 bg-emerald-50":m==="warning"?"border-amber-200 bg-amber-50":m==="danger"?"border-red-200 bg-red-50":m==="info"?"border-sky-200 bg-sky-50":"border-border bg-background",x=m=>m==="unsupported"?"border-amber-300 bg-amber-50 text-amber-700":m==="unavailable"?"border-red-300 bg-red-50 text-red-700":"border-emerald-300 bg-emerald-50 text-emerald-700",h=m=>m==="pass"?"border-emerald-200 bg-emerald-50 text-emerald-700":m==="warn"?"border-amber-200 bg-amber-50 text-amber-700":m==="fail"?"border-red-200 bg-red-50 text-red-700":"border-sky-200 bg-sky-50 text-sky-700";return(m,_)=>{var p,S,l,a;const $=xe,b=Se;return m.section?(f(),g("div",oo,[e("div",ao,[e("div",null,[e("h3",io,i(m.section.title),1),e("p",ro,i(m.section.subtitle),1)]),w($,{class:oe(x(m.section.status)),variant:"outline"},{default:E(()=>[N(i(m.section.status),1)]),_:1},8,["class"])]),m.section.statusMessage?(f(),g("div",{key:0,class:oe(["border rounded-lg p-3 text-sm",x(m.section.status)])},i(m.section.statusMessage),3)):O("",!0),(p=m.section.actions)!=null&&p.length?(f(),g("div",lo,[(f(!0),g(H,null,V(m.section.actions,d=>(f(),J($,{key:d.id,class:oe(v(d.state)),variant:"outline"},{default:E(()=>[N(i(d.label)+" · "+i(d.state),1)]),_:2},1032,["class"]))),128))])):O("",!0),(S=m.section.cards)!=null&&S.length?(f(),g("div",uo,[(f(!0),g(H,null,V(m.section.cards,d=>(f(),g("div",{key:d.id,class:oe(["h-full border rounded-lg p-2.5 space-y-1.5",c(d.tone)])},[e("p",co,i(d.label),1),e("p",mo,i(d.value),1),d.helperText?(f(),g("p",po,i(d.helperText),1)):O("",!0)],2))),128))])):O("",!0),(l=m.section.details)!=null&&l.length?(f(),g("div",fo,[(f(!0),g(H,null,V(m.section.details,d=>(f(),g("div",{key:`${d.label}-${d.value}`,class:oe(["border rounded-lg p-2.5 space-y-1",c(d.tone)])},[e("p",go,i(d.label),1),e("p",vo,i(d.value),1),d.helperText?(f(),g("p",bo,i(d.helperText),1)):O("",!0)],2))),128))])):O("",!0),(a=m.section.checks)!=null&&a.length?(f(),g("div",_o,[(f(!0),g(H,null,V(m.section.checks,d=>(f(),g("div",{key:d.id,class:oe(["border rounded-lg p-3 text-sm",h(d.status)])},[e("p",ho,i(d.label),1),e("p",yo,i(d.detail),1)],2))),128))])):O("",!0),(f(!0),g(H,null,V(t(s),d=>(f(),g("div",{key:d.id,class:"space-y-1.5"},[e("div",null,[e("h4",xo,i(d.title),1),d.description?(f(),g("p",$o,i(d.description),1)):O("",!0)]),e("div",{class:"max-h-[360px]",style:Ie({height:`${o(d.rows.length)}px`})},[w(b,{"column-defs":t(pe)({columns:t(Qe)(d.columns.map(T=>T.key)),rows:d.rows,columnKeyBy:"field"}),"row-data":t(fe)(d.rows),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])],4),d.emptyMessage&&d.rows.length===0?(f(),g("p",So,i(d.emptyMessage),1)):O("",!0)]))),128))])):O("",!0)}}}),Lo=5e3;function Ro(n){const r=B(null),u=B("overview"),s=B(!0),o=B(""),v=B(null),c=B(!1),x=B(!1),h=I(()=>!!n.value),m=B(!0);Ce(()=>{m.value=!1}),Te(()=>{m.value=!0});const _=()=>{v.value=null,r.value=null,o.value="",u.value="overview"},$=async(d={})=>{var T,j;if(!h.value)return _(),null;d.silent||(x.value=!0);try{v.value=null;const R=await $fetch("/api/instance-insights/view",{method:"POST",body:{...ne(n.value)}});return r.value=R,R.sections.some(F=>F.id===u.value)||(u.value=((T=R.sections[0])==null?void 0:T.id)||"overview"),R}catch(R){const F=((j=R==null?void 0:R.data)==null?void 0:j.message)||(R==null?void 0:R.message)||(R==null?void 0:R.statusMessage)||"Failed to fetch instance insights";return v.value=F,null}finally{d.silent||(x.value=!1)}},b=async(d=u.value,T={})=>$(T),p=async(d={})=>$(d),S=async()=>{if(!h.value){_();return}c.value=!0,await $(),c.value=!1};re(()=>n.value,async d=>{if(!d){_();return}await S()},{immediate:!0});const{pause:l,resume:a}=Le(async()=>{!h.value||!m.value||await $({silent:!0})},Lo,{immediate:!1});return re(()=>s.value,d=>{d?a():l()},{immediate:!0}),{view:r,activeSection:u,autoRefresh:s,configurationSearch:o,error:v,isInitialLoading:c,isViewLoading:x,refreshSection:b,refreshAll:p}}const Ao={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Po={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Bo={class:"space-y-2"},Do={class:"space-y-1"},Eo={class:"flex items-center gap-2"},No={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Mo={class:"flex items-center gap-0.5"},Oo={class:"font-medium text-foreground"},Fo={key:0,class:"flex items-center gap-1.5 mt-0.5"},zo={key:0,class:"flex gap-2 flex-wrap"},Ho={class:"flex items-center gap-2 flex-wrap"},Vo={class:"text-xs flex items-center gap-2"},jo={class:"flex items-center justify-between gap-2"},Ko={class:"text-xs text-muted-foreground"},Uo={key:0,class:"border rounded-lg p-3 bg-background"},Go={class:"relative"},qo={key:1,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Qo={key:2,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Xo={key:3,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},Wo=X({__name:"MultiDbInstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const r=$e(),{selectedConnection:u}=je(r),{view:s,activeSection:o,autoRefresh:v,configurationSearch:c,error:x,isInitialLoading:h,isViewLoading:m,refreshSection:_,refreshAll:$}=Ro(u),b=I(()=>{var l;return((l=s.value)==null?void 0:l.sections.find(a=>a.id===o.value))||null}),p=I(()=>{var l,a;return((l=b.value)==null?void 0:l.capturedAt)||((a=s.value)==null?void 0:a.capturedAt)||null}),S=l=>l==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":l==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700";return(l,a)=>{var M,z,y,L,K;const d=me,T=xe,j=Ae,R=ce,F=De,U=Be,q=Pe,k=Ve;return f(),g("div",Ao,[e("div",Po,[e("div",Bo,[e("div",Do,[e("div",Eo,[w(d,{name:"hugeicons:database",class:"size-5 text-primary"}),a[4]||(a[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",No,[a[5]||(a[5]=N(" connection: ")),e("div",Mo,[l.dbType?(f(),J(Re((M=t(Ke)(l.dbType))==null?void 0:M.icon),{key:0,class:"size-4!"})):O("",!0),e("span",Oo,i(l.databaseName),1)])]),(z=t(s))!=null&&z.version?(f(),g("div",Fo,[w(T,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[N(i(l.dbType===t(ue).MARIADB?"MariaDB":l.dbType===t(ue).ORACLE?"Oracle":l.dbType===t(ue).SQLITE3?"SQLite":"MySQL")+" "+i(t(s).version),1)]),_:1})])):O("",!0)]),(L=(y=t(s))==null?void 0:y.actions)!=null&&L.length?(f(),g("div",zo,[(f(!0),g(H,null,V(t(s).actions,A=>(f(),J(T,{key:A.id,class:oe(S(A.state)),variant:"outline"},{default:E(()=>[N(i(A.label)+" · "+i(A.state),1)]),_:2},1032,["class"]))),128))])):O("",!0)]),e("div",Ho,[e("div",Vo,[w(j,{id:"insights-auto-refresh","model-value":t(v),"onUpdate:modelValue":a[0]||(a[0]=A=>le(v)?v.value=A:null),class:"cursor-pointer"},null,8,["model-value"]),a[6]||(a[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(R,{variant:"outline",size:"sm",disabled:t(h)||t(m),class:"font-normal",onClick:a[1]||(a[1]=A=>t($)())},{default:E(()=>[w(d,{name:"hugeicons:redo",class:"size-4"}),a[7]||(a[7]=N(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",jo,[w(q,{modelValue:t(o),"onUpdate:modelValue":a[2]||(a[2]=A=>le(o)?o.value=A:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[w(U,{size:"sm",class:"max-w-full overflow-x-auto justify-start!"},{default:E(()=>{var A;return[(f(!0),g(H,null,V(((A=t(s))==null?void 0:A.sections)||[],P=>(f(),J(F,{size:"xs",key:P.id,value:P.id,class:"rounded-sm cursor-pointer min-w-fit shrink-0",onClick:Q=>t(_)(P.id,{silent:!0})},{default:E(()=>[N(i(P.title),1)]),_:2},1032,["value","onClick"]))),128))]}),_:1})]),_:1},8,["modelValue"]),e("div",Ko," Last updated: "+i(t(he)(t(p))),1)]),(K=t(b))!=null&&K.searchable?(f(),g("div",Uo,[e("div",Go,[w(d,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(k,{modelValue:t(c),"onUpdate:modelValue":a[3]||(a[3]=A=>le(c)?c.value=A:null),type:"text",placeholder:t(b).searchPlaceholder||"Search...",class:"h-8 w-full pl-8 pr-3"},null,8,["modelValue","placeholder"])])])):O("",!0),t(x)?(f(),g("div",qo,i(t(x)),1)):O("",!0),t(h)&&!t(s)?(f(),g("div",Qo,[w(d,{name:"hugeicons:redo",class:"size-4 animate-spin"}),a[8]||(a[8]=N(" Loading instance insights... "))])):(f(),g("div",Xo,[w(To,{section:t(b),search:t(c)},null,8,["section","search"])]))])}}}),Yo={class:"space-y-4"},Jo={class:"grid gap-3 md:grid-cols-2"},Zo={class:"rounded-lg border p-3"},ea={class:"mt-1 text-lg font-medium"},ta={class:"rounded-lg border p-3"},sa={class:"mt-1 text-lg font-medium"},na={key:0,class:"rounded-lg border p-3"},oa={class:"mt-3 space-y-2 text-xs"},aa={class:"rounded-lg border p-3"},ia={class:"mt-3 space-y-2 text-xs"},ra={class:"flex items-start justify-between gap-3"},la={class:"font-medium"},da={class:"text-muted-foreground"},ua={class:"text-muted-foreground"},ca=X({__name:"RedisClientsSection",props:{clients:{},isActionLoading:{type:Boolean}},emits:["kill-client"],setup(n,{emit:r}){const u=r,s=new Intl.NumberFormat;function o(v){return v==null||v===""?"0":s.format(Number(v))}return(v,c)=>{var h,m,_,$,b;const x=ce;return f(),g("div",Yo,[e("div",Jo,[e("div",Zo,[c[0]||(c[0]=e("p",{class:"text-xs text-muted-foreground"},"Connected clients",-1)),e("p",ea,i(o((h=v.clients)==null?void 0:h.connectedClients)),1)]),e("div",ta,[c[1]||(c[1]=e("p",{class:"text-xs text-muted-foreground"},"Suspicious clients",-1)),e("p",sa,i(o((((m=v.clients)==null?void 0:m.suspiciousClients)||[]).length)),1)])]),(((_=v.clients)==null?void 0:_.suspiciousClients)||[]).length?(f(),g("div",na,[c[2]||(c[2]=e("h3",{class:"text-sm font-medium"},"Suspicious clients",-1)),e("div",oa,[(f(!0),g(H,null,V((($=v.clients)==null?void 0:$.suspiciousClients)||[],p=>(f(),g("div",{key:`${p.clientId}-${p.reason}`,class:"rounded-md bg-muted/20 px-3 py-2"},i(p.reason),1))),128))])])):O("",!0),e("div",aa,[c[4]||(c[4]=e("h3",{class:"text-sm font-medium"},"Client list",-1)),e("div",ia,[(f(!0),g(H,null,V(((b=v.clients)==null?void 0:b.clients)||[],p=>(f(),g("div",{key:p.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",ra,[e("div",null,[e("p",la,i(p.addr),1),e("p",da,i(p.name)+" · db "+i(p.db)+" · "+i(p.cmd),1),e("p",ua," age "+i(o(p.ageSeconds))+"s · idle "+i(o(p.idleSeconds))+"s ",1)]),w(x,{size:"sm",variant:"outline",disabled:v.isActionLoading,onClick:S=>u("kill-client",p.id)},{default:E(()=>c[3]||(c[3]=[N(" Kill client ")])),_:2},1032,["disabled","onClick"])])]))),128))])])])}}}),ma={class:"space-y-2"},pa={class:"text-muted-foreground"},fa=X({__name:"RedisConfigSection",props:{config:{}},setup(n){return(r,u)=>(f(),g("div",ma,[(f(!0),g(H,null,V(r.config||[],s=>(f(),g("div",{key:s.name,class:"flex items-center justify-between rounded-md border px-3 py-2 text-sm"},[e("span",null,i(s.name),1),e("span",pa,i(s.value||"not set"),1)]))),128))]))}}),ga={class:"space-y-4"},va={class:"grid gap-3 md:grid-cols-4"},ba={class:"rounded-lg border p-3"},_a={class:"mt-1 text-lg font-medium"},ha={class:"rounded-lg border p-3"},ya={class:"mt-1 text-lg font-medium"},xa={class:"rounded-lg border p-3"},$a={class:"mt-1 text-lg font-medium"},Sa={class:"rounded-lg border p-3"},wa={class:"mt-1 text-lg font-medium"},ka={class:"grid gap-4 lg:grid-cols-2"},Ia={class:"rounded-lg border p-3"},Ca={class:"mt-3 space-y-2 text-sm"},Ta={class:"text-muted-foreground"},La={class:"rounded-lg border p-3"},Ra={class:"mt-3 space-y-2 text-sm"},Aa={class:"text-muted-foreground"},Pa={class:"rounded-lg border p-3"},Ba={class:"mt-3 flex flex-wrap gap-2"},Da={class:"mt-3 text-xs text-muted-foreground"},Ea=X({__name:"RedisKeyspaceSection",props:{keyspace:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var c,x,h,m,_,$,b,p;const v=xe;return f(),g("div",ga,[e("div",va,[e("div",ba,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Expired key count",-1)),e("p",_a,i(u((c=s.keyspace)==null?void 0:c.expiredKeyCount)),1)]),e("div",ha,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Avg TTL",-1)),e("p",ya,i(u((x=s.keyspace)==null?void 0:x.avgTtl)),1)]),e("div",xa,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Keys without TTL",-1)),e("p",$a,i(u((h=s.keyspace)==null?void 0:h.keysWithoutTtl)),1)]),e("div",Sa,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Sampled keys",-1)),e("p",wa,i(u((m=s.keyspace)==null?void 0:m.sampledKeys)),1)])]),e("div",ka,[e("div",Ia,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Databases",-1)),e("div",Ca,[(f(!0),g(H,null,V(((_=s.keyspace)==null?void 0:_.databases)||[],S=>(f(),g("div",{key:S.database,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(S.database),1),e("span",Ta,i(u(S.keyCount))+" keys · "+i(u(S.expires))+" expiring · avg TTL "+i(u(S.avgTtl)),1)]))),128))])]),e("div",La,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Top prefixes",-1)),e("div",Ra,[(f(!0),g(H,null,V((($=s.keyspace)==null?void 0:$.topPrefixes)||[],S=>(f(),g("div",{key:S.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(S.prefix),1),e("span",Aa,i(u(S.keyCount))+" keys ",1)]))),128))])])]),e("div",Pa,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Key type distribution",-1)),e("div",Ba,[(f(!0),g(H,null,V(((b=s.keyspace)==null?void 0:b.keyTypeDistribution)||[],S=>(f(),J(v,{key:S.type,variant:"outline"},{default:E(()=>[N(i(S.type)+" · "+i(u(S.count)),1)]),_:2},1024))),128))]),e("p",Da,i((p=s.keyspace)==null?void 0:p.hotKeysNote),1)])])}}}),Na={class:"space-y-4"},Ma={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Oa={class:"rounded-lg border p-3"},Fa={class:"mt-1 text-lg font-medium"},za={class:"rounded-lg border p-3"},Ha={class:"mt-1 text-lg font-medium"},Va={class:"rounded-lg border p-3"},ja={class:"mt-1 text-lg font-medium"},Ka={class:"rounded-lg border p-3"},Ua={class:"mt-1 text-lg font-medium"},Ga={class:"grid gap-4 lg:grid-cols-2"},qa={class:"rounded-lg border p-3"},Qa={class:"mt-3 space-y-2 text-sm"},Xa={class:"text-muted-foreground"},Wa={class:"rounded-lg border p-3"},Ya={class:"mt-3 space-y-2 text-sm"},Ja={class:"flex items-center justify-between gap-2"},Za={class:"truncate"},ei={class:"mt-1 text-xs text-muted-foreground"},ti=X({__name:"RedisMemorySection",props:{memory:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var x,h,m,_,$,b,p,S;const v=Ee,c=xe;return f(),g("div",Na,[e("div",Ma,[e("div",Oa,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Used memory",-1)),e("p",Fa,i((x=s.memory)==null?void 0:x.usedMemoryHuman),1)]),e("div",za,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Peak memory",-1)),e("p",Ha,i((h=s.memory)==null?void 0:h.usedMemoryPeakHuman),1)]),e("div",Va,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Fragmentation",-1)),e("p",ja,i((m=s.memory)==null?void 0:m.memoryFragmentationRatio.toFixed(2)),1)]),e("div",Ka,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Maxmemory / policy",-1)),e("p",Ua,i((_=s.memory)==null?void 0:_.maxmemoryHuman)+" · "+i(($=s.memory)==null?void 0:$.maxmemoryPolicy),1)])]),(f(!0),g(H,null,V(((b=s.memory)==null?void 0:b.warnings)||[],l=>(f(),J(v,{key:l,variant:"secondary"},{default:E(()=>[N(i(l),1)]),_:2},1024))),128)),e("div",Ga,[e("div",qa,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Top prefixes by memory",-1)),e("div",Qa,[(f(!0),g(H,null,V(((p=s.memory)==null?void 0:p.topPrefixesByMemory)||[],l=>(f(),g("div",{key:l.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(l.prefix),1),e("span",Xa,i(u(l.keyCount))+" keys · "+i(u(l.memoryBytes))+" B ",1)]))),128))])]),e("div",Wa,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Big keys detector",-1)),e("div",Ya,[(f(!0),g(H,null,V(((S=s.memory)==null?void 0:S.bigKeys)||[],l=>(f(),g("div",{key:l.key,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",Ja,[e("span",Za,i(l.key),1),w(c,{variant:"outline"},{default:E(()=>[N(i(l.type),1)]),_:2},1024)]),e("p",ei," TTL "+i(l.ttl>=0?l.ttl:"persisted")+" · "+i(u(l.memoryBytes))+" B ",1)]))),128))])])])])}}}),si={class:"space-y-4"},ni={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},oi={class:"text-xs text-muted-foreground"},ai={class:"mt-1 text-lg font-medium"},ii=X({__name:"RedisOverviewSection",props:{overview:{}},setup(n){const r=n,u=new Intl.NumberFormat;function s(c){return c==null||c===""?"0":u.format(Number(c))}function o(c){return`${(c*100).toFixed(1)}%`}const v=I(()=>{const c=r.overview;return c?[{label:"Redis version",value:c.redisVersion},{label:"Mode",value:c.mode},{label:"Uptime",value:We(c.uptimeSeconds)},{label:"Connected clients",value:s(c.connectedClients)},{label:"Used memory",value:c.usedMemoryHuman},{label:"Total keys",value:s(c.totalKeys)},{label:"Hit rate",value:o(c.hitRate)},{label:"Ops/sec",value:s(c.opsPerSec)},{label:"Evicted keys",value:s(c.evictedKeys)},{label:"Expired keys",value:s(c.expiredKeys)},{label:"Rejected connections",value:s(c.rejectedConnections)}]:[]});return(c,x)=>(f(),g("div",si,[e("div",ni,[(f(!0),g(H,null,V(t(v),h=>(f(),g("div",{key:h.label,class:"rounded-lg border p-3"},[e("p",oi,i(h.label),1),e("p",ai,i(h.value),1)]))),128))])]))}}),ri={class:"space-y-4"},li={class:"grid gap-3 md:grid-cols-3"},di={class:"rounded-lg border p-3"},ui={class:"mt-1 text-lg font-medium"},ci={class:"rounded-lg border p-3"},mi={class:"mt-1 text-lg font-medium"},pi={class:"rounded-lg border p-3"},fi={class:"mt-1 text-lg font-medium"},gi={class:"rounded-lg border p-3"},vi={class:"mt-3 whitespace-pre-wrap text-xs text-muted-foreground"},bi={class:"grid gap-4 lg:grid-cols-2"},_i={class:"rounded-lg border p-3"},hi={class:"mt-3 space-y-2 text-xs"},yi={class:"flex items-center justify-between gap-2"},xi={class:"font-medium"},$i={class:"mt-1 text-muted-foreground"},Si={class:"rounded-lg border p-3"},wi={class:"mt-3 space-y-2 text-xs"},ki={class:"text-muted-foreground"},Ii={class:"rounded-lg border p-3"},Ci={class:"mt-3 space-y-2 text-xs"},Ti={key:0,class:"text-muted-foreground"},Li={class:"text-muted-foreground"},Ri=X({__name:"RedisPerformanceSection",props:{performance:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var v,c,x,h,m,_,$,b;return f(),g("div",ri,[e("div",li,[e("div",di,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Ops/sec",-1)),e("p",ui,i(u((v=s.performance)==null?void 0:v.instantaneousOpsPerSec)),1)]),e("div",ci,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Total commands",-1)),e("p",mi,i(u((c=s.performance)==null?void 0:c.totalCommandsProcessed)),1)]),e("div",pi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Blocked clients",-1)),e("p",fi,i(u((x=s.performance)==null?void 0:x.blockedClients)),1)])]),e("div",gi,[o[3]||(o[3]=e("h3",{class:"text-sm font-medium"},"Latency doctor",-1)),e("pre",vi,i(((h=s.performance)==null?void 0:h.latencyDoctor)||"No latency doctor output available."),1)]),e("div",bi,[e("div",_i,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Slowlog",-1)),e("div",hi,[(f(!0),g(H,null,V(((m=s.performance)==null?void 0:m.slowlog)||[],p=>(f(),g("div",{key:p.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",yi,[e("span",xi,i(p.command||"unknown command"),1),e("span",null,i(u(p.durationMicros))+" µs",1)]),e("p",$i,i(p.clientAddr||"n/a")+" · "+i(p.timestamp||"unknown time"),1)]))),128))])]),e("div",Si,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Command stats",-1)),e("div",wi,[(f(!0),g(H,null,V(((_=s.performance)==null?void 0:_.commandStats)||[],p=>(f(),g("div",{key:p.command,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(p.command),1),e("span",ki,i(u(p.calls))+" calls · "+i(p.usecPerCall.toFixed(2))+" µs/call ",1)]))),128))])])]),e("div",Ii,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Long-running Lua scripts",-1)),e("div",Ci,[((($=s.performance)==null?void 0:$.longRunningLuaScripts)||[]).length?O("",!0):(f(),g("div",Ti," No active Lua script clients detected. ")),(f(!0),g(H,null,V(((b=s.performance)==null?void 0:b.longRunningLuaScripts)||[],p=>(f(),g("div",{key:p.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(p.addr),1),e("span",Li,i(p.cmd)+" · age "+i(u(p.ageSeconds))+"s ",1)]))),128))])])])}}}),Ai={class:"space-y-4"},Pi={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Bi={class:"rounded-lg border p-3"},Di={class:"mt-1 text-lg font-medium"},Ei={class:"rounded-lg border p-3"},Ni={class:"mt-1 text-lg font-medium"},Mi={class:"rounded-lg border p-3"},Oi={class:"mt-1 text-lg font-medium"},Fi={class:"rounded-lg border p-3"},zi={class:"mt-1 text-lg font-medium"},Hi={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Vi={key:0},ji=X({__name:"RedisPersistenceSection",props:{persistence:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var c,x,h,m,_,$,b,p,S;const v=Ee;return f(),g("div",Ai,[e("div",Pi,[e("div",Bi,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"RDB enabled",-1)),e("p",Di,i((c=s.persistence)!=null&&c.rdbEnabled?"Yes":"No"),1)]),e("div",Ei,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"AOF enabled",-1)),e("p",Ni,i((x=s.persistence)!=null&&x.aofEnabled?"Yes":"No"),1)]),e("div",Mi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"AOF rewrite",-1)),e("p",Oi,i((h=s.persistence)!=null&&h.aofRewriteInProgress?"In progress":"Idle"),1)]),e("div",Fi,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Changes since save",-1)),e("p",zi,i(u((m=s.persistence)==null?void 0:m.changesSinceLastSave)),1)])]),(f(!0),g(H,null,V(((_=s.persistence)==null?void 0:_.warnings)||[],l=>(f(),J(v,{key:l,variant:"secondary"},{default:E(()=>[N(i(l),1)]),_:2},1024))),128)),e("div",Hi,[e("p",null," Last save status: "+i((($=s.persistence)==null?void 0:$.lastSaveStatus)||"unknown"),1),e("p",null," Last save time: "+i(((b=s.persistence)==null?void 0:b.lastSaveTime)||"unknown"),1),e("p",null," AOF last rewrite status: "+i(((p=s.persistence)==null?void 0:p.aofLastRewriteStatus)||"unknown"),1),(S=s.persistence)!=null&&S.lastBgsaveError?(f(),g("p",Vi," Last bgsave error: "+i(s.persistence.lastBgsaveError),1)):O("",!0)])])}}}),Ki={class:"space-y-4"},Ui={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Gi={class:"rounded-lg border p-3"},qi={class:"mt-1 text-lg font-medium"},Qi={class:"rounded-lg border p-3"},Xi={class:"mt-1 text-lg font-medium"},Wi={class:"rounded-lg border p-3"},Yi={class:"mt-1 text-lg font-medium"},Ji={class:"rounded-lg border p-3"},Zi={class:"mt-1 text-lg font-medium"},er={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},tr={class:"rounded-lg border p-3"},sr={class:"mt-3 space-y-2 text-xs"},nr={key:0,class:"text-muted-foreground"},or={class:"text-muted-foreground"},ar=X({__name:"RedisReplicationSection",props:{replication:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var v,c,x,h,m,_,$,b,p,S,l;return f(),g("div",Ki,[e("div",Ui,[e("div",Gi,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Role",-1)),e("p",qi,i(((v=s.replication)==null?void 0:v.role)||"unknown"),1)]),e("div",Qi,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Connected replicas",-1)),e("p",Xi,i(u((c=s.replication)==null?void 0:c.connectedReplicas)),1)]),e("div",Wi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Master link status",-1)),e("p",Yi,i(((x=s.replication)==null?void 0:x.masterLinkStatus)||"n/a"),1)]),e("div",Ji,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Cluster state",-1)),e("p",Zi,i(((h=s.replication)==null?void 0:h.clusterState)||((m=s.replication)!=null&&m.clusterEnabled?"enabled":"disabled")),1)])]),e("div",er,[e("p",null,"Replication lag: "+i(((_=s.replication)==null?void 0:_.replicationLag)??"n/a"),1),e("p",null,"Sentinel masters: "+i((($=s.replication)==null?void 0:$.sentinelMasters)??"n/a"),1),e("p",null," Cluster slots assigned: "+i(((b=s.replication)==null?void 0:b.clusterSlotsAssigned)??"n/a"),1),e("p",null,"Cluster known nodes: "+i(((p=s.replication)==null?void 0:p.clusterKnownNodes)??"n/a"),1)]),e("div",tr,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Replicas",-1)),e("div",sr,[(((S=s.replication)==null?void 0:S.replicas)||[]).length?O("",!0):(f(),g("div",nr," No replica nodes reported. ")),(f(!0),g(H,null,V(((l=s.replication)==null?void 0:l.replicas)||[],a=>(f(),g("div",{key:a.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(a.addr),1),e("span",or,i(a.state)+" · lag "+i(a.lag??"n/a"),1)]))),128))])])])}}}),ir=5e3;function rr(n){const r=B("overview"),u=B(!0),s=B(null),o=B(!1),v=B(!1),c=B(!1),x=B(null),h=B(!0),m=I(()=>!!n.connection.value);Ce(()=>{h.value=!1}),Te(()=>{h.value=!0});const _=async(l=!1)=>{var a;if(!n.connection.value)return x.value=null,null;l||(v.value=!0);try{s.value=null;const d=await $fetch("/api/redis/instance-insights/overview",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value}});return x.value=d,d}catch(d){return s.value=((a=d==null?void 0:d.data)==null?void 0:a.message)||(d==null?void 0:d.message)||(d==null?void 0:d.statusMessage)||"Failed to fetch Redis instance insights.",null}finally{l||(v.value=!1)}},$=async l=>{var a;if(!n.connection.value)return!1;c.value=!0;try{const d=await $fetch("/api/redis/instance-insights/kill-client",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value,clientId:l}});return d.success?(be("Redis client terminated",{description:d.message}),await _(!0),!0):(be("Failed to terminate client",{description:d.message}),!1)}catch(d){return be("Failed to terminate client",{description:((a=d==null?void 0:d.data)==null?void 0:a.message)||(d==null?void 0:d.message)||"The Redis client could not be terminated."}),!1}finally{c.value=!1}},b=async()=>{await _()};re([()=>n.connection.value,()=>n.databaseIndex.value],async([l])=>{if(!l){x.value=null;return}o.value=!0,await _(),o.value=!1},{immediate:!0});const{pause:p,resume:S}=Le(async()=>{!m.value||!h.value||await _(!0)},ir,{immediate:!1});return re(()=>u.value,l=>{l?S():p()},{immediate:!0}),{activeSection:r,autoRefresh:u,error:s,isInitialLoading:o,isLoading:v,isActionLoading:c,insights:x,refresh:b,killClient:$}}const lr={class:"flex h-full flex-col gap-3 overflow-hidden p-3"},dr={class:"flex items-center gap-2 text-xs"},ur={key:1,class:"flex flex-1 items-center justify-center gap-2 rounded-lg border bg-background text-muted-foreground"},cr={key:2,class:"flex-1 overflow-y-auto rounded-lg border bg-background p-3 mt-2"},mr=X({__name:"RedisInstanceInsightsPanel",props:{databaseName:{},databaseIndex:{},databases:{},dbType:{}},emits:["update:databaseIndex"],setup(n,{emit:r}){const u=n,s=r,o=[{id:"overview",label:"Overview"},{id:"keyspace",label:"Keyspace"},{id:"memory",label:"Memory"},{id:"performance",label:"Performance"},{id:"clients",label:"Clients"},{id:"persistence",label:"Persistence"},{id:"replication",label:"Replication / Cluster"},{id:"config",label:"Config"}],v=$e(),c=I(()=>v.selectedConnection),{activeSection:x,autoRefresh:h,error:m,isInitialLoading:_,isLoading:$,isActionLoading:b,insights:p,refresh:S,killClient:l}=rr({connection:c,databaseIndex:I(()=>u.databaseIndex)});return(a,d)=>{const T=Ae,j=me,R=ce,F=Tt,U=De,q=Be,k=Ee,M=Pe;return f(),g("div",lr,[w(F,{icon:"hugeicons:activity-02",title:"Instance Insights"},{context:E(()=>[a.dbType===t(ue).REDIS?(f(),J(Re("hugeicons:database-sync-01"),{key:0})):O("",!0)]),actions:E(()=>[w(Lt,{compact:"","trigger-id":"redis-instance-insights-db-index","trigger-class":"bg-background",databases:a.databases,"database-index":a.databaseIndex,"onUpdate:databaseIndex":d[0]||(d[0]=z=>s("update:databaseIndex",z))},null,8,["databases","database-index"]),e("div",dr,[w(T,{id:"redis-insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":d[1]||(d[1]=z=>le(h)?h.value=z:null)},null,8,["model-value"]),d[3]||(d[3]=e("label",{for:"redis-insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(R,{size:"xxs",variant:"outline",disabled:t($)||t(b),onClick:t(S)},{default:E(()=>[w(j,{name:"hugeicons:redo",class:"size-3.5!"}),d[4]||(d[4]=N(" Refresh "))]),_:1},8,["disabled","onClick"])]),_:1}),w(M,{modelValue:t(x),"onUpdate:modelValue":d[2]||(d[2]=z=>le(x)?x.value=z:null),class:"flex flex-1 min-h-0 flex-col gap-0"},{default:E(()=>{var z,y,L,K,A,P,Q,Z;return[w(q,{size:"sm",class:"max-w-full justify-start! shrink-0 overflow-x-auto"},{default:E(()=>[(f(),g(H,null,V(o,ae=>w(U,{size:"xs",key:ae.id,value:ae.id,class:"min-w-fit shrink-0 cursor-pointer rounded-sm"},{default:E(()=>[N(i(ae.label),1)]),_:2},1032,["value"])),64))]),_:1}),t(m)?(f(),J(k,{key:0,variant:"destructive"},{default:E(()=>[N(i(t(m)),1)]),_:1})):O("",!0),t(_)&&!t(p)?(f(),g("div",ur,[w(j,{name:"hugeicons:redo",class:"size-4 animate-spin"}),d[5]||(d[5]=N(" Loading Redis instance insights... "))])):(f(),g("div",cr,[te(w(ii,{overview:(z=t(p))==null?void 0:z.overview},null,8,["overview"]),[[se,t(x)==="overview"]]),te(w(Ea,{keyspace:(y=t(p))==null?void 0:y.keyspace},null,8,["keyspace"]),[[se,t(x)==="keyspace"]]),te(w(ti,{memory:(L=t(p))==null?void 0:L.memory},null,8,["memory"]),[[se,t(x)==="memory"]]),te(w(Ri,{performance:(K=t(p))==null?void 0:K.performance},null,8,["performance"]),[[se,t(x)==="performance"]]),te(w(ca,{clients:(A=t(p))==null?void 0:A.clients,"is-action-loading":t(b),onKillClient:t(l)},null,8,["clients","is-action-loading","onKillClient"]),[[se,t(x)==="clients"]]),te(w(ji,{persistence:(P=t(p))==null?void 0:P.persistence},null,8,["persistence"]),[[se,t(x)==="persistence"]]),te(w(ar,{replication:(Q=t(p))==null?void 0:Q.replication},null,8,["replication"]),[[se,t(x)==="replication"]]),te(w(fa,{config:(Z=t(p))==null?void 0:Z.config},null,8,["config"]),[[se,t(x)==="config"]])]))]}),_:1},8,["modelValue"])])}}}),pr={class:"h-full"},fr={key:0,class:"h-full p-4 flex flex-col items-center justify-center text-muted-foreground"},Pr=X({__name:"index",setup(n){const r=Ze(),u=$e(),s=et(),{activeTab:o}=je(s),v=I(()=>String(r.params.connectionId||"")),c=I(()=>v.value?u.connections.find(b=>b.id===v.value):null),x=I(()=>{var b;return((b=c.value)==null?void 0:b.connectionString)||""}),h=I(()=>{var b;return(b=c.value)==null?void 0:b.type}),m=I(()=>{var b,p,S;return h.value===ue.REDIS?((b=c.value)==null?void 0:b.name)||"Redis":((p=c.value)==null?void 0:p.database)||((S=c.value)==null?void 0:S.name)||"database"}),_=I(()=>h.value===ue.REDIS?c.value??void 0:void 0),$=Rt({connection:_,mode:"meta"});return re(()=>{var b,p;return(p=(b=o.value)==null?void 0:b.metadata)==null?void 0:p.databaseIndex},b=>{typeof b=="number"&&($.selectedDatabaseIndex.value=b)},{immediate:!0}),(b,p)=>{const S=me;return f(),g("div",pr,[t(c)?t(h)===t(ue).REDIS?(f(),J(mr,{key:1,"database-name":t(m),"database-index":t($).selectedDatabaseIndex.value,databases:t($).databases.value,"db-type":t(h),"onUpdate:databaseIndex":p[0]||(p[0]=l=>t($).selectedDatabaseIndex.value=l)},null,8,["database-name","database-index","databases","db-type"])):t(h)===t(ue).POSTGRES?(f(),J(no,{key:2,"db-connection-string":t(x),"database-name":t(m),"db-type":t(h)},null,8,["db-connection-string","database-name","db-type"])):(f(),J(Wo,{key:3,"db-connection-string":t(x),"database-name":t(m),"db-type":t(h)},null,8,["db-connection-string","database-name","db-type"])):(f(),g("div",fr,[w(S,{name:"hugeicons:plug-socket",class:"size-12 mb-2 opacity-50"}),p[1]||(p[1]=e("p",{class:"text-sm"},"Select a connection to open Instance Insights",-1))]))])}}});export{Pr as default};
1
+ import{G as Ye,d as X,r as B,an as re,c as I,e as g,m as e,l as O,f as w,a4 as ce,w as E,z as N,t as i,g as t,o as f,A as me,n as oe,cg as He,bh as Ve,i as le,a8 as Ie,cx as Je,cj as Ce,ck as Te,cF as Le,E as ne,K as be,O as $e,k as J,q as Re,I as te,aF as se,bf as xe,bj as Ae,bx as Pe,by as Be,F as H,s as V,bz as De,ae as je,R as ue,T as Ze,N as et}from"./D7uoAo-G.js";import{g as Ke}from"./BG_B-fo0.js";import{t as G,i as tt,a as st,b as nt,m as ot,k as at,g as Ue,h as Ge,c as it,d as Me,e as rt,f as lt,j as dt,n as ut,l as ct,S as mt,o as pt,p as ft,_ as qe,q as gt,r as Oe,s as vt,C as bt,u as _t,v as ht,E as we,w as yt,x as xt,y as $t,z as St,A as wt,B as kt}from"./Culm7V2R.js";import{a as It}from"./D9Ycznwo.js";import{b as pe,a as fe,_ as Se,D as ge}from"./BkqB6n0T.js";import{b as _e,a as Qe}from"./BVmBXPoG.js";import{u as Ct}from"./2TwRWQjG.js";import{_ as Tt}from"./BOVFFCPB.js";import{_ as Ee}from"./1VXrIDkr.js";import{_ as Lt,u as Rt}from"./BjpSpz5C.js";import"./C1TOiVRQ.js";import"./B41tp0B8.js";import"./uHyBIwWw.js";import"./CTYqoFvv.js";import"./B5rxJs06.js";import"./BNnChlxR.js";var Fe={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},At=function(){function n(r){var u=this._condVal=Me(r)?new RegExp(r):rt(r)?r:null;if(u==null){var s="";G(s)}}return n.prototype.evaluate=function(r){var u=typeof r;return Me(u)?this._condVal.test(r):lt(u)?this._condVal.test(r+""):!1},n}(),Pt=function(){function n(){}return n.prototype.evaluate=function(){return this.value},n}(),Bt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=this.children,u=0;u<r.length;u++)if(!r[u].evaluate())return!1;return!0},n}(),Dt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=this.children,u=0;u<r.length;u++)if(r[u].evaluate())return!0;return!1},n}(),Et=function(){function n(){}return n.prototype.evaluate=function(){return!this.child.evaluate()},n}(),Nt=function(){function n(){}return n.prototype.evaluate=function(){for(var r=!!this.valueParser,u=this.getValue,s=u(this.valueGetterParam),o=r?this.valueParser(s):null,v=0;v<this.subCondList.length;v++)if(!this.subCondList[v].evaluate(r?o:s))return!1;return!0},n}();function Ne(n,r){if(n===!0||n===!1){var u=new Pt;return u.value=n,u}var s="";return Xe(n)||G(s),n.and?ze("and",n,r):n.or?ze("or",n,r):n.not?Mt(n,r):Ot(n,r)}function ze(n,r,u){var s=r[n],o="";nt(s)||G(o),s.length||G(o);var v=n==="and"?new Bt:new Dt;return v.children=ot(s,function(c){return Ne(c,u)}),v.children.length||G(o),v}function Mt(n,r){var u=n.not,s="";Xe(u)||G(s);var o=new Et;return o.child=Ne(u,r),o.child||G(s),o}function Ot(n,r){for(var u="",s=r.prepareGetValue(n),o=[],v=at(n),c=n.parser,x=c?Ue(c):null,h=0;h<v.length;h++){var m=v[h];if(!(m==="parser"||r.valueGetterAttrMap.get(m))){var _=Ge(Fe,m)?Fe[m]:m,$=n[m],b=x?x($):$,p=it(_,b)||_==="reg"&&new At(b);p||G(u),o.push(p)}}o.length||G(u);var S=new Nt;return S.valueGetterParam=s,S.valueParser=x,S.getValue=r.getValue,S.subCondList=o,S}function Xe(n){return tt(n)&&!st(n)}var Ft=function(){function n(r,u){this._cond=Ne(r,u)}return n.prototype.evaluate=function(){return this._cond.evaluate()},n}();function zt(n,r){return new Ft(n,r)}var Ht={type:"echarts:filter",transform:function(n){for(var r=n.upstream,u,s=zt(n.config,{valueGetterAttrMap:dt({dimension:!0}),prepareGetValue:function(x){var h="",m=x.dimension;Ge(x,"dimension")||G(h);var _=r.getDimensionInfo(m);return _||G(h),{dimIdx:_.index}},getValue:function(x){return r.retrieveValueFromItem(u,x.dimIdx)}}),o=[],v=0,c=r.count();v<c;v++)u=r.getRawDataItem(v),s.evaluate()&&o.push(u);return{data:o}}},Vt={type:"echarts:sort",transform:function(n){var r=n.upstream,u=n.config,s="",o=ut(u);o.length||G(s);var v=[];ct(o,function(_){var $=_.dimension,b=_.order,p=_.parser,S=_.incomparable;if($==null&&G(s),b!=="asc"&&b!=="desc"&&G(s),S&&S!=="min"&&S!=="max"){var l="";G(l)}if(b!=="asc"&&b!=="desc"){var a="";G(a)}var d=r.getDimensionInfo($);d||G(s);var T=p?Ue(p):null;p&&!T&&G(s),v.push({dimIdx:d.index,parser:T,comparator:new mt(b,S)})});var c=r.sourceFormat;c!==pt&&c!==ft&&G(s);for(var x=[],h=0,m=r.count();h<m;h++)x.push(r.getRawDataItem(h));return x.sort(function(_,$){for(var b=0;b<v.length;b++){var p=v[b],S=r.retrieveValueFromItem(_,p.dimIdx),l=r.retrieveValueFromItem($,p.dimIdx);p.parser&&(S=p.parser(S),l=p.parser(l));var a=p.comparator.evaluate(S,l);if(a!==0)return a}return 0}),{data:x}}};function jt(n){n.registerTransform(Ht),n.registerTransform(Vt)}var Kt=function(n){qe(r,n);function r(){var u=n!==null&&n.apply(this,arguments)||this;return u.type="dataset",u}return r.prototype.init=function(u,s,o){n.prototype.init.call(this,u,s,o),this._sourceManager=new gt(this),Oe(this)},r.prototype.mergeOption=function(u,s){n.prototype.mergeOption.call(this,u,s),Oe(this)},r.prototype.optionUpdated=function(){this._sourceManager.dirty()},r.prototype.getSourceManager=function(){return this._sourceManager},r.type="dataset",r.defaultOption={seriesLayoutBy:vt},r}(bt),Ut=function(n){qe(r,n);function r(){var u=n!==null&&n.apply(this,arguments)||this;return u.type="dataset",u}return r.type="dataset",r}(_t);function Gt(n){n.registerComponentModel(Kt),n.registerComponentView(Ut)}const de=n=>It(n??0),ie=n=>n==null?"0.00/s":`${n.toFixed(2)}/s`,ke=n=>n==null?"0%":`${n.toFixed(2)}%`,he=n=>{if(!n)return"-";const r=new Date(n);return Number.isNaN(r.getTime())?n:r.toLocaleString()},We=n=>{if(n==null)return"-";if(n<60)return`${n}s`;const r=Math.floor(n/60),u=n%60;if(r<60)return`${r}m ${u}s`;const s=Math.floor(r/60),o=r%60;return`${s}h ${o}m`},qt=n=>n==null||n<=0?"0 B":Ye(n).replace(" bytes"," B"),Qt=n=>{if(!n)return"-";const r=n.replace(/\s+/g," ").trim();return r?r.length>320?`${r.slice(0,320)}...`:r:"-"},Xt=n=>(n||"").toLowerCase().includes("idle in transaction"),Wt={class:"space-y-4"},Yt={class:"flex items-center justify-between"},Jt={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Zt={class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},es={class:"h-full border rounded-lg p-2.5 space-y-2"},ts={class:"flex items-center gap-1"},ss={class:"text-sm font-semibold leading-none tabular-nums"},ns={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},os={class:"text-muted-foreground"},as={class:"tabular-nums text-foreground"},is={class:"text-muted-foreground"},rs={class:"tabular-nums text-foreground"},ls={class:"text-muted-foreground"},ds={class:"tabular-nums text-foreground"},us={class:"text-muted-foreground"},cs={class:"tabular-nums text-foreground"},ms={class:"h-full border rounded-lg p-2.5 space-y-2"},ps={class:"flex items-center gap-1"},fs={class:"text-sm font-semibold leading-none tabular-nums"},gs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},vs={class:"text-muted-foreground"},bs={class:"tabular-nums text-foreground"},_s={class:"text-muted-foreground"},hs={class:"tabular-nums text-foreground"},ys={class:"text-muted-foreground"},xs={class:"tabular-nums text-foreground"},$s={class:"text-muted-foreground"},Ss={class:"tabular-nums text-foreground"},ws={class:"h-full border rounded-lg p-2.5 space-y-2"},ks={class:"flex items-center gap-1"},Is={class:"text-sm font-semibold leading-none tabular-nums"},Cs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},Ts={class:"text-muted-foreground"},Ls={class:"tabular-nums text-foreground"},Rs={class:"text-muted-foreground"},As={class:"tabular-nums text-foreground"},Ps={class:"text-muted-foreground"},Bs={class:"tabular-nums text-foreground"},Ds={class:"text-muted-foreground"},Es={class:"tabular-nums text-foreground"},Ns={class:"h-full border rounded-lg p-2.5 space-y-2"},Ms={class:"flex items-center gap-1"},Os={class:"text-sm font-semibold leading-none tabular-nums"},Fs={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},zs={class:"text-muted-foreground"},Hs={class:"tabular-nums text-foreground"},Vs={class:"text-muted-foreground"},js={class:"tabular-nums text-foreground"},Ks={class:"text-muted-foreground"},Us={class:"tabular-nums text-foreground"},Gs={class:"text-muted-foreground"},qs={class:"tabular-nums text-foreground"},Qs={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Xs={class:"border rounded-lg p-2.5"},Ws={class:"insights-chart-container"},Ys={class:"border rounded-lg p-2.5"},Js={class:"insights-chart-container"},Zs={class:"border rounded-lg p-2.5"},en={class:"insights-chart-container"},tn=X({__name:"InstanceInsightsActivitySection",props:{dashboard:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},setup(n){ht([yt,xt,$t,Gt,jt,St,wt,kt]);const r=n,u=B({}),s=B({}),o=B({}),v=(l,a)=>{a!=null&&a.selected&&(l.value={...a.selected})},c=l=>v(u,l),x=l=>v(s,l),h=l=>v(o,l),m=B([]);re(()=>r.dashboard,l=>{if(!(l!=null&&l.capturedAt))return;const a=new Date(l.capturedAt).toLocaleTimeString(),d={capturedAt:l.capturedAt,label:a,sessionsTotal:l.sessions.total,sessionsActive:l.sessions.active,sessionsIdle:l.sessions.idle,tps:l.transactions.tps,commits:l.transactions.commitsPerSec,rollbacks:l.transactions.rollbacksPerSec,reads:l.blockIO.readsPerSec,hits:l.blockIO.hitsPerSec,hitRatio:l.blockIO.bufferHitRatio},T=m.value.findIndex(j=>j.capturedAt===d.capturedAt);if(T>=0){m.value[T]=d;return}m.value.push(d),m.value.length>80&&(m.value=m.value.slice(-80))},{immediate:!0,deep:!0});const _=I(()=>m.value.map((l,a)=>({...l,idx:a}))),$=l=>Object.keys(l).length?l:void 0,b=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(u.value)},dataset:[{id:"sessions_raw",source:_.value},{id:"sessions_filtered",fromDatasetId:"sessions_raw",transform:{type:"filter",config:{dimension:"idx",gte:0}}}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},series:[{name:"Total",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsTotal"}},{name:"Active",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsActive"}},{name:"Idle",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsIdle"}}]})),p=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(s.value)},dataset:[{id:"transactions_dataset",source:_.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"TPS"},{type:"value",name:"Commit/Rollback"}],series:[{name:"TPS",type:"line",smooth:!0,yAxisIndex:0,datasetId:"transactions_dataset",encode:{x:"label",y:"tps"}},{name:"Commits/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"commits"}},{name:"Rollbacks/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"rollbacks"}}]})),S=I(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:$(o.value)},dataset:[{id:"block_io_dataset",source:_.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"Blocks/s"},{type:"value",name:"Hit %",min:0,max:100}],series:[{name:"Reads/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"reads"}},{name:"Hits/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"hits"}},{name:"Buffer Hit Ratio",type:"line",smooth:!0,yAxisIndex:1,datasetId:"block_io_dataset",encode:{x:"label",y:"hitRatio"}}]}));return(l,a)=>{var j,R,F,U,q,k,M,z,y,L,K,A,P,Q,Z,ae,ve,C,D,Y,W;const d=me,T=ce;return f(),g("div",Wt,[e("div",Yt,[a[2]||(a[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Activity Dashboard"),e("p",{class:"text-xs text-muted-foreground"}," Sessions, TPS, tuples and block I/O ")],-1)),w(T,{variant:"outline",size:"xs",disabled:l.isLoading||l.isActionLoading,class:"font-normal",onClick:a[0]||(a[0]=ye=>l.onRefresh())},{default:E(()=>[w(d,{name:"hugeicons:redo",class:oe(["size-4",l.isLoading&&"animate-spin"])},null,8,["class"]),a[1]||(a[1]=N(" Refresh Activity "))]),_:1},8,["disabled"])]),(j=l.dashboard)!=null&&j.sessions.exceedsThreshold?(f(),g("div",Jt,[a[3]||(a[3]=N(" Total connections are at ")),e("strong",null,i(t(ke)(l.dashboard.sessions.usagePercent)),1),a[4]||(a[4]=N(" of ")),a[5]||(a[5]=e("strong",null,"max_connections",-1)),a[6]||(a[6]=N(". Investigate connection pool usage. "))])):O("",!0),e("div",Zt,[e("div",es,[e("div",ts,[a[7]||(a[7]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Sessions:",-1)),e("p",ss,i(t(de)((R=l.dashboard)==null?void 0:R.sessions.total)),1)]),e("div",ns,[e("p",os,[a[8]||(a[8]=e("span",null,"Active: ",-1)),e("span",as,i(t(de)((F=l.dashboard)==null?void 0:F.sessions.active)),1)]),e("p",is,[a[9]||(a[9]=e("span",null,"Idle: ",-1)),e("span",rs,i(t(de)((U=l.dashboard)==null?void 0:U.sessions.idle)),1)]),e("p",ls,[a[10]||(a[10]=e("span",null,"Max: ",-1)),e("span",ds,i(t(de)((q=l.dashboard)==null?void 0:q.sessions.maxConnections)),1)]),e("p",us,[a[11]||(a[11]=e("span",null,"Usage: ",-1)),e("span",cs,i(t(ke)((k=l.dashboard)==null?void 0:k.sessions.usagePercent)),1)])])]),e("div",ms,[e("div",ps,[a[12]||(a[12]=e("p",{class:"text-xs uppercase text-muted-foreground"},"TPS:",-1)),e("p",fs,i(t(ie)((M=l.dashboard)==null?void 0:M.transactions.tps)),1)]),e("div",gs,[e("p",vs,[a[13]||(a[13]=e("span",null,"Commits/sec: ",-1)),e("span",bs,i(t(ie)((z=l.dashboard)==null?void 0:z.transactions.commitsPerSec)),1)]),e("p",_s,[a[14]||(a[14]=e("span",null,"Rollbacks/sec: ",-1)),e("span",hs,i(t(ie)((y=l.dashboard)==null?void 0:y.transactions.rollbacksPerSec)),1)]),e("p",ys,[a[15]||(a[15]=e("span",null,"Total Commits: ",-1)),e("span",xs,i(t(de)((L=l.dashboard)==null?void 0:L.transactions.totalCommits)),1)]),e("p",$s,[a[16]||(a[16]=e("span",null,"Total Rollbacks: ",-1)),e("span",Ss,i(t(de)((K=l.dashboard)==null?void 0:K.transactions.totalRollbacks)),1)])])]),e("div",ws,[e("div",ks,[a[17]||(a[17]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Tuples:",-1)),e("p",Is,i(t(ie)((A=l.dashboard)==null?void 0:A.tuples.insertsPerSec)),1)]),e("div",Cs,[e("p",Ts,[a[18]||(a[18]=e("span",null,"Updates: ",-1)),e("span",Ls,i(t(ie)((P=l.dashboard)==null?void 0:P.tuples.updatesPerSec)),1)]),e("p",Rs,[a[19]||(a[19]=e("span",null,"Deletes: ",-1)),e("span",As,i(t(ie)((Q=l.dashboard)==null?void 0:Q.tuples.deletesPerSec)),1)]),e("p",Ps,[a[20]||(a[20]=e("span",null,"Fetched: ",-1)),e("span",Bs,i(t(ie)((Z=l.dashboard)==null?void 0:Z.tuples.fetchedPerSec)),1)]),e("p",Ds,[a[21]||(a[21]=e("span",null,"Returned: ",-1)),e("span",Es,i(t(ie)((ae=l.dashboard)==null?void 0:ae.tuples.returnedPerSec)),1)])])]),e("div",Ns,[e("div",Ms,[a[22]||(a[22]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Block I/O:",-1)),e("p",Os,i(t(ke)((ve=l.dashboard)==null?void 0:ve.blockIO.bufferHitRatio)),1)]),e("div",Fs,[e("p",zs,[a[23]||(a[23]=e("span",null,"Reads/sec: ",-1)),e("span",Hs,i(t(ie)((C=l.dashboard)==null?void 0:C.blockIO.readsPerSec)),1)]),e("p",Vs,[a[24]||(a[24]=e("span",null,"Hits/sec: ",-1)),e("span",js,i(t(ie)((D=l.dashboard)==null?void 0:D.blockIO.hitsPerSec)),1)]),e("p",Ks,[a[25]||(a[25]=e("span",null,"Total Reads: ",-1)),e("span",Us,i(t(de)((Y=l.dashboard)==null?void 0:Y.blockIO.totalReads)),1)]),e("p",Gs,[a[26]||(a[26]=e("span",null,"Total Hits: ",-1)),e("span",qs,i(t(de)((W=l.dashboard)==null?void 0:W.blockIO.totalHits)),1)])])])]),e("div",Qs,[e("div",Xs,[a[27]||(a[27]=e("p",{class:"text-sm font-medium mb-1.5"},"Sessions Timeline",-1)),e("div",Ws,[w(t(we),{option:t(b),autoresize:"",class:"insights-chart",onLegendselectchanged:c},null,8,["option"])])]),e("div",Ys,[a[28]||(a[28]=e("p",{class:"text-sm font-medium mb-1.5"},"Transactions Timeline",-1)),e("div",Js,[w(t(we),{option:t(p),autoresize:"",class:"insights-chart",onLegendselectchanged:x},null,8,["option"])])])]),e("div",Zs,[a[29]||(a[29]=e("p",{class:"text-sm font-medium mb-1.5"},"Block I/O Timeline",-1)),e("div",en,[w(t(we),{option:t(S),autoresize:"",class:"insights-chart",onLegendselectchanged:h},null,8,["option"])])])])}}}),sn=He(tn,[["__scopeId","data-v-ba36a884"]]),nn={class:"space-y-4 h-full flex flex-col overflow-auto"},on={class:"flex items-center justify-between gap-2 flex-wrap"},an={class:"h-full"},rn={class:"flex flex-col sm:flex-row sm:items-center gap-2 mb-2"},ln={class:"relative flex-1"},dn=X({__name:"InstanceInsightsConfigurationSection",props:{configuration:{},search:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},emits:["update:search"],setup(n,{emit:r}){const u=n,s=r,o=I({get:()=>u.search,set:_=>s("update:search",_)}),v=I(()=>{var _;return((_=u.configuration)==null?void 0:_.rows)||[]}),c=I(()=>v.value.map(_=>({name:_.name,category:_.category,value:_.value,unit:_.unit||"-",requires_restart:_.pendingRestart?"yes":"no",description:_.description}))),x=I(()=>_e(c.value)),h=I(()=>pe({columns:x.value,rows:c.value,columnKeyBy:"field"})),m=I(()=>fe(c.value));return(_,$)=>{const b=me,p=ce,S=Ve,l=Se;return f(),g("div",nn,[e("div",on,[$[3]||($[3]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Configuration"),e("p",{class:"text-xs text-muted-foreground"},"Searchable pg_settings")],-1)),w(p,{variant:"outline",size:"xs",disabled:_.isLoading||_.isActionLoading,class:"font-normal",onClick:$[0]||($[0]=a=>_.onRefresh())},{default:E(()=>[w(b,{name:"hugeicons:redo",class:oe(["size-4",_.isLoading&&"animate-spin"])},null,8,["class"]),$[2]||($[2]=N(" Refresh Configuration "))]),_:1},8,["disabled"])]),e("div",an,[e("div",rn,[e("div",ln,[w(b,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(S,{type:"text",placeholder:"Search setting name, category, or description...",class:"h-8 w-full pl-8 pr-3",modelValue:t(o),"onUpdate:modelValue":$[1]||($[1]=a=>le(o)?o.value=a:null)},null,8,["modelValue"])])]),w(l,{"column-defs":t(h),"row-data":t(m),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])])}}}),un={class:"space-y-4"},cn={class:"flex items-center justify-between"},mn={key:0,class:"border border-orange-300 bg-orange-50 text-orange-700 rounded-lg p-3 text-sm"},pn={class:"space-y-1.5"},fn={class:"space-y-1.5"},gn={key:1,class:"border rounded-lg p-2.5"},vn={class:"flex items-center justify-between gap-3 flex-wrap"},bn={class:"text-sm font-medium"},_n={class:"flex items-center gap-2"},hn=300,yn=120,xn=44,$n=36,Sn=X({__name:"InstanceInsightsReplicationSection",props:{replication:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onToggleSlotStatus:{type:Function},onDropSlot:{type:Function}},setup(n){const r=n,u=I(()=>{var k;return((k=r.replication)==null?void 0:k.replicationStats)||[]}),s=I(()=>{var k;return((k=r.replication)==null?void 0:k.replicationSlots)||[]}),o=B([]),v=k=>{o.value=k},c=I(()=>u.value.map(k=>({pid:k.pid,client_addr:k.clientAddr||"-",application:k.applicationName||"-",state:k.state||"-",sync_state:k.syncState||"-",reply_time:he(k.replyTime),write_lag:k.writeLag||"-",flush_lag:k.flushLag||"-",replay_lag:k.replayLag||"-"}))),x=["pid","client_addr","application","state","sync_state","reply_time","write_lag","flush_lag","replay_lag"],h=I(()=>c.value.length>0?_e(c.value):Qe(x)),m=I(()=>pe({columns:h.value,rows:c.value,columnKeyBy:"field"})),_=I(()=>fe(c.value)),$=I(()=>s.value.map(k=>({slot_name:k.slotName,slot_type:k.slotType,status:k.active?"on":"off",active_pid:k.activePid??"-",restart_lsn:k.restartLsn||"-",retained_wal:qt(k.retainedBytes),temporary:k.temporary?"yes":"no"}))),b=I(()=>_e($.value)),p=I(()=>pe({columns:b.value,rows:$.value,columnKeyBy:"field"})),S=I(()=>fe($.value)),l=k=>k<=0?yn:Math.min(hn,xn+k*$n),a=I(()=>`${l(c.value.length)}px`),d=I(()=>`${l($.value.length)}px`),T=I(()=>{var M;const k=String(((M=o.value[0])==null?void 0:M.slot_name)||"");return k&&s.value.find(z=>z.slotName===k)||null}),j=I(()=>{var k;return(k=T.value)!=null&&k.active?"off":"on"}),R=I(()=>j.value==="off"?"Turn Off Slot":"Turn On Slot"),F=k=>window.confirm(k),U=async()=>{T.value&&F(`Drop replication slot "${T.value.slotName}"? This action cannot be undone.`)&&await r.onDropSlot(T.value.slotName)},q=async()=>{T.value&&F(`Switch replication slot "${T.value.slotName}" to ${j.value.toUpperCase()} status?`)&&await r.onToggleSlotStatus({slotName:T.value.slotName,desiredStatus:j.value,activePid:T.value.activePid,slotType:T.value.slotType})};return(k,M)=>{var K;const z=me,y=ce,L=Se;return f(),g("div",un,[e("div",cn,[M[2]||(M[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Replication"),e("p",{class:"text-xs text-muted-foreground"},"Replication stats and slots")],-1)),w(y,{variant:"outline",size:"xs",disabled:k.isLoading||k.isActionLoading,class:"font-normal",onClick:M[0]||(M[0]=A=>k.onRefresh())},{default:E(()=>[w(z,{name:"hugeicons:redo",class:oe(["size-4",k.isLoading&&"animate-spin"])},null,8,["class"]),M[1]||(M[1]=N(" Refresh Replication "))]),_:1},8,["disabled"])]),(K=k.replication)!=null&&K.staleSlotWarning?(f(),g("div",mn,i(k.replication.staleSlotWarning),1)):O("",!0),e("div",pn,[M[3]||(M[3]=e("p",{class:"text-sm"},"Replication Stats",-1)),e("div",{class:"max-h-[300px] min-h-[200px]",style:Ie({height:t(a)})},[w(L,{"column-defs":t(m),"row-data":t(_),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])],4)]),e("div",fn,[M[4]||(M[4]=e("h4",{class:"text-sm font-normal"},"Replication Slots",-1)),e("div",{class:"max-h-[300px] min-h-[200px]",style:Ie({height:t(d)})},[w(L,{"column-defs":t(p),"row-data":t(S),"column-types":t(ge),"selected-rows":t(o),class:"h-full border rounded-md",onSelectionChanged:v},null,8,["column-defs","row-data","column-types","selected-rows"])],4)]),t(T)?(f(),g("div",gn,[e("div",vn,[e("p",bn," Selected Slot: "+i(t(T).slotName)+" ("+i(t(T).active?"on":"off")+") · Active PID: "+i(t(T).activePid??"-"),1),e("div",_n,[w(y,{variant:"outline",size:"sm",disabled:k.isActionLoading,onClick:q},{default:E(()=>[N(i(t(R)),1)]),_:1},8,["disabled"]),w(y,{variant:"outline",size:"sm",disabled:k.isActionLoading,onClick:U},{default:E(()=>M[5]||(M[5]=[N(" Drop Slot ")])),_:1},8,["disabled"])])])])):O("",!0)])}}}),wn={class:"space-y-4"},kn={class:"flex items-center justify-between"},In={class:"space-y-1.5"},Cn={class:"h-[360px]"},Tn={key:0,class:"border rounded-lg p-2.5 space-y-2"},Ln={class:"flex items-center justify-between gap-3 flex-wrap"},Rn={class:"text-sm font-medium"},An={class:"flex gap-2"},Pn=["innerHTML"],Bn={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Dn={class:"space-y-1.5"},En={class:"h-[300px]"},Nn={class:"space-y-1.5"},Mn={class:"h-[300px]"},On=X({__name:"InstanceInsightsStateSection",props:{state:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onCancelQuery:{type:Function},onTerminateConnection:{type:Function}},setup(n){const r=n,{highlightSql:u}=Ct(),s=I(()=>{var y;return((y=r.state)==null?void 0:y.sessions)||[]}),o=I(()=>{var y;return((y=r.state)==null?void 0:y.locks)||[]}),v=I(()=>{var y;return((y=r.state)==null?void 0:y.preparedTransactions)||[]}),c=B([]),x=y=>{c.value=y},h=I(()=>s.value.map(y=>({pid:y.pid,user:y.user,application:y.application||"-",client:y.client||"-",state:y.state||"-",wait_event:y.waitEvent||"-",blocking_pids:y.blockingPids.length?y.blockingPids.join(", "):"-",backend_start:he(y.backendStart),transaction_start:he(y.transactionStart),query_duration:We(y.durationSeconds),sql:Qt(y.sql)}))),m=I(()=>_e(h.value)),_=I(()=>pe({columns:m.value,rows:h.value,columnKeyBy:"field",getCellClass:q})),$=I(()=>fe(h.value)),b=I(()=>o.value.map(y=>({lock_type:y.lockType,target_relation:y.targetRelation||"-",mode:y.mode,granted:y.granted?"yes":"no",pid:y.pid??"-",user:y.user||"-",state:y.state||"-"}))),p=I(()=>_e(b.value)),S=I(()=>pe({columns:p.value,rows:b.value,columnKeyBy:"field"})),l=I(()=>fe(b.value)),a=I(()=>v.value.map(y=>({gid:y.gid,transaction:y.transaction,prepared:he(y.prepared),owner:y.owner,database:y.database}))),d=I(()=>_e(a.value)),T=I(()=>pe({columns:d.value,rows:a.value,columnKeyBy:"field"})),j=I(()=>fe(a.value)),R=I(()=>{var L;const y=Number(((L=c.value[0])==null?void 0:L.pid)||0);return y&&s.value.find(K=>K.pid===y)||null}),F=y=>{if(!y||!y.trim())return"<pre><code>-</code></pre>";const L=y.replace(/\s+/g," ").trim(),K=L.length>900?`${L.slice(0,900)} ...`:L;return u(K)},U=I(()=>{var y;return F(((y=R.value)==null?void 0:y.sql)||null)}),q=(y,L)=>{const K=String(L.state||"");return Xt(K)?"insights-danger-cell":void 0},k=y=>window.confirm(y),M=async()=>{R.value&&k(`Cancel query for PID ${R.value.pid}?`)&&await r.onCancelQuery(R.value.pid)},z=async()=>{R.value&&k(`Terminate connection for PID ${R.value.pid}?`)&&await r.onTerminateConnection(R.value.pid)};return(y,L)=>{const K=me,A=ce,P=Se;return f(),g("div",wn,[e("div",kn,[L[2]||(L[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"State"),e("p",{class:"text-xs text-muted-foreground"}," Active sessions, locks, prepared transactions ")],-1)),w(A,{variant:"outline",size:"xs",disabled:y.isLoading||y.isActionLoading,class:"font-normal",onClick:L[0]||(L[0]=Q=>y.onRefresh())},{default:E(()=>[w(K,{name:"hugeicons:redo",class:oe(["size-4",y.isLoading&&"animate-spin"])},null,8,["class"]),L[1]||(L[1]=N(" Refresh State "))]),_:1},8,["disabled"])]),e("div",In,[L[3]||(L[3]=e("h4",{class:"text-sm font-normal"},"Active Sessions",-1)),e("div",Cn,[w(P,{"column-defs":t(_),"row-data":t($),"column-types":t(ge),"selected-rows":t(c),class:"h-full border rounded-md",onSelectionChanged:x},null,8,["column-defs","row-data","column-types","selected-rows"])])]),t(R)?(f(),g("div",Tn,[e("div",Ln,[e("p",Rn," Selected PID: "+i(t(R).pid)+" ("+i(t(R).state||"-")+") ",1),e("div",An,[w(A,{variant:"outline",size:"sm",disabled:y.isActionLoading,onClick:M},{default:E(()=>L[4]||(L[4]=[N(" Cancel Query ")])),_:1},8,["disabled"]),w(A,{variant:"outline",size:"sm",disabled:y.isActionLoading,onClick:z},{default:E(()=>L[5]||(L[5]=[N(" Terminate Connection ")])),_:1},8,["disabled"])])]),e("div",null,[L[6]||(L[6]=e("p",{class:"text-xs text-muted-foreground mb-1"},"SQL Preview",-1)),e("div",{class:"sql-preview border rounded-md overflow-hidden",innerHTML:t(U)},null,8,Pn)])])):O("",!0),e("div",Bn,[e("div",Dn,[L[7]||(L[7]=e("h4",{class:"text-sm font-normal"},"Locks",-1)),e("div",En,[w(P,{"column-defs":t(S),"row-data":t(l),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])]),e("div",Nn,[L[8]||(L[8]=e("h4",{class:"text-sm font-normal"},"Prepared Transactions",-1)),e("div",Mn,[w(P,{"column-defs":t(T),"row-data":t(j),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])])])])])}}}),Fn=He(On,[["__scopeId","data-v-07dc1849"]]),zn=5e3;function Hn(n){const r=B("activity"),u=B(!0),s=B(zn),o=B(null),v=B(!1),c=B(!1),x=B(!1),h=B(!1),m=B(!1),_=B(!1),$=B(null),b=B(null),p=B(null),S=B(null),l=B(""),a=Je(l,350),d=I(()=>!!n.value),T=B(!0);Ce(()=>{T.value=!1}),Te(()=>{T.value=!0});const j=()=>{o.value=null,$.value=null,b.value=null,p.value=null,S.value=null},R=async(C,D)=>{var Y;try{return o.value=null,await C()}catch(W){const ye=((Y=W==null?void 0:W.data)==null?void 0:Y.message)||(W==null?void 0:W.message)||(W==null?void 0:W.statusMessage)||D;return o.value=ye,null}},F=async(C={})=>{if(!d.value)return null;C.silent||(x.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/dashboard",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch activity dashboard");return D&&($.value=D),C.silent||(x.value=!1),D},U=async(C={})=>{if(!d.value)return null;C.silent||(h.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/state",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch active sessions and locks");return D&&(b.value=D),C.silent||(h.value=!1),D},q=async(C={})=>{if(!d.value)return null;C.silent||(m.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/configuration",{method:"POST",body:{...ne(n.value),search:a.value||void 0}}),"Failed to fetch PostgreSQL settings");return D&&(p.value=D),C.silent||(m.value=!1),D},k=async(C={})=>{if(!d.value)return null;C.silent||(_.value=!0);const D=await R(async()=>await $fetch("/api/instance-insights/replication",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch replication status");return D&&(S.value=D),C.silent||(_.value=!1),D},M=async(C=r.value,D={})=>{switch(C){case"activity":await F(D);break;case"state":await Promise.all([F({silent:!0}),U(D)]);break;case"configuration":await Promise.all([F({silent:!0}),q(D)]);break;case"replication":await Promise.all([F({silent:!0}),k(D)]);break;default:await F(D);break}},z=async(C={})=>{await Promise.all([F(C),U(C),q(C),k(C)])},y=async(C,D)=>{if(!d.value)return!1;c.value=!0;const Y=await R(C,"Action failed");return c.value=!1,Y?(Y.success?be(D,{description:Y.message}):be(Y.message,{description:"The server did not complete this action."}),Y.success):(be(o.value||"Action failed",{description:"Check database permissions and try again."}),!1)},L=async C=>{await y(async()=>await $fetch("/api/instance-insights/cancel-query",{method:"POST",body:{...ne(n.value),pid:C}}),`Cancelled query for PID ${C}`)&&await U({silent:!0})},K=async C=>{await y(async()=>await $fetch("/api/instance-insights/terminate-connection",{method:"POST",body:{...ne(n.value),pid:C}}),`Terminated connection for PID ${C}`)&&(await U({silent:!0}),await F({silent:!0}))},A=async C=>{await y(async()=>await $fetch("/api/instance-insights/drop-slot",{method:"POST",body:{...ne(n.value),slotName:C}}),`Dropped replication slot "${C}"`)&&await k({silent:!0})},P=async C=>{await y(async()=>await $fetch("/api/instance-insights/toggle-slot-status",{method:"POST",body:{...ne(n.value),slotName:C.slotName,desiredStatus:C.desiredStatus,activePid:C.activePid??null,slotType:C.slotType??null}}),`Turned ${C.desiredStatus} slot "${C.slotName}"`)&&await k({silent:!0})},Q=async()=>{if(!d.value){j();return}v.value=!0,await z(),v.value=!1};re(()=>n.value,async C=>{if(!C){j();return}await Q()},{immediate:!0}),re(()=>a.value,async()=>{r.value!=="configuration"||!d.value||await q({silent:!0})}),re(()=>r.value,async C=>{d.value&&(C==="state"&&!b.value&&await U(),C==="configuration"&&!p.value&&await q(),C==="replication"&&!S.value&&await k())});const{pause:Z,resume:ae,isActive:ve}=Le(async()=>{!d.value||!T.value||await M(r.value,{silent:!0})},s,{immediate:!1});return re(()=>u.value,C=>{C?ae():Z()},{immediate:!0}),{activeSection:r,autoRefresh:u,isAutoRefreshRunning:ve,error:o,isInitialLoading:v,isActionLoading:c,isDashboardLoading:x,isStateLoading:h,isConfigurationLoading:m,isReplicationLoading:_,dashboard:$,state:b,configuration:p,replication:S,configurationSearch:l,refreshSection:M,refreshAll:z,fetchDashboard:F,fetchState:U,fetchConfiguration:q,fetchReplication:k,cancelQuery:L,terminateConnection:K,dropReplicationSlot:A,toggleReplicationSlotStatus:P}}const Vn={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},jn={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Kn={class:"space-y-1"},Un={class:"flex items-center gap-2"},Gn={class:"text-sm text-muted-foreground flex items-center gap-0.5"},qn={class:"flex items-center gap-0.5"},Qn={class:"font-medium text-foreground"},Xn={key:0,class:"flex items-center gap-1.5 mt-0.5"},Wn={class:"flex items-center gap-2 flex-wrap"},Yn={class:"text-xs flex items-center gap-2"},Jn={class:"flex items-center justify-between gap-2"},Zn={class:"text-xs text-muted-foreground"},eo={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},to={key:1,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},so={key:2,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},no=X({__name:"InstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const r=[{id:"activity",tabLabel:"Activity",subtitle:"Sessions, TPS, tuples and block I/O",icon:"hugeicons:artificial-intelligence-08"},{id:"state",tabLabel:"State",subtitle:"Active sessions, locks, prepared transactions",icon:"hugeicons:shield-01"},{id:"configuration",tabLabel:"Config",subtitle:"Searchable pg_settings",icon:"hugeicons:settings-01"},{id:"replication",tabLabel:"Replication",subtitle:"Replication stats and slots",icon:"hugeicons:database"}],u=$e(),s=I(()=>u.selectedConnection),{activeSection:o,autoRefresh:v,error:c,isInitialLoading:x,isActionLoading:h,isDashboardLoading:m,isStateLoading:_,isConfigurationLoading:$,isReplicationLoading:b,dashboard:p,state:S,configuration:l,replication:a,configurationSearch:d,refreshSection:T,refreshAll:j,cancelQuery:R,terminateConnection:F,dropReplicationSlot:U,toggleReplicationSlotStatus:q}=Hn(s);I(()=>r.find(A=>A.id===o.value));const k=I(()=>{var A,P,Q,Z;return o.value==="activity"?(A=p.value)==null?void 0:A.capturedAt:o.value==="state"?(P=S.value)==null?void 0:P.capturedAt:o.value==="configuration"?(Q=l.value)==null?void 0:Q.capturedAt:(Z=a.value)==null?void 0:Z.capturedAt}),M=()=>T("activity"),z=()=>T("state"),y=()=>T("configuration"),L=()=>T("replication"),K=A=>q(A);return(A,P)=>{var W,ye;const Q=me,Z=xe,ae=Ae,ve=ce,C=De,D=Be,Y=Pe;return f(),g("div",Vn,[e("div",jn,[e("div",Kn,[e("div",Un,[w(Q,{name:"hugeicons:database",class:"size-5 text-primary"}),P[4]||(P[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",Gn,[P[5]||(P[5]=N(" connection: ")),e("div",qn,[A.dbType?(f(),J(Re((W=t(Ke)(A.dbType))==null?void 0:W.icon),{key:0,class:"size-4!"})):O("",!0),e("span",Qn,i(A.databaseName),1)])]),(ye=t(p))!=null&&ye.version?(f(),g("div",Xn,[w(Z,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[N(" PostgreSQL "+i(t(p).version),1)]),_:1})])):O("",!0)]),e("div",Wn,[e("div",Yn,[w(ae,{id:"insights-auto-refresh","model-value":t(v),"onUpdate:modelValue":P[0]||(P[0]=ee=>le(v)?v.value=ee:null),class:"cursor-pointer"},null,8,["model-value"]),P[6]||(P[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(ve,{variant:"outline",size:"sm",disabled:t(x)||t(h),onClick:P[1]||(P[1]=ee=>t(j)()),class:"font-normal"},{default:E(()=>[w(Q,{name:"hugeicons:redo",class:"size-4"}),P[7]||(P[7]=N(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Jn,[w(Y,{modelValue:t(o),"onUpdate:modelValue":P[2]||(P[2]=ee=>le(o)?o.value=ee:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[w(D,{size:"sm",class:"max-w-full overflow-x-auto justify-start!"},{default:E(()=>[(f(),g(H,null,V(r,ee=>w(C,{size:"xs",key:ee.id,value:ee.id,class:"rounded-sm cursor-pointer min-w-fit shrink-0",onClick:gr=>t(T)(ee.id,{silent:!0})},{default:E(()=>[w(Q,{name:ee.icon,class:"size-3.5!"},null,8,["name"]),N(" "+i(ee.tabLabel),1)]),_:2},1032,["value","onClick"])),64))]),_:1})]),_:1},8,["modelValue"]),e("div",Zn," Last updated: "+i(t(he)(t(k))),1)]),t(c)?(f(),g("div",eo,i(t(c)),1)):O("",!0),t(x)&&!t(p)?(f(),g("div",to,[w(Q,{name:"hugeicons:redo",class:"size-4 animate-spin"}),P[8]||(P[8]=N(" Loading instance insights... "))])):(f(),g("div",so,[te(w(sn,{dashboard:t(p),isLoading:t(m),isActionLoading:t(h),onRefresh:M},null,8,["dashboard","isLoading","isActionLoading"]),[[se,t(o)==="activity"]]),te(w(Fn,{state:t(S),isLoading:t(_),isActionLoading:t(h),onRefresh:z,onCancelQuery:t(R),onTerminateConnection:t(F)},null,8,["state","isLoading","isActionLoading","onCancelQuery","onTerminateConnection"]),[[se,t(o)==="state"]]),te(w(dn,{search:t(d),"onUpdate:search":P[3]||(P[3]=ee=>le(d)?d.value=ee:null),configuration:t(l),isLoading:t($),isActionLoading:t(h),onRefresh:y},null,8,["search","configuration","isLoading","isActionLoading"]),[[se,t(o)==="configuration"]]),te(w(Sn,{replication:t(a),isLoading:t(b),isActionLoading:t(h),onRefresh:L,onDropSlot:t(U),onToggleSlotStatus:K},null,8,["replication","isLoading","isActionLoading","onDropSlot"]),[[se,t(o)==="replication"]])]))])}}}),oo={key:0,class:"space-y-4"},ao={class:"flex items-start justify-between gap-3 flex-wrap"},io={class:"text-sm font-medium"},ro={class:"text-xs text-muted-foreground"},lo={key:1,class:"flex gap-2 flex-wrap"},uo={key:2,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},co={class:"text-xs uppercase text-muted-foreground"},mo={class:"text-sm font-semibold leading-none tabular-nums"},po={key:0,class:"text-[11px] text-muted-foreground"},fo={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2.5"},go={class:"text-xs uppercase text-muted-foreground"},vo={class:"text-sm font-medium leading-tight break-words"},bo={key:0,class:"text-[11px] text-muted-foreground"},_o={key:4,class:"space-y-2"},ho={class:"font-medium"},yo={class:"text-xs mt-1"},xo={class:"text-sm font-normal"},$o={key:0,class:"text-xs text-muted-foreground"},So={key:0,class:"text-xs text-muted-foreground"},wo=360,ko=120,Io=44,Co=36,To=X({__name:"InstanceInsightsSectionRenderer",props:{section:{},search:{}},setup(n){const r=n,u=I(()=>{var m;return((m=r.search)==null?void 0:m.trim().toLowerCase())||""}),s=I(()=>r.section?!r.section.searchable||!u.value?r.section.tables||[]:(r.section.tables||[]).map(m=>({...m,rows:m.rows.filter(_=>Object.values(_).some($=>String($??"").toLowerCase().includes(u.value)))})):[]),o=m=>m<=0?ko:Math.min(wo,Io+m*Co),v=m=>m==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":m==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700",c=m=>m==="success"?"border-emerald-200 bg-emerald-50":m==="warning"?"border-amber-200 bg-amber-50":m==="danger"?"border-red-200 bg-red-50":m==="info"?"border-sky-200 bg-sky-50":"border-border bg-background",x=m=>m==="unsupported"?"border-amber-300 bg-amber-50 text-amber-700":m==="unavailable"?"border-red-300 bg-red-50 text-red-700":"border-emerald-300 bg-emerald-50 text-emerald-700",h=m=>m==="pass"?"border-emerald-200 bg-emerald-50 text-emerald-700":m==="warn"?"border-amber-200 bg-amber-50 text-amber-700":m==="fail"?"border-red-200 bg-red-50 text-red-700":"border-sky-200 bg-sky-50 text-sky-700";return(m,_)=>{var p,S,l,a;const $=xe,b=Se;return m.section?(f(),g("div",oo,[e("div",ao,[e("div",null,[e("h3",io,i(m.section.title),1),e("p",ro,i(m.section.subtitle),1)]),w($,{class:oe(x(m.section.status)),variant:"outline"},{default:E(()=>[N(i(m.section.status),1)]),_:1},8,["class"])]),m.section.statusMessage?(f(),g("div",{key:0,class:oe(["border rounded-lg p-3 text-sm",x(m.section.status)])},i(m.section.statusMessage),3)):O("",!0),(p=m.section.actions)!=null&&p.length?(f(),g("div",lo,[(f(!0),g(H,null,V(m.section.actions,d=>(f(),J($,{key:d.id,class:oe(v(d.state)),variant:"outline"},{default:E(()=>[N(i(d.label)+" · "+i(d.state),1)]),_:2},1032,["class"]))),128))])):O("",!0),(S=m.section.cards)!=null&&S.length?(f(),g("div",uo,[(f(!0),g(H,null,V(m.section.cards,d=>(f(),g("div",{key:d.id,class:oe(["h-full border rounded-lg p-2.5 space-y-1.5",c(d.tone)])},[e("p",co,i(d.label),1),e("p",mo,i(d.value),1),d.helperText?(f(),g("p",po,i(d.helperText),1)):O("",!0)],2))),128))])):O("",!0),(l=m.section.details)!=null&&l.length?(f(),g("div",fo,[(f(!0),g(H,null,V(m.section.details,d=>(f(),g("div",{key:`${d.label}-${d.value}`,class:oe(["border rounded-lg p-2.5 space-y-1",c(d.tone)])},[e("p",go,i(d.label),1),e("p",vo,i(d.value),1),d.helperText?(f(),g("p",bo,i(d.helperText),1)):O("",!0)],2))),128))])):O("",!0),(a=m.section.checks)!=null&&a.length?(f(),g("div",_o,[(f(!0),g(H,null,V(m.section.checks,d=>(f(),g("div",{key:d.id,class:oe(["border rounded-lg p-3 text-sm",h(d.status)])},[e("p",ho,i(d.label),1),e("p",yo,i(d.detail),1)],2))),128))])):O("",!0),(f(!0),g(H,null,V(t(s),d=>(f(),g("div",{key:d.id,class:"space-y-1.5"},[e("div",null,[e("h4",xo,i(d.title),1),d.description?(f(),g("p",$o,i(d.description),1)):O("",!0)]),e("div",{class:"max-h-[360px]",style:Ie({height:`${o(d.rows.length)}px`})},[w(b,{"column-defs":t(pe)({columns:t(Qe)(d.columns.map(T=>T.key)),rows:d.rows,columnKeyBy:"field"}),"row-data":t(fe)(d.rows),"column-types":t(ge),class:"h-full border rounded-md"},null,8,["column-defs","row-data","column-types"])],4),d.emptyMessage&&d.rows.length===0?(f(),g("p",So,i(d.emptyMessage),1)):O("",!0)]))),128))])):O("",!0)}}}),Lo=5e3;function Ro(n){const r=B(null),u=B("overview"),s=B(!0),o=B(""),v=B(null),c=B(!1),x=B(!1),h=I(()=>!!n.value),m=B(!0);Ce(()=>{m.value=!1}),Te(()=>{m.value=!0});const _=()=>{v.value=null,r.value=null,o.value="",u.value="overview"},$=async(d={})=>{var T,j;if(!h.value)return _(),null;d.silent||(x.value=!0);try{v.value=null;const R=await $fetch("/api/instance-insights/view",{method:"POST",body:{...ne(n.value)}});return r.value=R,R.sections.some(F=>F.id===u.value)||(u.value=((T=R.sections[0])==null?void 0:T.id)||"overview"),R}catch(R){const F=((j=R==null?void 0:R.data)==null?void 0:j.message)||(R==null?void 0:R.message)||(R==null?void 0:R.statusMessage)||"Failed to fetch instance insights";return v.value=F,null}finally{d.silent||(x.value=!1)}},b=async(d=u.value,T={})=>$(T),p=async(d={})=>$(d),S=async()=>{if(!h.value){_();return}c.value=!0,await $(),c.value=!1};re(()=>n.value,async d=>{if(!d){_();return}await S()},{immediate:!0});const{pause:l,resume:a}=Le(async()=>{!h.value||!m.value||await $({silent:!0})},Lo,{immediate:!1});return re(()=>s.value,d=>{d?a():l()},{immediate:!0}),{view:r,activeSection:u,autoRefresh:s,configurationSearch:o,error:v,isInitialLoading:c,isViewLoading:x,refreshSection:b,refreshAll:p}}const Ao={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Po={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Bo={class:"space-y-2"},Do={class:"space-y-1"},Eo={class:"flex items-center gap-2"},No={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Mo={class:"flex items-center gap-0.5"},Oo={class:"font-medium text-foreground"},Fo={key:0,class:"flex items-center gap-1.5 mt-0.5"},zo={key:0,class:"flex gap-2 flex-wrap"},Ho={class:"flex items-center gap-2 flex-wrap"},Vo={class:"text-xs flex items-center gap-2"},jo={class:"flex items-center justify-between gap-2"},Ko={class:"text-xs text-muted-foreground"},Uo={key:0,class:"border rounded-lg p-3 bg-background"},Go={class:"relative"},qo={key:1,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Qo={key:2,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Xo={key:3,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},Wo=X({__name:"MultiDbInstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const r=$e(),{selectedConnection:u}=je(r),{view:s,activeSection:o,autoRefresh:v,configurationSearch:c,error:x,isInitialLoading:h,isViewLoading:m,refreshSection:_,refreshAll:$}=Ro(u),b=I(()=>{var l;return((l=s.value)==null?void 0:l.sections.find(a=>a.id===o.value))||null}),p=I(()=>{var l,a;return((l=b.value)==null?void 0:l.capturedAt)||((a=s.value)==null?void 0:a.capturedAt)||null}),S=l=>l==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":l==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700";return(l,a)=>{var M,z,y,L,K;const d=me,T=xe,j=Ae,R=ce,F=De,U=Be,q=Pe,k=Ve;return f(),g("div",Ao,[e("div",Po,[e("div",Bo,[e("div",Do,[e("div",Eo,[w(d,{name:"hugeicons:database",class:"size-5 text-primary"}),a[4]||(a[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",No,[a[5]||(a[5]=N(" connection: ")),e("div",Mo,[l.dbType?(f(),J(Re((M=t(Ke)(l.dbType))==null?void 0:M.icon),{key:0,class:"size-4!"})):O("",!0),e("span",Oo,i(l.databaseName),1)])]),(z=t(s))!=null&&z.version?(f(),g("div",Fo,[w(T,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[N(i(l.dbType===t(ue).MARIADB?"MariaDB":l.dbType===t(ue).ORACLE?"Oracle":l.dbType===t(ue).SQLITE3?"SQLite":"MySQL")+" "+i(t(s).version),1)]),_:1})])):O("",!0)]),(L=(y=t(s))==null?void 0:y.actions)!=null&&L.length?(f(),g("div",zo,[(f(!0),g(H,null,V(t(s).actions,A=>(f(),J(T,{key:A.id,class:oe(S(A.state)),variant:"outline"},{default:E(()=>[N(i(A.label)+" · "+i(A.state),1)]),_:2},1032,["class"]))),128))])):O("",!0)]),e("div",Ho,[e("div",Vo,[w(j,{id:"insights-auto-refresh","model-value":t(v),"onUpdate:modelValue":a[0]||(a[0]=A=>le(v)?v.value=A:null),class:"cursor-pointer"},null,8,["model-value"]),a[6]||(a[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(R,{variant:"outline",size:"sm",disabled:t(h)||t(m),class:"font-normal",onClick:a[1]||(a[1]=A=>t($)())},{default:E(()=>[w(d,{name:"hugeicons:redo",class:"size-4"}),a[7]||(a[7]=N(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",jo,[w(q,{modelValue:t(o),"onUpdate:modelValue":a[2]||(a[2]=A=>le(o)?o.value=A:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[w(U,{size:"sm",class:"max-w-full overflow-x-auto justify-start!"},{default:E(()=>{var A;return[(f(!0),g(H,null,V(((A=t(s))==null?void 0:A.sections)||[],P=>(f(),J(F,{size:"xs",key:P.id,value:P.id,class:"rounded-sm cursor-pointer min-w-fit shrink-0",onClick:Q=>t(_)(P.id,{silent:!0})},{default:E(()=>[N(i(P.title),1)]),_:2},1032,["value","onClick"]))),128))]}),_:1})]),_:1},8,["modelValue"]),e("div",Ko," Last updated: "+i(t(he)(t(p))),1)]),(K=t(b))!=null&&K.searchable?(f(),g("div",Uo,[e("div",Go,[w(d,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w(k,{modelValue:t(c),"onUpdate:modelValue":a[3]||(a[3]=A=>le(c)?c.value=A:null),type:"text",placeholder:t(b).searchPlaceholder||"Search...",class:"h-8 w-full pl-8 pr-3"},null,8,["modelValue","placeholder"])])])):O("",!0),t(x)?(f(),g("div",qo,i(t(x)),1)):O("",!0),t(h)&&!t(s)?(f(),g("div",Qo,[w(d,{name:"hugeicons:redo",class:"size-4 animate-spin"}),a[8]||(a[8]=N(" Loading instance insights... "))])):(f(),g("div",Xo,[w(To,{section:t(b),search:t(c)},null,8,["section","search"])]))])}}}),Yo={class:"space-y-4"},Jo={class:"grid gap-3 md:grid-cols-2"},Zo={class:"rounded-lg border p-3"},ea={class:"mt-1 text-lg font-medium"},ta={class:"rounded-lg border p-3"},sa={class:"mt-1 text-lg font-medium"},na={key:0,class:"rounded-lg border p-3"},oa={class:"mt-3 space-y-2 text-xs"},aa={class:"rounded-lg border p-3"},ia={class:"mt-3 space-y-2 text-xs"},ra={class:"flex items-start justify-between gap-3"},la={class:"font-medium"},da={class:"text-muted-foreground"},ua={class:"text-muted-foreground"},ca=X({__name:"RedisClientsSection",props:{clients:{},isActionLoading:{type:Boolean}},emits:["kill-client"],setup(n,{emit:r}){const u=r,s=new Intl.NumberFormat;function o(v){return v==null||v===""?"0":s.format(Number(v))}return(v,c)=>{var h,m,_,$,b;const x=ce;return f(),g("div",Yo,[e("div",Jo,[e("div",Zo,[c[0]||(c[0]=e("p",{class:"text-xs text-muted-foreground"},"Connected clients",-1)),e("p",ea,i(o((h=v.clients)==null?void 0:h.connectedClients)),1)]),e("div",ta,[c[1]||(c[1]=e("p",{class:"text-xs text-muted-foreground"},"Suspicious clients",-1)),e("p",sa,i(o((((m=v.clients)==null?void 0:m.suspiciousClients)||[]).length)),1)])]),(((_=v.clients)==null?void 0:_.suspiciousClients)||[]).length?(f(),g("div",na,[c[2]||(c[2]=e("h3",{class:"text-sm font-medium"},"Suspicious clients",-1)),e("div",oa,[(f(!0),g(H,null,V((($=v.clients)==null?void 0:$.suspiciousClients)||[],p=>(f(),g("div",{key:`${p.clientId}-${p.reason}`,class:"rounded-md bg-muted/20 px-3 py-2"},i(p.reason),1))),128))])])):O("",!0),e("div",aa,[c[4]||(c[4]=e("h3",{class:"text-sm font-medium"},"Client list",-1)),e("div",ia,[(f(!0),g(H,null,V(((b=v.clients)==null?void 0:b.clients)||[],p=>(f(),g("div",{key:p.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",ra,[e("div",null,[e("p",la,i(p.addr),1),e("p",da,i(p.name)+" · db "+i(p.db)+" · "+i(p.cmd),1),e("p",ua," age "+i(o(p.ageSeconds))+"s · idle "+i(o(p.idleSeconds))+"s ",1)]),w(x,{size:"sm",variant:"outline",disabled:v.isActionLoading,onClick:S=>u("kill-client",p.id)},{default:E(()=>c[3]||(c[3]=[N(" Kill client ")])),_:2},1032,["disabled","onClick"])])]))),128))])])])}}}),ma={class:"space-y-2"},pa={class:"text-muted-foreground"},fa=X({__name:"RedisConfigSection",props:{config:{}},setup(n){return(r,u)=>(f(),g("div",ma,[(f(!0),g(H,null,V(r.config||[],s=>(f(),g("div",{key:s.name,class:"flex items-center justify-between rounded-md border px-3 py-2 text-sm"},[e("span",null,i(s.name),1),e("span",pa,i(s.value||"not set"),1)]))),128))]))}}),ga={class:"space-y-4"},va={class:"grid gap-3 md:grid-cols-4"},ba={class:"rounded-lg border p-3"},_a={class:"mt-1 text-lg font-medium"},ha={class:"rounded-lg border p-3"},ya={class:"mt-1 text-lg font-medium"},xa={class:"rounded-lg border p-3"},$a={class:"mt-1 text-lg font-medium"},Sa={class:"rounded-lg border p-3"},wa={class:"mt-1 text-lg font-medium"},ka={class:"grid gap-4 lg:grid-cols-2"},Ia={class:"rounded-lg border p-3"},Ca={class:"mt-3 space-y-2 text-sm"},Ta={class:"text-muted-foreground"},La={class:"rounded-lg border p-3"},Ra={class:"mt-3 space-y-2 text-sm"},Aa={class:"text-muted-foreground"},Pa={class:"rounded-lg border p-3"},Ba={class:"mt-3 flex flex-wrap gap-2"},Da={class:"mt-3 text-xs text-muted-foreground"},Ea=X({__name:"RedisKeyspaceSection",props:{keyspace:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var c,x,h,m,_,$,b,p;const v=xe;return f(),g("div",ga,[e("div",va,[e("div",ba,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Expired key count",-1)),e("p",_a,i(u((c=s.keyspace)==null?void 0:c.expiredKeyCount)),1)]),e("div",ha,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Avg TTL",-1)),e("p",ya,i(u((x=s.keyspace)==null?void 0:x.avgTtl)),1)]),e("div",xa,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Keys without TTL",-1)),e("p",$a,i(u((h=s.keyspace)==null?void 0:h.keysWithoutTtl)),1)]),e("div",Sa,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Sampled keys",-1)),e("p",wa,i(u((m=s.keyspace)==null?void 0:m.sampledKeys)),1)])]),e("div",ka,[e("div",Ia,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Databases",-1)),e("div",Ca,[(f(!0),g(H,null,V(((_=s.keyspace)==null?void 0:_.databases)||[],S=>(f(),g("div",{key:S.database,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(S.database),1),e("span",Ta,i(u(S.keyCount))+" keys · "+i(u(S.expires))+" expiring · avg TTL "+i(u(S.avgTtl)),1)]))),128))])]),e("div",La,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Top prefixes",-1)),e("div",Ra,[(f(!0),g(H,null,V((($=s.keyspace)==null?void 0:$.topPrefixes)||[],S=>(f(),g("div",{key:S.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(S.prefix),1),e("span",Aa,i(u(S.keyCount))+" keys ",1)]))),128))])])]),e("div",Pa,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Key type distribution",-1)),e("div",Ba,[(f(!0),g(H,null,V(((b=s.keyspace)==null?void 0:b.keyTypeDistribution)||[],S=>(f(),J(v,{key:S.type,variant:"outline"},{default:E(()=>[N(i(S.type)+" · "+i(u(S.count)),1)]),_:2},1024))),128))]),e("p",Da,i((p=s.keyspace)==null?void 0:p.hotKeysNote),1)])])}}}),Na={class:"space-y-4"},Ma={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Oa={class:"rounded-lg border p-3"},Fa={class:"mt-1 text-lg font-medium"},za={class:"rounded-lg border p-3"},Ha={class:"mt-1 text-lg font-medium"},Va={class:"rounded-lg border p-3"},ja={class:"mt-1 text-lg font-medium"},Ka={class:"rounded-lg border p-3"},Ua={class:"mt-1 text-lg font-medium"},Ga={class:"grid gap-4 lg:grid-cols-2"},qa={class:"rounded-lg border p-3"},Qa={class:"mt-3 space-y-2 text-sm"},Xa={class:"text-muted-foreground"},Wa={class:"rounded-lg border p-3"},Ya={class:"mt-3 space-y-2 text-sm"},Ja={class:"flex items-center justify-between gap-2"},Za={class:"truncate"},ei={class:"mt-1 text-xs text-muted-foreground"},ti=X({__name:"RedisMemorySection",props:{memory:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var x,h,m,_,$,b,p,S;const v=Ee,c=xe;return f(),g("div",Na,[e("div",Ma,[e("div",Oa,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Used memory",-1)),e("p",Fa,i((x=s.memory)==null?void 0:x.usedMemoryHuman),1)]),e("div",za,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Peak memory",-1)),e("p",Ha,i((h=s.memory)==null?void 0:h.usedMemoryPeakHuman),1)]),e("div",Va,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Fragmentation",-1)),e("p",ja,i((m=s.memory)==null?void 0:m.memoryFragmentationRatio.toFixed(2)),1)]),e("div",Ka,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Maxmemory / policy",-1)),e("p",Ua,i((_=s.memory)==null?void 0:_.maxmemoryHuman)+" · "+i(($=s.memory)==null?void 0:$.maxmemoryPolicy),1)])]),(f(!0),g(H,null,V(((b=s.memory)==null?void 0:b.warnings)||[],l=>(f(),J(v,{key:l,variant:"secondary"},{default:E(()=>[N(i(l),1)]),_:2},1024))),128)),e("div",Ga,[e("div",qa,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Top prefixes by memory",-1)),e("div",Qa,[(f(!0),g(H,null,V(((p=s.memory)==null?void 0:p.topPrefixesByMemory)||[],l=>(f(),g("div",{key:l.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(l.prefix),1),e("span",Xa,i(u(l.keyCount))+" keys · "+i(u(l.memoryBytes))+" B ",1)]))),128))])]),e("div",Wa,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Big keys detector",-1)),e("div",Ya,[(f(!0),g(H,null,V(((S=s.memory)==null?void 0:S.bigKeys)||[],l=>(f(),g("div",{key:l.key,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",Ja,[e("span",Za,i(l.key),1),w(c,{variant:"outline"},{default:E(()=>[N(i(l.type),1)]),_:2},1024)]),e("p",ei," TTL "+i(l.ttl>=0?l.ttl:"persisted")+" · "+i(u(l.memoryBytes))+" B ",1)]))),128))])])])])}}}),si={class:"space-y-4"},ni={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},oi={class:"text-xs text-muted-foreground"},ai={class:"mt-1 text-lg font-medium"},ii=X({__name:"RedisOverviewSection",props:{overview:{}},setup(n){const r=n,u=new Intl.NumberFormat;function s(c){return c==null||c===""?"0":u.format(Number(c))}function o(c){return`${(c*100).toFixed(1)}%`}const v=I(()=>{const c=r.overview;return c?[{label:"Redis version",value:c.redisVersion},{label:"Mode",value:c.mode},{label:"Uptime",value:We(c.uptimeSeconds)},{label:"Connected clients",value:s(c.connectedClients)},{label:"Used memory",value:c.usedMemoryHuman},{label:"Total keys",value:s(c.totalKeys)},{label:"Hit rate",value:o(c.hitRate)},{label:"Ops/sec",value:s(c.opsPerSec)},{label:"Evicted keys",value:s(c.evictedKeys)},{label:"Expired keys",value:s(c.expiredKeys)},{label:"Rejected connections",value:s(c.rejectedConnections)}]:[]});return(c,x)=>(f(),g("div",si,[e("div",ni,[(f(!0),g(H,null,V(t(v),h=>(f(),g("div",{key:h.label,class:"rounded-lg border p-3"},[e("p",oi,i(h.label),1),e("p",ai,i(h.value),1)]))),128))])]))}}),ri={class:"space-y-4"},li={class:"grid gap-3 md:grid-cols-3"},di={class:"rounded-lg border p-3"},ui={class:"mt-1 text-lg font-medium"},ci={class:"rounded-lg border p-3"},mi={class:"mt-1 text-lg font-medium"},pi={class:"rounded-lg border p-3"},fi={class:"mt-1 text-lg font-medium"},gi={class:"rounded-lg border p-3"},vi={class:"mt-3 whitespace-pre-wrap text-xs text-muted-foreground"},bi={class:"grid gap-4 lg:grid-cols-2"},_i={class:"rounded-lg border p-3"},hi={class:"mt-3 space-y-2 text-xs"},yi={class:"flex items-center justify-between gap-2"},xi={class:"font-medium"},$i={class:"mt-1 text-muted-foreground"},Si={class:"rounded-lg border p-3"},wi={class:"mt-3 space-y-2 text-xs"},ki={class:"text-muted-foreground"},Ii={class:"rounded-lg border p-3"},Ci={class:"mt-3 space-y-2 text-xs"},Ti={key:0,class:"text-muted-foreground"},Li={class:"text-muted-foreground"},Ri=X({__name:"RedisPerformanceSection",props:{performance:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var v,c,x,h,m,_,$,b;return f(),g("div",ri,[e("div",li,[e("div",di,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Ops/sec",-1)),e("p",ui,i(u((v=s.performance)==null?void 0:v.instantaneousOpsPerSec)),1)]),e("div",ci,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Total commands",-1)),e("p",mi,i(u((c=s.performance)==null?void 0:c.totalCommandsProcessed)),1)]),e("div",pi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Blocked clients",-1)),e("p",fi,i(u((x=s.performance)==null?void 0:x.blockedClients)),1)])]),e("div",gi,[o[3]||(o[3]=e("h3",{class:"text-sm font-medium"},"Latency doctor",-1)),e("pre",vi,i(((h=s.performance)==null?void 0:h.latencyDoctor)||"No latency doctor output available."),1)]),e("div",bi,[e("div",_i,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Slowlog",-1)),e("div",hi,[(f(!0),g(H,null,V(((m=s.performance)==null?void 0:m.slowlog)||[],p=>(f(),g("div",{key:p.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",yi,[e("span",xi,i(p.command||"unknown command"),1),e("span",null,i(u(p.durationMicros))+" µs",1)]),e("p",$i,i(p.clientAddr||"n/a")+" · "+i(p.timestamp||"unknown time"),1)]))),128))])]),e("div",Si,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Command stats",-1)),e("div",wi,[(f(!0),g(H,null,V(((_=s.performance)==null?void 0:_.commandStats)||[],p=>(f(),g("div",{key:p.command,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(p.command),1),e("span",ki,i(u(p.calls))+" calls · "+i(p.usecPerCall.toFixed(2))+" µs/call ",1)]))),128))])])]),e("div",Ii,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Long-running Lua scripts",-1)),e("div",Ci,[((($=s.performance)==null?void 0:$.longRunningLuaScripts)||[]).length?O("",!0):(f(),g("div",Ti," No active Lua script clients detected. ")),(f(!0),g(H,null,V(((b=s.performance)==null?void 0:b.longRunningLuaScripts)||[],p=>(f(),g("div",{key:p.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(p.addr),1),e("span",Li,i(p.cmd)+" · age "+i(u(p.ageSeconds))+"s ",1)]))),128))])])])}}}),Ai={class:"space-y-4"},Pi={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Bi={class:"rounded-lg border p-3"},Di={class:"mt-1 text-lg font-medium"},Ei={class:"rounded-lg border p-3"},Ni={class:"mt-1 text-lg font-medium"},Mi={class:"rounded-lg border p-3"},Oi={class:"mt-1 text-lg font-medium"},Fi={class:"rounded-lg border p-3"},zi={class:"mt-1 text-lg font-medium"},Hi={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Vi={key:0},ji=X({__name:"RedisPersistenceSection",props:{persistence:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var c,x,h,m,_,$,b,p,S;const v=Ee;return f(),g("div",Ai,[e("div",Pi,[e("div",Bi,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"RDB enabled",-1)),e("p",Di,i((c=s.persistence)!=null&&c.rdbEnabled?"Yes":"No"),1)]),e("div",Ei,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"AOF enabled",-1)),e("p",Ni,i((x=s.persistence)!=null&&x.aofEnabled?"Yes":"No"),1)]),e("div",Mi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"AOF rewrite",-1)),e("p",Oi,i((h=s.persistence)!=null&&h.aofRewriteInProgress?"In progress":"Idle"),1)]),e("div",Fi,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Changes since save",-1)),e("p",zi,i(u((m=s.persistence)==null?void 0:m.changesSinceLastSave)),1)])]),(f(!0),g(H,null,V(((_=s.persistence)==null?void 0:_.warnings)||[],l=>(f(),J(v,{key:l,variant:"secondary"},{default:E(()=>[N(i(l),1)]),_:2},1024))),128)),e("div",Hi,[e("p",null," Last save status: "+i((($=s.persistence)==null?void 0:$.lastSaveStatus)||"unknown"),1),e("p",null," Last save time: "+i(((b=s.persistence)==null?void 0:b.lastSaveTime)||"unknown"),1),e("p",null," AOF last rewrite status: "+i(((p=s.persistence)==null?void 0:p.aofLastRewriteStatus)||"unknown"),1),(S=s.persistence)!=null&&S.lastBgsaveError?(f(),g("p",Vi," Last bgsave error: "+i(s.persistence.lastBgsaveError),1)):O("",!0)])])}}}),Ki={class:"space-y-4"},Ui={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Gi={class:"rounded-lg border p-3"},qi={class:"mt-1 text-lg font-medium"},Qi={class:"rounded-lg border p-3"},Xi={class:"mt-1 text-lg font-medium"},Wi={class:"rounded-lg border p-3"},Yi={class:"mt-1 text-lg font-medium"},Ji={class:"rounded-lg border p-3"},Zi={class:"mt-1 text-lg font-medium"},er={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},tr={class:"rounded-lg border p-3"},sr={class:"mt-3 space-y-2 text-xs"},nr={key:0,class:"text-muted-foreground"},or={class:"text-muted-foreground"},ar=X({__name:"RedisReplicationSection",props:{replication:{}},setup(n){const r=new Intl.NumberFormat;function u(s){return s==null||s===""?"0":r.format(Number(s))}return(s,o)=>{var v,c,x,h,m,_,$,b,p,S,l;return f(),g("div",Ki,[e("div",Ui,[e("div",Gi,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Role",-1)),e("p",qi,i(((v=s.replication)==null?void 0:v.role)||"unknown"),1)]),e("div",Qi,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Connected replicas",-1)),e("p",Xi,i(u((c=s.replication)==null?void 0:c.connectedReplicas)),1)]),e("div",Wi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Master link status",-1)),e("p",Yi,i(((x=s.replication)==null?void 0:x.masterLinkStatus)||"n/a"),1)]),e("div",Ji,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Cluster state",-1)),e("p",Zi,i(((h=s.replication)==null?void 0:h.clusterState)||((m=s.replication)!=null&&m.clusterEnabled?"enabled":"disabled")),1)])]),e("div",er,[e("p",null,"Replication lag: "+i(((_=s.replication)==null?void 0:_.replicationLag)??"n/a"),1),e("p",null,"Sentinel masters: "+i((($=s.replication)==null?void 0:$.sentinelMasters)??"n/a"),1),e("p",null," Cluster slots assigned: "+i(((b=s.replication)==null?void 0:b.clusterSlotsAssigned)??"n/a"),1),e("p",null,"Cluster known nodes: "+i(((p=s.replication)==null?void 0:p.clusterKnownNodes)??"n/a"),1)]),e("div",tr,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Replicas",-1)),e("div",sr,[(((S=s.replication)==null?void 0:S.replicas)||[]).length?O("",!0):(f(),g("div",nr," No replica nodes reported. ")),(f(!0),g(H,null,V(((l=s.replication)==null?void 0:l.replicas)||[],a=>(f(),g("div",{key:a.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,i(a.addr),1),e("span",or,i(a.state)+" · lag "+i(a.lag??"n/a"),1)]))),128))])])])}}}),ir=5e3;function rr(n){const r=B("overview"),u=B(!0),s=B(null),o=B(!1),v=B(!1),c=B(!1),x=B(null),h=B(!0),m=I(()=>!!n.connection.value);Ce(()=>{h.value=!1}),Te(()=>{h.value=!0});const _=async(l=!1)=>{var a;if(!n.connection.value)return x.value=null,null;l||(v.value=!0);try{s.value=null;const d=await $fetch("/api/redis/instance-insights/overview",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value}});return x.value=d,d}catch(d){return s.value=((a=d==null?void 0:d.data)==null?void 0:a.message)||(d==null?void 0:d.message)||(d==null?void 0:d.statusMessage)||"Failed to fetch Redis instance insights.",null}finally{l||(v.value=!1)}},$=async l=>{var a;if(!n.connection.value)return!1;c.value=!0;try{const d=await $fetch("/api/redis/instance-insights/kill-client",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value,clientId:l}});return d.success?(be("Redis client terminated",{description:d.message}),await _(!0),!0):(be("Failed to terminate client",{description:d.message}),!1)}catch(d){return be("Failed to terminate client",{description:((a=d==null?void 0:d.data)==null?void 0:a.message)||(d==null?void 0:d.message)||"The Redis client could not be terminated."}),!1}finally{c.value=!1}},b=async()=>{await _()};re([()=>n.connection.value,()=>n.databaseIndex.value],async([l])=>{if(!l){x.value=null;return}o.value=!0,await _(),o.value=!1},{immediate:!0});const{pause:p,resume:S}=Le(async()=>{!m.value||!h.value||await _(!0)},ir,{immediate:!1});return re(()=>u.value,l=>{l?S():p()},{immediate:!0}),{activeSection:r,autoRefresh:u,error:s,isInitialLoading:o,isLoading:v,isActionLoading:c,insights:x,refresh:b,killClient:$}}const lr={class:"flex h-full flex-col gap-3 overflow-hidden p-3"},dr={class:"flex items-center gap-2 text-xs"},ur={key:1,class:"flex flex-1 items-center justify-center gap-2 rounded-lg border bg-background text-muted-foreground"},cr={key:2,class:"flex-1 overflow-y-auto rounded-lg border bg-background p-3 mt-2"},mr=X({__name:"RedisInstanceInsightsPanel",props:{databaseName:{},databaseIndex:{},databases:{},dbType:{}},emits:["update:databaseIndex"],setup(n,{emit:r}){const u=n,s=r,o=[{id:"overview",label:"Overview"},{id:"keyspace",label:"Keyspace"},{id:"memory",label:"Memory"},{id:"performance",label:"Performance"},{id:"clients",label:"Clients"},{id:"persistence",label:"Persistence"},{id:"replication",label:"Replication / Cluster"},{id:"config",label:"Config"}],v=$e(),c=I(()=>v.selectedConnection),{activeSection:x,autoRefresh:h,error:m,isInitialLoading:_,isLoading:$,isActionLoading:b,insights:p,refresh:S,killClient:l}=rr({connection:c,databaseIndex:I(()=>u.databaseIndex)});return(a,d)=>{const T=Ae,j=me,R=ce,F=Tt,U=De,q=Be,k=Ee,M=Pe;return f(),g("div",lr,[w(F,{icon:"hugeicons:activity-02",title:"Instance Insights"},{context:E(()=>[a.dbType===t(ue).REDIS?(f(),J(Re("hugeicons:database-sync-01"),{key:0})):O("",!0)]),actions:E(()=>[w(Lt,{compact:"","trigger-id":"redis-instance-insights-db-index","trigger-class":"bg-background",databases:a.databases,"database-index":a.databaseIndex,"onUpdate:databaseIndex":d[0]||(d[0]=z=>s("update:databaseIndex",z))},null,8,["databases","database-index"]),e("div",dr,[w(T,{id:"redis-insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":d[1]||(d[1]=z=>le(h)?h.value=z:null)},null,8,["model-value"]),d[3]||(d[3]=e("label",{for:"redis-insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),w(R,{size:"xxs",variant:"outline",disabled:t($)||t(b),onClick:t(S)},{default:E(()=>[w(j,{name:"hugeicons:redo",class:"size-3.5!"}),d[4]||(d[4]=N(" Refresh "))]),_:1},8,["disabled","onClick"])]),_:1}),w(M,{modelValue:t(x),"onUpdate:modelValue":d[2]||(d[2]=z=>le(x)?x.value=z:null),class:"flex flex-1 min-h-0 flex-col gap-0"},{default:E(()=>{var z,y,L,K,A,P,Q,Z;return[w(q,{size:"sm",class:"max-w-full justify-start! shrink-0 overflow-x-auto"},{default:E(()=>[(f(),g(H,null,V(o,ae=>w(U,{size:"xs",key:ae.id,value:ae.id,class:"min-w-fit shrink-0 cursor-pointer rounded-sm"},{default:E(()=>[N(i(ae.label),1)]),_:2},1032,["value"])),64))]),_:1}),t(m)?(f(),J(k,{key:0,variant:"destructive"},{default:E(()=>[N(i(t(m)),1)]),_:1})):O("",!0),t(_)&&!t(p)?(f(),g("div",ur,[w(j,{name:"hugeicons:redo",class:"size-4 animate-spin"}),d[5]||(d[5]=N(" Loading Redis instance insights... "))])):(f(),g("div",cr,[te(w(ii,{overview:(z=t(p))==null?void 0:z.overview},null,8,["overview"]),[[se,t(x)==="overview"]]),te(w(Ea,{keyspace:(y=t(p))==null?void 0:y.keyspace},null,8,["keyspace"]),[[se,t(x)==="keyspace"]]),te(w(ti,{memory:(L=t(p))==null?void 0:L.memory},null,8,["memory"]),[[se,t(x)==="memory"]]),te(w(Ri,{performance:(K=t(p))==null?void 0:K.performance},null,8,["performance"]),[[se,t(x)==="performance"]]),te(w(ca,{clients:(A=t(p))==null?void 0:A.clients,"is-action-loading":t(b),onKillClient:t(l)},null,8,["clients","is-action-loading","onKillClient"]),[[se,t(x)==="clients"]]),te(w(ji,{persistence:(P=t(p))==null?void 0:P.persistence},null,8,["persistence"]),[[se,t(x)==="persistence"]]),te(w(ar,{replication:(Q=t(p))==null?void 0:Q.replication},null,8,["replication"]),[[se,t(x)==="replication"]]),te(w(fa,{config:(Z=t(p))==null?void 0:Z.config},null,8,["config"]),[[se,t(x)==="config"]])]))]}),_:1},8,["modelValue"])])}}}),pr={class:"h-full"},fr={key:0,class:"h-full p-4 flex flex-col items-center justify-center text-muted-foreground"},Pr=X({__name:"index",setup(n){const r=Ze(),u=$e(),s=et(),{activeTab:o}=je(s),v=I(()=>String(r.params.connectionId||"")),c=I(()=>v.value?u.connections.find(b=>b.id===v.value):null),x=I(()=>{var b;return((b=c.value)==null?void 0:b.connectionString)||""}),h=I(()=>{var b;return(b=c.value)==null?void 0:b.type}),m=I(()=>{var b,p,S;return h.value===ue.REDIS?((b=c.value)==null?void 0:b.name)||"Redis":((p=c.value)==null?void 0:p.database)||((S=c.value)==null?void 0:S.name)||"database"}),_=I(()=>h.value===ue.REDIS?c.value??void 0:void 0),$=Rt({connection:_,mode:"meta"});return re(()=>{var b,p;return(p=(b=o.value)==null?void 0:b.metadata)==null?void 0:p.databaseIndex},b=>{typeof b=="number"&&($.selectedDatabaseIndex.value=b)},{immediate:!0}),(b,p)=>{const S=me;return f(),g("div",pr,[t(c)?t(h)===t(ue).REDIS?(f(),J(mr,{key:1,"database-name":t(m),"database-index":t($).selectedDatabaseIndex.value,databases:t($).databases.value,"db-type":t(h),"onUpdate:databaseIndex":p[0]||(p[0]=l=>t($).selectedDatabaseIndex.value=l)},null,8,["database-name","database-index","databases","db-type"])):t(h)===t(ue).POSTGRES?(f(),J(no,{key:2,"db-connection-string":t(x),"database-name":t(m),"db-type":t(h)},null,8,["db-connection-string","database-name","db-type"])):(f(),J(Wo,{key:3,"db-connection-string":t(x),"database-name":t(m),"db-type":t(h)},null,8,["db-connection-string","database-name","db-type"])):(f(),g("div",fr,[w(S,{name:"hugeicons:plug-socket",class:"size-12 mb-2 opacity-50"}),p[1]||(p[1]=e("p",{class:"text-sm"},"Select a connection to open Instance Insights",-1))]))])}}});export{Pr as default};
@@ -1 +1 @@
1
- import{M as ln,N as an,O as Y,P as O,Q,R as un,S as y,T as tn,V as j,W as _,X as rn,Y as o,Z as sn,$ as on,a0 as fn}from"./DYqShb5v.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,D,S,v,R,V,a){var E=D-l,i=S-h,n=V-v,d=a-R,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-R)-d*(l-v))/u,[l+u*E,h+u*i]}function H(l,h,D,S,v,R,V){var a=l-D,E=h-S,i=(V?R:-R)/j(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,W=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,A=m*m+g*g,T=v-R,P=u*c-f*s,I=(g<0?-1:1)*j(on(0,T*T*A-P*P)),M=(P*g-m*I)/A,N=(-P*m-g*I)/A,w=(P*g+m*I)/A,p=(-P*m+g*I)/A,x=M-W,e=N-t,r=w-W,X=p-t;return x*x+e*e>r*r+X*X&&(M=w,N=p),{cx:M,cy:N,x01:-n,y01:-d,x11:M*(v/T-1),y11:N*(v/T-1)}}function hn(){var l=cn,h=yn,D=Q(0),S=null,v=gn,R=dn,V=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,W=rn(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(W>tn-y)a.moveTo(s*Y(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*Y(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,A=f,T=c,P=W,I=W,M=V.apply(this,arguments)/2,N=M>y&&(S?+S.apply(this,arguments):j(u*u+s*s)),w=_(rn(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(N>y){var X=sn(N/u*O(M)),z=sn(N/s*O(M));(P-=X*2)>y?(X*=t?1:-1,A+=X,T-=X):(P=0,A=T=(f+c)/2),(I-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(I=0,m=g=(f+c)/2)}var Z=s*Y(m),$=s*O(m),B=u*Y(T),C=u*O(T);if(w>y){var F=s*Y(g),G=s*O(g),J=u*Y(A),K=u*O(A),q;if(W<an)if(q=pn(Z,$,J,K,F,G,B,C)){var L=Z-q[0],U=$-q[1],k=F-q[0],b=G-q[1],nn=1/O(fn((L*k+U*b)/(j(L*L+U*U)*j(k*k+b*b)))/2),en=j(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=H(J,K,Z,$,s,x,t),r=H(F,G,B,C,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(Z,$),a.arc(0,0,s,m,g,!t)):a.moveTo(Z,$),!(u>y)||!(P>y)?a.lineTo(B,C):p>y?(e=H(B,C,F,G,u,-p,t),r=H(Z,$,J,K,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-an/2;return[Y(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Q(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Q(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:Q(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:Q(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Q(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:Q(+n),i):R},i.padAngle=function(n){return arguments.length?(V=typeof n=="function"?n:Q(+n),i):V},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{M as ln,N as an,O as Y,P as O,Q,R as un,S as y,T as tn,V as j,W as _,X as rn,Y as o,Z as sn,$ as on,a0 as fn}from"./DSOwr8Hs.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,D,S,v,R,V,a){var E=D-l,i=S-h,n=V-v,d=a-R,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-R)-d*(l-v))/u,[l+u*E,h+u*i]}function H(l,h,D,S,v,R,V){var a=l-D,E=h-S,i=(V?R:-R)/j(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,W=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,A=m*m+g*g,T=v-R,P=u*c-f*s,I=(g<0?-1:1)*j(on(0,T*T*A-P*P)),M=(P*g-m*I)/A,N=(-P*m-g*I)/A,w=(P*g+m*I)/A,p=(-P*m+g*I)/A,x=M-W,e=N-t,r=w-W,X=p-t;return x*x+e*e>r*r+X*X&&(M=w,N=p),{cx:M,cy:N,x01:-n,y01:-d,x11:M*(v/T-1),y11:N*(v/T-1)}}function hn(){var l=cn,h=yn,D=Q(0),S=null,v=gn,R=dn,V=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,W=rn(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(W>tn-y)a.moveTo(s*Y(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*Y(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,A=f,T=c,P=W,I=W,M=V.apply(this,arguments)/2,N=M>y&&(S?+S.apply(this,arguments):j(u*u+s*s)),w=_(rn(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(N>y){var X=sn(N/u*O(M)),z=sn(N/s*O(M));(P-=X*2)>y?(X*=t?1:-1,A+=X,T-=X):(P=0,A=T=(f+c)/2),(I-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(I=0,m=g=(f+c)/2)}var Z=s*Y(m),$=s*O(m),B=u*Y(T),C=u*O(T);if(w>y){var F=s*Y(g),G=s*O(g),J=u*Y(A),K=u*O(A),q;if(W<an)if(q=pn(Z,$,J,K,F,G,B,C)){var L=Z-q[0],U=$-q[1],k=F-q[0],b=G-q[1],nn=1/O(fn((L*k+U*b)/(j(L*L+U*U)*j(k*k+b*b)))/2),en=j(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=H(J,K,Z,$,s,x,t),r=H(F,G,B,C,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(Z,$),a.arc(0,0,s,m,g,!t)):a.moveTo(Z,$),!(u>y)||!(P>y)?a.lineTo(B,C):p>y?(e=H(B,C,F,G,u,-p,t),r=H(Z,$,J,K,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-an/2;return[Y(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Q(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Q(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:Q(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:Q(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Q(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:Q(+n),i):R},i.padAngle=function(n){return arguments.length?(V=typeof n=="function"?n:Q(+n),i):V},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};