skypilot-nightly 1.0.0.dev20250623__py3-none-any.whl → 1.0.0.dev20250625__py3-none-any.whl

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 (165) hide show
  1. sky/__init__.py +2 -2
  2. sky/admin_policy.py +16 -5
  3. sky/backends/__init__.py +2 -1
  4. sky/backends/backend_utils.py +38 -11
  5. sky/backends/cloud_vm_ray_backend.py +52 -18
  6. sky/client/cli/command.py +264 -25
  7. sky/client/sdk.py +119 -85
  8. sky/clouds/aws.py +10 -7
  9. sky/clouds/azure.py +10 -7
  10. sky/clouds/cloud.py +2 -0
  11. sky/clouds/cudo.py +2 -0
  12. sky/clouds/do.py +10 -7
  13. sky/clouds/fluidstack.py +2 -0
  14. sky/clouds/gcp.py +10 -7
  15. sky/clouds/hyperbolic.py +10 -7
  16. sky/clouds/ibm.py +2 -0
  17. sky/clouds/kubernetes.py +27 -9
  18. sky/clouds/lambda_cloud.py +10 -7
  19. sky/clouds/nebius.py +10 -7
  20. sky/clouds/oci.py +10 -7
  21. sky/clouds/paperspace.py +10 -7
  22. sky/clouds/runpod.py +10 -7
  23. sky/clouds/scp.py +10 -7
  24. sky/clouds/vast.py +10 -7
  25. sky/clouds/vsphere.py +2 -0
  26. sky/core.py +89 -15
  27. sky/dag.py +14 -0
  28. sky/dashboard/out/404.html +1 -1
  29. sky/dashboard/out/_next/static/ZWdSYkqVe3WjnFR8ocqoG/_buildManifest.js +1 -0
  30. sky/dashboard/out/_next/static/chunks/230-d6e363362017ff3a.js +1 -0
  31. sky/dashboard/out/_next/static/chunks/310.2671028c20e892c7.js +16 -0
  32. sky/dashboard/out/_next/static/chunks/37-1f1e94f5a561202a.js +6 -0
  33. sky/dashboard/out/_next/static/chunks/42.bc85e5b1a4debf22.js +6 -0
  34. sky/dashboard/out/_next/static/chunks/470-92dd1614396389be.js +1 -0
  35. sky/dashboard/out/_next/static/chunks/{513.211357a2914a34b2.js → 513.309df9e18a9ff005.js} +1 -1
  36. sky/dashboard/out/_next/static/chunks/544.110e53813fb98e2e.js +1 -0
  37. sky/dashboard/out/_next/static/chunks/645.961f08e39b8ce447.js +1 -0
  38. sky/dashboard/out/_next/static/chunks/66-66ae330df2d3c1c7.js +1 -0
  39. sky/dashboard/out/_next/static/chunks/682.00e56a220dd26fe1.js +6 -0
  40. sky/dashboard/out/_next/static/chunks/697.6460bf72e760addd.js +20 -0
  41. sky/dashboard/out/_next/static/chunks/856-cdf66268ec878d0c.js +1 -0
  42. sky/dashboard/out/_next/static/chunks/938-068520cc11738deb.js +1 -0
  43. sky/dashboard/out/_next/static/chunks/969-d3a0b53f728d280a.js +1 -0
  44. sky/dashboard/out/_next/static/chunks/989-db34c16ad7ea6155.js +1 -0
  45. sky/dashboard/out/_next/static/chunks/pages/{_app-c416e87d5c2715cf.js → _app-0ef7418d1a3822f3.js} +1 -1
  46. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-aff040d7bc5d0086.js +6 -0
  47. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-32ce4f49f2261f55.js +6 -0
  48. sky/dashboard/out/_next/static/chunks/pages/clusters-4aa031d1f42723d8.js +1 -0
  49. sky/dashboard/out/_next/static/chunks/pages/config-3102d02a188f04b3.js +1 -0
  50. sky/dashboard/out/_next/static/chunks/pages/infra/[context]-6f1e02e31eecb5ce.js +1 -0
  51. sky/dashboard/out/_next/static/chunks/pages/infra-fd5dc8a91bd9169a.js +1 -0
  52. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-e4b23128db0774cd.js +16 -0
  53. sky/dashboard/out/_next/static/chunks/pages/jobs-26da173e20af16e4.js +1 -0
  54. sky/dashboard/out/_next/static/chunks/pages/users-ce29e7420385563d.js +1 -0
  55. sky/dashboard/out/_next/static/chunks/pages/volumes-476b670ef33d1ecd.js +1 -0
  56. sky/dashboard/out/_next/static/chunks/pages/workspace/new-09ae0f6f972aa871.js +1 -0
  57. sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-c4ff1ec05e2f3daf.js → [name]-0b4c662a25e4747a.js} +1 -1
  58. sky/dashboard/out/_next/static/chunks/pages/workspaces-862b120406461b10.js +1 -0
  59. sky/dashboard/out/_next/static/chunks/webpack-6133dc1e928bd0b5.js +1 -0
  60. sky/dashboard/out/_next/static/css/b23cb0257bf96c51.css +3 -0
  61. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  62. sky/dashboard/out/clusters/[cluster].html +1 -1
  63. sky/dashboard/out/clusters.html +1 -1
  64. sky/dashboard/out/config.html +1 -1
  65. sky/dashboard/out/index.html +1 -1
  66. sky/dashboard/out/infra/[context].html +1 -1
  67. sky/dashboard/out/infra.html +1 -1
  68. sky/dashboard/out/jobs/[job].html +1 -1
  69. sky/dashboard/out/jobs.html +1 -1
  70. sky/dashboard/out/users.html +1 -1
  71. sky/dashboard/out/volumes.html +1 -0
  72. sky/dashboard/out/workspace/new.html +1 -1
  73. sky/dashboard/out/workspaces/[name].html +1 -1
  74. sky/dashboard/out/workspaces.html +1 -1
  75. sky/data/storage_utils.py +2 -4
  76. sky/exceptions.py +26 -0
  77. sky/execution.py +5 -0
  78. sky/global_user_state.py +263 -20
  79. sky/jobs/client/sdk.py +13 -12
  80. sky/jobs/controller.py +5 -1
  81. sky/jobs/scheduler.py +4 -3
  82. sky/jobs/server/core.py +121 -51
  83. sky/jobs/state.py +15 -0
  84. sky/jobs/utils.py +114 -8
  85. sky/models.py +16 -0
  86. sky/provision/__init__.py +26 -0
  87. sky/provision/kubernetes/__init__.py +3 -0
  88. sky/provision/kubernetes/instance.py +38 -77
  89. sky/provision/kubernetes/utils.py +52 -2
  90. sky/provision/kubernetes/volume.py +147 -0
  91. sky/resources.py +20 -76
  92. sky/serve/client/sdk.py +13 -13
  93. sky/serve/server/core.py +5 -1
  94. sky/server/common.py +40 -5
  95. sky/server/constants.py +5 -1
  96. sky/server/metrics.py +105 -0
  97. sky/server/requests/executor.py +30 -14
  98. sky/server/requests/payloads.py +22 -3
  99. sky/server/requests/requests.py +59 -2
  100. sky/server/rest.py +152 -0
  101. sky/server/server.py +70 -19
  102. sky/server/state.py +20 -0
  103. sky/server/stream_utils.py +8 -3
  104. sky/server/uvicorn.py +153 -13
  105. sky/setup_files/dependencies.py +2 -0
  106. sky/skylet/constants.py +19 -14
  107. sky/task.py +141 -43
  108. sky/templates/jobs-controller.yaml.j2 +12 -1
  109. sky/templates/kubernetes-ray.yml.j2 +31 -2
  110. sky/users/permission.py +2 -0
  111. sky/utils/admin_policy_utils.py +5 -1
  112. sky/utils/cli_utils/status_utils.py +25 -17
  113. sky/utils/command_runner.py +118 -12
  114. sky/utils/command_runner.pyi +57 -0
  115. sky/utils/common_utils.py +9 -1
  116. sky/utils/context.py +3 -1
  117. sky/utils/controller_utils.py +1 -2
  118. sky/utils/resources_utils.py +66 -0
  119. sky/utils/rich_utils.py +6 -0
  120. sky/utils/schemas.py +180 -38
  121. sky/utils/status_lib.py +10 -0
  122. sky/utils/validator.py +11 -1
  123. sky/volumes/__init__.py +0 -0
  124. sky/volumes/client/__init__.py +0 -0
  125. sky/volumes/client/sdk.py +64 -0
  126. sky/volumes/server/__init__.py +0 -0
  127. sky/volumes/server/core.py +199 -0
  128. sky/volumes/server/server.py +85 -0
  129. sky/volumes/utils.py +158 -0
  130. sky/volumes/volume.py +198 -0
  131. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/METADATA +2 -1
  132. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/RECORD +139 -123
  133. sky/dashboard/out/_next/static/F4kiZ6Zh72jA6HzZ3ncFo/_buildManifest.js +0 -1
  134. sky/dashboard/out/_next/static/chunks/350.9e123a4551f68b0d.js +0 -1
  135. sky/dashboard/out/_next/static/chunks/37-3a4d77ad62932eaf.js +0 -6
  136. sky/dashboard/out/_next/static/chunks/42.d39e24467181b06b.js +0 -6
  137. sky/dashboard/out/_next/static/chunks/470-4d1a5dbe58a8a2b9.js +0 -1
  138. sky/dashboard/out/_next/static/chunks/641.c8e452bc5070a630.js +0 -1
  139. sky/dashboard/out/_next/static/chunks/682.4dd5dc116f740b5f.js +0 -6
  140. sky/dashboard/out/_next/static/chunks/760-a89d354797ce7af5.js +0 -1
  141. sky/dashboard/out/_next/static/chunks/856-c2c39c0912285e54.js +0 -1
  142. sky/dashboard/out/_next/static/chunks/901-b424d293275e1fd7.js +0 -1
  143. sky/dashboard/out/_next/static/chunks/938-1493ac755eadeb35.js +0 -1
  144. sky/dashboard/out/_next/static/chunks/969-20d54a9d998dc102.js +0 -1
  145. sky/dashboard/out/_next/static/chunks/984.ae8c08791d274ca0.js +0 -50
  146. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-89216c616dbaa9c5.js +0 -6
  147. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-36bc0962129f72df.js +0 -6
  148. sky/dashboard/out/_next/static/chunks/pages/clusters-82a651dbad53ec6e.js +0 -1
  149. sky/dashboard/out/_next/static/chunks/pages/config-497a35a7ed49734a.js +0 -1
  150. sky/dashboard/out/_next/static/chunks/pages/infra/[context]-d2910be98e9227cb.js +0 -1
  151. sky/dashboard/out/_next/static/chunks/pages/infra-780860bcc1103945.js +0 -1
  152. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-cf490d1fa38f3740.js +0 -16
  153. sky/dashboard/out/_next/static/chunks/pages/jobs-336ab80e270ce2ce.js +0 -1
  154. sky/dashboard/out/_next/static/chunks/pages/users-928edf039219e47b.js +0 -1
  155. sky/dashboard/out/_next/static/chunks/pages/workspace/new-31aa8bdcb7592635.js +0 -1
  156. sky/dashboard/out/_next/static/chunks/pages/workspaces-82e6601baa5dd280.js +0 -1
  157. sky/dashboard/out/_next/static/chunks/webpack-0263b00d6a10e64a.js +0 -1
  158. sky/dashboard/out/_next/static/css/6c12ecc3bd2239b6.css +0 -3
  159. /sky/dashboard/out/_next/static/{F4kiZ6Zh72jA6HzZ3ncFo → ZWdSYkqVe3WjnFR8ocqoG}/_ssgManifest.js +0 -0
  160. /sky/dashboard/out/_next/static/chunks/{843-b3040e493f6e7947.js → 843-07d25a7e64462fd8.js} +0 -0
  161. /sky/dashboard/out/_next/static/chunks/{973-db3c97c2bfbceb65.js → 973-5b5019ba333e8d62.js} +0 -0
  162. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/WHEEL +0 -0
  163. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/entry_points.txt +0 -0
  164. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/licenses/LICENSE +0 -0
  165. {skypilot_nightly-1.0.0.dev20250623.dist-info → skypilot_nightly-1.0.0.dev20250625.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[230],{8771:function(e,r,o){o.d(r,{F:function(){return l},e:function(){return i}});var t=o(7294);function n(e,r){if("function"==typeof e)return e(r);null!=e&&(e.current=r)}function l(...e){return r=>{let o=!1,t=e.map(e=>{let t=n(e,r);return o||"function"!=typeof t||(o=!0),t});if(o)return()=>{for(let r=0;r<t.length;r++){let o=t[r];"function"==typeof o?o():n(e[r],null)}}}}function i(...e){return t.useCallback(l(...e),e)}},5320:function(e,r,o){o.d(r,{WV:function(){return s},jH:function(){return a}});var t=o(7294),n=o(3935),l=o(8426),i=o(5893),s=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let o=(0,l.Z8)(`Primitive.${r}`),n=t.forwardRef((e,t)=>{let{asChild:n,...l}=e,s=n?o:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,i.jsx)(s,{...l,ref:t})});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{});function a(e,r){e&&n.flushSync(()=>e.dispatchEvent(r))}},8426:function(e,r,o){o.d(r,{Z8:function(){return i},g7:function(){return s}});var t=o(7294),n=o(8771),l=o(5893);function i(e){let r=function(e){let r=t.forwardRef((e,r)=>{let{children:o,...l}=e;if(t.isValidElement(o)){let e,i;let s=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?o.ref:(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?o.props.ref:o.props.ref||o.ref,a=function(e,r){let o={...r};for(let t in r){let n=e[t],l=r[t];/^on[A-Z]/.test(t)?n&&l?o[t]=(...e)=>{let r=l(...e);return n(...e),r}:n&&(o[t]=n):"style"===t?o[t]={...n,...l}:"className"===t&&(o[t]=[n,l].filter(Boolean).join(" "))}return{...e,...o}}(l,o.props);return o.type!==t.Fragment&&(a.ref=r?(0,n.F)(r,s):s),t.cloneElement(o,a)}return t.Children.count(o)>1?t.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}(e),o=t.forwardRef((e,o)=>{let{children:n,...i}=e,s=t.Children.toArray(n),a=s.find(d);if(a){let e=a.props.children,n=s.map(r=>r!==a?r:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,l.jsx)(r,{...i,ref:o,children:t.isValidElement(e)?t.cloneElement(e,void 0,n):null})}return(0,l.jsx)(r,{...i,ref:o,children:n})});return o.displayName=`${e}.Slot`,o}var s=i("Slot"),a=Symbol("radix.slottable");function d(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a}},512:function(e,r,o){function t(){for(var e,r,o=0,t="",n=arguments.length;o<n;o++)(e=arguments[o])&&(r=function e(r){var o,t,n="";if("string"==typeof r||"number"==typeof r)n+=r;else if("object"==typeof r){if(Array.isArray(r)){var l=r.length;for(o=0;o<l;o++)r[o]&&(t=e(r[o]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t)}return n}(e))&&(t&&(t+=" "),t+=r);return t}o.d(r,{W:function(){return t}}),r.Z=t},8388:function(e,r,o){o.d(r,{m6:function(){return L}});let t=e=>{let r=s(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:e=>{let o=e.split("-");return""===o[0]&&1!==o.length&&o.shift(),n(o,r)||i(e)},getConflictingClassGroupIds:(e,r)=>{let n=o[e]||[];return r&&t[e]?[...n,...t[e]]:n}}},n=(e,r)=>{if(0===e.length)return r.classGroupId;let o=e[0],t=r.nextPart.get(o),l=t?n(e.slice(1),t):void 0;if(l)return l;if(0===r.validators.length)return;let i=e.join("-");return r.validators.find(({validator:e})=>e(i))?.classGroupId},l=/^\[(.+)\]$/,i=e=>{if(l.test(e)){let r=l.exec(e)[1],o=r?.substring(0,r.indexOf(":"));if(o)return"arbitrary.."+o}},s=e=>{let{theme:r,prefix:o}=e,t={nextPart:new Map,validators:[]};return p(Object.entries(e.classGroups),o).forEach(([e,o])=>{a(o,t,e,r)}),t},a=(e,r,o,t)=>{e.forEach(e=>{if("string"==typeof e){(""===e?r:d(r,e)).classGroupId=o;return}if("function"==typeof e){if(c(e)){a(e(t),r,o,t);return}r.validators.push({validator:e,classGroupId:o});return}Object.entries(e).forEach(([e,n])=>{a(n,d(r,e),o,t)})})},d=(e,r)=>{let o=e;return r.split("-").forEach(e=>{o.nextPart.has(e)||o.nextPart.set(e,{nextPart:new Map,validators:[]}),o=o.nextPart.get(e)}),o},c=e=>e.isThemeGetter,p=(e,r)=>r?e.map(([e,o])=>[e,o.map(e=>"string"==typeof e?r+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,o])=>[r+e,o])):e)]):e,u=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,o=new Map,t=new Map,n=(n,l)=>{o.set(n,l),++r>e&&(r=0,t=o,o=new Map)};return{get(e){let r=o.get(e);return void 0!==r?r:void 0!==(r=t.get(e))?(n(e,r),r):void 0},set(e,r){o.has(e)?o.set(e,r):n(e,r)}}},b=e=>{let{separator:r,experimentalParseClassName:o}=e,t=1===r.length,n=r[0],l=r.length,i=e=>{let o;let i=[],s=0,a=0;for(let d=0;d<e.length;d++){let c=e[d];if(0===s){if(c===n&&(t||e.slice(d,d+l)===r)){i.push(e.slice(a,d)),a=d+l;continue}if("/"===c){o=d;continue}}"["===c?s++:"]"===c&&s--}let d=0===i.length?e:e.substring(a),c=d.startsWith("!"),p=c?d.substring(1):d;return{modifiers:i,hasImportantModifier:c,baseClassName:p,maybePostfixModifierPosition:o&&o>a?o-a:void 0}};return o?e=>o({className:e,parseClassName:i}):i},f=e=>{if(e.length<=1)return e;let r=[],o=[];return e.forEach(e=>{"["===e[0]?(r.push(...o.sort(),e),o=[]):o.push(e)}),r.push(...o.sort()),r},m=e=>({cache:u(e.cacheSize),parseClassName:b(e),...t(e)}),g=/\s+/,h=(e,r)=>{let{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:n}=r,l=[],i=e.trim().split(g),s="";for(let e=i.length-1;e>=0;e-=1){let r=i[e],{modifiers:a,hasImportantModifier:d,baseClassName:c,maybePostfixModifierPosition:p}=o(r),u=!!p,b=t(u?c.substring(0,p):c);if(!b){if(!u||!(b=t(c))){s=r+(s.length>0?" "+s:s);continue}u=!1}let m=f(a).join(":"),g=d?m+"!":m,h=g+b;if(l.includes(h))continue;l.push(h);let y=n(b,u);for(let e=0;e<y.length;++e){let r=y[e];l.push(g+r)}s=r+(s.length>0?" "+s:s)}return s};function y(){let e,r,o=0,t="";for(;o<arguments.length;)(e=arguments[o++])&&(r=x(e))&&(t&&(t+=" "),t+=r);return t}let x=e=>{let r;if("string"==typeof e)return e;let o="";for(let t=0;t<e.length;t++)e[t]&&(r=x(e[t]))&&(o&&(o+=" "),o+=r);return o},v=e=>{let r=r=>r[e]||[];return r.isThemeGetter=!0,r},w=/^\[(?:([a-z-]+):)?(.+)\]$/i,k=/^\d+\/\d+$/,z=new Set(["px","full","screen"]),j=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,E=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,P=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,N=e=>R(e)||z.has(e)||k.test(e),G=e=>T(e,"length",B),R=e=>!!e&&!Number.isNaN(Number(e)),$=e=>T(e,"number",R),W=e=>!!e&&Number.isInteger(Number(e)),_=e=>e.endsWith("%")&&R(e.slice(0,-1)),O=e=>w.test(e),I=e=>j.test(e),M=new Set(["length","size","percentage"]),V=e=>T(e,M,H),A=e=>T(e,"position",H),Z=new Set(["image","url"]),F=e=>T(e,Z,K),q=e=>T(e,"",J),D=()=>!0,T=(e,r,o)=>{let t=w.exec(e);return!!t&&(t[1]?"string"==typeof r?t[1]===r:r.has(t[1]):o(t[2]))},B=e=>C.test(e)&&!S.test(e),H=()=>!1,J=e=>E.test(e),K=e=>P.test(e),L=function(e,...r){let o,t,n;let l=function(s){return t=(o=m(r.reduce((e,r)=>r(e),e()))).cache.get,n=o.cache.set,l=i,i(s)};function i(e){let r=t(e);if(r)return r;let l=h(e,o);return n(e,l),l}return function(){return l(y.apply(null,arguments))}}(()=>{let e=v("colors"),r=v("spacing"),o=v("blur"),t=v("brightness"),n=v("borderColor"),l=v("borderRadius"),i=v("borderSpacing"),s=v("borderWidth"),a=v("contrast"),d=v("grayscale"),c=v("hueRotate"),p=v("invert"),u=v("gap"),b=v("gradientColorStops"),f=v("gradientColorStopPositions"),m=v("inset"),g=v("margin"),h=v("opacity"),y=v("padding"),x=v("saturate"),w=v("scale"),k=v("sepia"),z=v("skew"),j=v("space"),C=v("translate"),S=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",O,r],M=()=>[O,r],Z=()=>["",N,G],T=()=>["auto",R,O],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",O],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[R,O];return{cacheSize:500,separator:":",theme:{colors:[D],spacing:[N,G],blur:["none","",I,O],brightness:U(),borderColor:[e],borderRadius:["none","","full",I,O],borderSpacing:M(),borderWidth:Z(),contrast:U(),grayscale:L(),hueRotate:U(),invert:L(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[_,G],inset:P(),margin:P(),opacity:U(),padding:M(),saturate:U(),scale:U(),sepia:L(),skew:U(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",O]}],container:["container"],columns:[{columns:[I]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),O]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",W,O]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",O]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",W,O]}],"grid-cols":[{"grid-cols":[D]}],"col-start-end":[{col:["auto",{span:["full",W,O]},O]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[D]}],"row-start-end":[{row:["auto",{span:[W,O]},O]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",O]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",O]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",O,r]}],"min-w":[{"min-w":[O,r,"min","max","fit"]}],"max-w":[{"max-w":[O,r,"none","full","min","max","fit","prose",{screen:[I]},I]}],h:[{h:[O,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[O,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[O,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[O,r,"auto","min","max","fit"]}],"font-size":[{text:["base",I,G]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$]}],"font-family":[{font:[D]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",O]}],"line-clamp":[{"line-clamp":["none",R,$]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",N,O]}],"list-image":[{"list-image":["none",O]}],"list-style-type":[{list:["none","disc","decimal",O]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",N,G]}],"underline-offset":[{"underline-offset":["auto",N,O]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",O]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),A]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",V]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},F]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[f]}],"gradient-via-pos":[{via:[f]}],"gradient-to-pos":[{to:[f]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:H()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[N,O]}],"outline-w":[{outline:[N,G]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[N,G]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",I,q]}],"shadow-color":[{shadow:[D]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...J(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[t]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",I,O]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[p]}],saturate:[{saturate:[x]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[t]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",O]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",O]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",O]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[W,O]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[z]}],"skew-y":[{"skew-y":[z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",O]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",O]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",O]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[N,G,$]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}})}}]);
@@ -0,0 +1,16 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(5893),a=t(7294);let n=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[i,o]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s&&o(!1)},[s]),!s||i)return null;let c="string"==typeof s?s:n(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{o(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,s,t){t.d(s,{z:function(){return c}});var r=t(5893),a=t(7294),n=t(8426),l=t(2003),i=t(2350);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,s)=>{let{className:t,variant:a,size:l,asChild:c=!1,...d}=e,u=c?n.g7:"button";return(0,r.jsx)(u,{className:(0,i.cn)(o({variant:a,size:l,className:t})),ref:s,...d})});c.displayName="Button"},7673:function(e,s,t){t.d(s,{Ol:function(){return c},Zb:function(){return o},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var r=t(5893),a=t(7294),n=t(5697),l=t.n(n),i=t(2350);let o=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...n,children:a})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let c=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",t),...n,children:a})});c.displayName="CardHeader",c.propTypes={className:l().string,children:l().node};let d=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",t),...n,children:a})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",t),...n,children:a})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",t),...n,children:a})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let x=a.forwardRef((e,s)=>{let{className:t,children:a,...n}=e;return(0,r.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",t),...n,children:a})});x.displayName="CardFooter",x.propTypes={className:l().string,children:l().node}},326:function(e,s,t){t.d(s,{$N:function(){return f},Be:function(){return h},Vq:function(){return o},cN:function(){return x},cZ:function(){return u},fK:function(){return m}});var r=t(5893),a=t(7294),n=t(6327),l=t(2350),i=t(3767);let o=n.fC;n.xz;let c=n.h_;n.x8;let d=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(n.aV,{ref:s,className:(0,l.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a})});d.displayName=n.aV.displayName;let u=a.forwardRef((e,s)=>{let{className:t,children:a,...o}=e;return(0,r.jsxs)(c,{children:[(0,r.jsx)(d,{}),(0,r.jsxs)(n.VY,{ref:s,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...o,children:[a,(0,r.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=n.VY.displayName;let m=e=>{let{className:s,...t}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",s),...t})};m.displayName="DialogHeader";let x=e=>{let{className:s,...t}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t})};x.displayName="DialogFooter";let f=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(n.Dx,{ref:s,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",t),...a})});f.displayName=n.Dx.displayName;let h=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(n.dk,{ref:s,className:(0,l.cn)("text-sm text-gray-500",t),...a})});h.displayName=n.dk.displayName},8764:function(e,s,t){t.d(s,{RM:function(){return o},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return i}});var r=t(5893),a=t(7294),n=t(2350);let l=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:s,className:(0,n.cn)("w-full caption-bottom text-base",t),...a})})});l.displayName="Table";let i=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("thead",{ref:s,className:(0,n.cn)("[&_tr]:border-b",t),...a})});i.displayName="TableHeader";let o=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("tbody",{ref:s,className:(0,n.cn)("[&_tr:last-child]:border-0",t),...a})});o.displayName="TableBody",a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("tfoot",{ref:s,className:(0,n.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...a})}).displayName="TableFooter";let c=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("tr",{ref:s,className:(0,n.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...a})});c.displayName="TableRow";let d=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("th",{ref:s,className:(0,n.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",t),...a})});d.displayName="TableHead";let u=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("td",{ref:s,className:(0,n.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...a})});u.displayName="TableCell",a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)("caption",{ref:s,className:(0,n.cn)("mt-4 text-base text-muted-foreground",t),...a})}).displayName="TableCaption"},8310:function(e,s,t){t.r(s),t.d(s,{Users:function(){return M}});var r=t(5893),a=t(7294),n=t(5697),l=t.n(n),i=t(8799),o=t(1664),c=t.n(o),d=t(803),u=t(8764),m=t(3081),x=t(3266),f=t(8969),h=t(6378),p=t(6856),g=t(1214),b=t(4545),y=t(998);/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let j=(0,y.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var v=t(3626);/**
7
+ * @license lucide-react v0.407.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */let N=(0,y.Z)("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),w=(0,y.Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),k=(0,y.Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);var C=t(282),R=t(3767);/**
12
+ * @license lucide-react v0.407.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */let D=(0,y.Z)("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),E=(0,y.Z)("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);var S=t(7603);t(9470);var I=t(3001),U=t(7673),F=t(7145),z=t(326),L=t(1812);let _=(e,s)=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",Z=(e,s)=>e&&e.includes("@")?e:s||"-",T=g.nb.REFRESH_INTERVAL,V=e=>{let{message:s,onDismiss:t}=e;return s?(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:s})})]}),t&&(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,r.jsxs)("button",{type:"button",onClick:t,className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}):null};function M(){let[e,s]=(0,a.useState)(!1),t=(0,a.useRef)(null),n=(0,I.X)(),[l,o]=(0,a.useState)(!1),[u,p]=(0,a.useState)({username:"",password:"",role:"user"}),[g,b]=(0,a.useState)(!1),[y,C]=(0,a.useState)({open:!1,message:"",userName:""}),[R,D]=(0,a.useState)(null),[E,S]=(0,a.useState)(!1),[U,_]=(0,a.useState)(!1),[Z,M]=(0,a.useState)(!1),[P,q]=(0,a.useState)(null),[B,O]=(0,a.useState)(!1),[H,K]=(0,a.useState)(null),[Y,$]=(0,a.useState)("import"),[X,J]=(0,a.useState)(!1),[W,G]=(0,a.useState)(null),[Q,ee]=(0,a.useState)(""),[es,et]=(0,a.useState)(!1),[er,ea]=(0,a.useState)(null),[en,el]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(!1),[ex,ef]=(0,a.useState)(null),[eh,ep]=(0,a.useState)(null),[eg,eb]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{!async function(){try{let e=await F.x.get("/api/health");if(e.ok){let s=await e.json();eb(!!s.basic_auth_enabled)}else eb(!1)}catch(e){eb(!1)}}()},[]);let ey=(0,a.useCallback)(async()=>{if(R&&Date.now()-R.timestamp<3e5)return R;S(!0);try{let e=await F.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,id:s.id,timestamp:Date.now()};return D(t),S(!1),t}catch(e){throw S(!1),e}},[R]);(0,a.useEffect)(()=>{ey().catch(()=>{console.error("Failed to get user role")})},[ey]);let ej=async(e,s)=>{try{let t=await ey();if("admin"!==t.role)return C({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),C({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},ev=()=>{h.default.invalidate(m.R),h.default.invalidate(x.getClusters),h.default.invalidate(f.getManagedJobs,[{allUsers:!0}]),t.current&&t.current()},eN=async()=>{if(!u.username||!u.password){ep(Error("Username and password are required.")),o(!1);return}b(!0),ep(null),ef(null);try{let e=await F.x.post("/users/create",u);if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to create user")}ef('User "'.concat(u.username,'" created successfully!')),o(!1),p({username:"",password:"",role:"user"}),ev()}catch(e){ep(e),o(!1),p({username:"",password:"",role:"user"})}finally{b(!1)}},ew=async e=>{let s=e.target.files[0];s&&(q(s),K(null))},ek=async()=>{if(!P){alert("Please select a CSV file first.");return}O(!0);try{let e=new FileReader;e.onload=async e=>{try{let s=e.target.result,t=await F.x.post("/users/import",{csv_content:s});if(!t.ok){let e=await t.json();throw Error(e.detail||"Failed to import users")}let r=await t.json(),a="Import completed. ".concat(r.success_count," users created successfully.");r.error_count>0&&(a+="\n".concat(r.error_count," failed."),r.creation_errors.length>0&&(a+="\nErrors: ".concat(r.creation_errors.slice(0,3).join(", ")),r.creation_errors.length>3&&(a+=" and ".concat(r.creation_errors.length-3," more...")))),K({message:a}),r.success_count>0&&ev()}catch(e){alert("Error importing users: ".concat(e.message))}finally{O(!1)}},e.readAsText(P)}catch(e){alert("Error reading file: ".concat(e.message)),O(!1)}},eC=async e=>{G(e),ee(""),J(!0)},eR=async()=>{if(!Q){ea(Error("Please enter a new password."));return}et(!0),ea(null);try{let e=await F.x.post("/users/update",{user_id:W.userId,password:Q});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to reset password")}ef('Password reset successfully for user "'.concat(W.usernameDisplay,'"!')),J(!1),G(null),ee("")}catch(e){ea(e)}finally{et(!1)}},eD=async()=>{if(ei){em(!0),ed(null);try{let e=await F.x.post("/users/delete",{user_id:ei.userId});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to delete user")}ef('User "'.concat(ei.usernameDisplay,'" deleted successfully!')),el(!1),eo(null),ev()}catch(e){ed(e)}finally{em(!1)}}},eE=()=>{el(!1),eo(null),ed(null)},eS=()=>{J(!1),G(null),ee(""),ea(null)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsx)("div",{className:"text-base",children:(0,r.jsx)(c(),{href:"/users",className:"text-sky-blue hover:underline leading-none",children:"Users"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[e&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(i.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),eg&&(null==R?void 0:R.role)==="admin"&&(0,r.jsx)("button",{onClick:async()=>{await ej("cannot create users",()=>{o(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center border-sky-blue rounded px-2 py-1 mr-2",title:"Create New User",children:"+ New User"}),eg&&(null==R?void 0:R.role)==="admin"&&(0,r.jsxs)("button",{onClick:async()=>{await ej("cannot import users",()=>{M(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center rounded px-2 py-1 mr-2",title:"Import/Export Users",children:[(0,r.jsx)(j,{className:"h-4 w-4 mr-1"}),"Import/Export"]}),(0,r.jsxs)("button",{onClick:ev,disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(v.Z,{className:"h-4 w-4 mr-1.5"}),!n&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(V,{message:ex,onDismiss:()=>ef(null)}),(0,r.jsx)(L.X,{error:eh,title:"Error",onDismiss:()=>ep(null)}),(0,r.jsx)(A,{refreshInterval:T,setLoading:s,refreshDataRef:t,checkPermissionAndAct:ej,roleLoading:E,onResetPassword:eC,onDeleteUser:e=>{ej("cannot delete users",()=>{eo(e),el(!0)})},basicAuthEnabled:eg,currentUserRole:null==R?void 0:R.role,currentUserId:null==R?void 0:R.id}),(0,r.jsx)(z.Vq,{open:l,onOpenChange:o,children:(0,r.jsxs)(z.cZ,{className:"sm:max-w-md",children:[(0,r.jsx)(z.fK,{children:(0,r.jsx)(z.$N,{children:"Create User"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Username"}),(0,r.jsx)("input",{className:"border rounded px-3 py-2 w-full",placeholder:"Username",value:u.username,onChange:e=>p({...u,username:e.target.value})})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Password"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{className:"border rounded px-3 py-2 w-full pr-10",placeholder:"Password",type:U?"text":"password",value:u.password,onChange:e=>p({...u,password:e.target.value})}),(0,r.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600",onClick:()=>_(!U),children:U?(0,r.jsx)(N,{className:"h-4 w-4"}):(0,r.jsx)(w,{className:"h-4 w-4"})})]})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Role"}),(0,r.jsxs)("select",{className:"border rounded px-3 py-2 w-full",value:u.role,onChange:e=>p({...u,role:e.target.value}),children:[(0,r.jsx)("option",{value:"user",children:"User"}),(0,r.jsx)("option",{value:"admin",children:"Admin"})]})]})]}),(0,r.jsxs)(z.cN,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>o(!1),disabled:g,children:"Cancel"}),(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:eN,disabled:g,children:g?"Creating...":"Create"})]})]})}),(0,r.jsx)(z.Vq,{open:y.open,onOpenChange:e=>C(s=>({...s,open:e})),children:(0,r.jsxs)(z.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(z.fK,{children:[(0,r.jsx)(z.$N,{children:"Permission Denied"}),(0,r.jsx)(z.Be,{children:E?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(i.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:y.userName?(0,r.jsxs)(r.Fragment,{children:[y.userName," is logged in as non-admin and ",y.message,"."]}):y.message})})]}),(0,r.jsx)(z.cN,{children:(0,r.jsx)(d.z,{variant:"outline",onClick:()=>C(e=>({...e,open:!1})),disabled:E,children:"OK"})})]})}),(0,r.jsx)(z.Vq,{open:Z,onOpenChange:M,children:(0,r.jsxs)(z.cZ,{className:"sm:max-w-lg",children:[(0,r.jsx)(z.fK,{children:(0,r.jsx)(z.$N,{children:"Import/Export Users"})}),(0,r.jsxs)("div",{className:"flex border-b border-gray-200 mb-4",children:[(0,r.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("import"===Y?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>$("import"),children:"Import"}),(0,r.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("export"===Y?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>$("export"),children:"Export"})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:"import"===Y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"CSV File"}),(0,r.jsx)("input",{type:"file",accept:".csv",onChange:ew,className:"border rounded px-3 py-2 w-full"}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["CSV should have columns: username, password, role",(0,r.jsx)("br",{}),"Supports both plain text passwords and exported password hashes."]})]}),H&&(0,r.jsx)("div",{className:"p-3 bg-green-50 border border-green-200 rounded text-green-700 text-sm",children:H.message})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Export Users to CSV"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Download all users as a CSV file with password hashes."}),(0,r.jsxs)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[(0,r.jsx)("p",{className:"text-sm text-amber-700",children:"⚠️ This will export all users with columns: username, password (hashed), role"}),(0,r.jsx)("p",{className:"text-xs text-amber-600 mt-1",children:"Password hashes can be imported directly for system backups."})]})]})})}),(0,r.jsxs)(z.cN,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>M(!1),disabled:B,children:"Cancel"}),"import"===Y?(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:ek,disabled:B||!P,children:B?"Importing...":"Import"}):(0,r.jsxs)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:async()=>{try{let e=await F.x.get("/users/export");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to export users")}let s=await e.json(),t=s.csv_content,r=new Blob([t],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(r),n=document.createElement("a");n.href=a;let l=new Date,i=e=>String(e).padStart(2,"0"),o=l.getFullYear(),c=i(l.getMonth()+1),d=i(l.getDate()),u=i(l.getHours()),m=i(l.getMinutes()),x=i(l.getSeconds());n.download="users_export_".concat(o,"-").concat(c,"-").concat(d,"-").concat(u,"-").concat(m,"-").concat(x,".csv"),n.click(),URL.revokeObjectURL(a),alert("Successfully exported ".concat(s.user_count," users to CSV file."))}catch(e){alert("Error exporting users: ".concat(e.message))}},children:[(0,r.jsx)(k,{className:"h-4 w-4 mr-1"}),"Export"]})]})]})}),(0,r.jsx)(z.Vq,{open:X,onOpenChange:eS,children:(0,r.jsxs)(z.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(z.fK,{children:[(0,r.jsx)(z.$N,{children:"Reset Password"}),(0,r.jsxs)(z.Be,{children:["Enter a new password for"," ",(null==W?void 0:W.usernameDisplay)||"this user","."]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"New Password"}),(0,r.jsx)("input",{type:"password",className:"border rounded px-3 py-2 w-full",placeholder:"Enter new password",value:Q,onChange:e=>ee(e.target.value),autoFocus:!0})]})}),(0,r.jsx)(L.X,{error:er,title:"Reset Failed",onDismiss:()=>ea(null)}),(0,r.jsxs)(z.cN,{children:[(0,r.jsx)(d.z,{variant:"outline",onClick:eS,disabled:es,children:"Cancel"}),(0,r.jsx)(d.z,{variant:"default",onClick:eR,disabled:es||!Q,className:"bg-sky-600 text-white hover:bg-sky-700",children:es?"Resetting...":"Reset Password"})]})]})}),(0,r.jsx)(z.Vq,{open:en,onOpenChange:eE,children:(0,r.jsxs)(z.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(z.fK,{children:[(0,r.jsx)(z.$N,{children:"Delete User"}),(0,r.jsxs)(z.Be,{children:['Are you sure you want to delete user "',(null==ei?void 0:ei.usernameDisplay)||"this user",'"? This action cannot be undone.']})]}),(0,r.jsx)(L.X,{error:ec,title:"Deletion Failed",onDismiss:()=>ed(null)}),(0,r.jsxs)(z.cN,{children:[(0,r.jsx)(d.z,{variant:"outline",onClick:eE,disabled:eu,children:"Cancel"}),(0,r.jsx)(d.z,{variant:"destructive",onClick:eD,disabled:eu,children:eu?"Deleting...":"Delete"})]})]})})]})}function A(e){let{refreshInterval:s,setLoading:t,refreshDataRef:n,checkPermissionAndAct:l,roleLoading:o,onResetPassword:d,onDeleteUser:g,basicAuthEnabled:y,currentUserRole:j,currentUserId:v}=e,[N,w]=(0,a.useState)([]),[k,I]=(0,a.useState)(!0),[z,L]=(0,a.useState)(!1),[T,V]=(0,a.useState)({key:"username",direction:"ascending"}),[M,A]=(0,a.useState)(null),[P,q]=(0,a.useState)(""),B=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&e&&t(!0),e&&I(!0);try{let s=await h.default.get(m.R),r=(s||[]).map(e=>({...e,usernameDisplay:_(e.username,e.userId),fullEmailID:Z(e.username,e.userId),clusterCount:-1,jobCount:-1}));w(r),L(!0),t&&e&&t(!1),e&&I(!1);let[a,n]=await Promise.all([h.default.get(x.getClusters),h.default.get(f.getManagedJobs,[{allUsers:!0}])]),l=n.jobs||[],i=(s||[]).map(e=>{let s=(a||[]).filter(s=>s.user_hash===e.userId),t=(l||[]).filter(s=>s.user_hash===e.userId);return{...e,usernameDisplay:_(e.username,e.userId),fullEmailID:Z(e.username,e.userId),clusterCount:s.length,jobCount:t.length}});w(i)}catch(s){console.error("Failed to fetch or process user data:",s),w([]),L(!0),t&&e&&t(!1),e&&I(!1)}},[t]);(0,a.useEffect)(()=>{n&&(n.current=()=>B(!0))},[n,B]),(0,a.useEffect)(()=>{(async()=>{L(!1),I(!0),await p.ZP.preloadForPage("users"),B(!0)})();let e=setInterval(()=>{B(!1)},s);return()=>clearInterval(e)},[B,s]);let O=(0,a.useMemo)(()=>(0,b.R0)(N,T.key,T.direction),[N,T]),H=e=>{let s="ascending";T.key===e&&"ascending"===T.direction&&(s="descending"),V({key:e,direction:s})},K=e=>T.key===e?"ascending"===T.direction?" ↑":" ↓":"",Y=async(e,s)=>{await l("cannot edit user role",()=>{A(e),q(s)})},$=()=>{A(null),q("")},X=async e=>{if(!e||!P){console.error("User ID or role is missing."),alert("Error: User ID or role is missing.");return}I(!0);try{let s=await F.x.post("/users/update",{user_id:e,role:P});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to update role")}h.default.invalidate(m.R),await B(!0),$()}catch(e){console.error("Failed to update user role:",e),alert("Error updating role: ".concat(e.message))}finally{I(!1)}};return k&&0===N.length&&!z?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(i.Z,{})}):z?O&&0!==O.length?(0,r.jsx)(U.Zb,{children:(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{onClick:()=>H("usernameDisplay"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Name",K("usernameDisplay")]}),(0,r.jsxs)(u.ss,{onClick:()=>H("fullEmailID"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["User ID",K("fullEmailID")]}),(0,r.jsxs)(u.ss,{onClick:()=>H("role"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Role",K("role")]}),(0,r.jsxs)(u.ss,{onClick:()=>H("clusterCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Clusters",K("clusterCount")]}),(0,r.jsxs)(u.ss,{onClick:()=>H("jobCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Jobs",K("jobCount")]}),y&&(0,r.jsx)(u.ss,{className:"whitespace-nowrap w-1/6",children:"Actions"})]})}),(0,r.jsx)(u.RM,{children:O.map(e=>(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{className:"truncate",title:e.username,children:e.usernameDisplay}),(0,r.jsx)(u.pj,{className:"truncate",title:e.fullEmailID,children:e.fullEmailID}),(0,r.jsx)(u.pj,{className:"truncate",title:e.role,children:(0,r.jsx)("div",{className:"flex items-center gap-2",children:M===e.userId?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("select",{value:P,onChange:e=>q(e.target.value),className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,r.jsx)("option",{value:"admin",children:"Admin"}),(0,r.jsx)("option",{value:"user",children:"User"})]}),(0,r.jsx)("button",{onClick:()=>X(e.userId),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,r.jsx)(C.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:$,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,r.jsx)(R.Z,{className:"h-4 w-4"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"capitalize",children:e.role}),"admin"===j&&(0,r.jsx)("button",{onClick:()=>Y(e.userId,e.role),className:"text-sky-blue hover:text-sky-blue-bright p-1",title:"Edit role",children:(0,r.jsx)(D,{className:"h-3 w-3"})})]})})}),(0,r.jsx)(u.pj,{children:-1===e.clusterCount?(0,r.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,r.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,r.jsx)(c(),{href:"/clusters?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.clusterCount>0?"bg-blue-100 text-blue-800 hover:bg-blue-200 hover:text-blue-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.clusterCount," cluster").concat(1!==e.clusterCount?"s":""," for ").concat(e.usernameDisplay),children:e.clusterCount})}),(0,r.jsx)(u.pj,{children:-1===e.jobCount?(0,r.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,r.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,r.jsx)(c(),{href:"/jobs?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.jobCount>0?"bg-green-100 text-green-800 hover:bg-green-200 hover:text-green-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.jobCount," job").concat(1!==e.jobCount?"s":""," for ").concat(e.usernameDisplay),children:e.jobCount})}),y&&(0,r.jsx)(u.pj,{className:"relative",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:"admin"===j||e.userId===v?async()=>{d(e)}:void 0,className:"admin"===j||e.userId===v?"text-sky-blue hover:text-sky-blue-bright p-1":"text-gray-300 cursor-not-allowed p-1",title:"admin"===j||e.userId===v?"Reset Password":"You can only reset your own password",disabled:"admin"!==j&&e.userId!==v,children:(0,r.jsx)(E,{className:"h-4 w-4"})}),"admin"===j&&(0,r.jsx)("button",{onClick:()=>g(e),className:"text-sky-blue hover:text-red-500 p-1",title:"Delete User",children:(0,r.jsx)(S.Z,{className:"h-4 w-4"})})]})})]},e.userId))})]})}):(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("p",{className:"text-lg font-semibold text-gray-500",children:"No users found."}),(0,r.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:"There are currently no users to display."})]}):(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(i.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading users..."})]})}A.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,checkPermissionAndAct:l().func.isRequired,roleLoading:l().bool.isRequired,onResetPassword:l().func.isRequired,onDeleteUser:l().func.isRequired,basicAuthEnabled:l().bool,currentUserRole:l().string,currentUserId:l().string}},4545:function(e,s,t){function r(e){return e.startsWith("sky-jobs-controller-")}function a(e,s,t){return null===s?e:[...e].sort((e,r)=>e[s]<r[s]?"ascending"===t?-1:1:e[s]>r[s]?"ascending"===t?1:-1:0)}t.d(s,{R0:function(){return a},Ym:function(){return r}})}}]);
@@ -0,0 +1,6 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37,211],{9037:function(e,s,r){r.r(s),r.d(s,{ClusterTable:function(){return O},Clusters:function(){return I},Status2Actions:function(){return z},enabledActions:function(){return V},filterClustersByName:function(){return A},handleVSCodeConnection:function(){return E}});var t=r(5893),l=r(7294),a=r(1163),n=r(8799),i=r(6989),c=r(1664),o=r.n(c),d=r(803),u=r(7673),h=r(8764),m=r(3266),x=r(7324),p=r(3081),f=r(4545),j=r(3626),g=r(998);/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let y=(0,g.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),v=(0,g.Z)("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);r(9470);var w=r(9284),b=r(9307),N=r(3001),k=r(8950),C=r(6378),S=r(6856);r(1272);let _="__ALL_WORKSPACES__",R="__ALL_USERS__";function A(e,s){if(!s||""===s.trim())return e;let r=s.toLowerCase().trim();return e.filter(e=>(e.cluster||"").toLowerCase().includes(r))}let L=(e,s)=>{let r="",t="";return e>=0&&(r=e+"m",t=" "),s&&(r+="".concat(t,"(down)")),""===r&&(r="-"),r},M=(e,s)=>{if(e&&e.includes("@")){let r=e.split("@")[0];return s&&s!==r?"".concat(r," (").concat(s,")"):r}let r=e||s||"N/A";return s&&s!==r?"".concat(r," (").concat(s,")"):r},q=e=>{if(!e||0===e)return"-";let s=e=Math.floor(e),r="",t=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(s>=e.value&&t<2){let l=Math.floor(s/e.value);r+="".concat(l).concat(e.label," "),s%=e.value,t++}return r.trim()||"0s"};function I(){var e;let s=(0,a.useRouter)(),[r,c]=(0,l.useState)(!1),d=l.useRef(null),[u,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(!1),[y,v]=(0,l.useState)(null),[b,A]=(0,l.useState)(_),[L,q]=(0,l.useState)(R),[I,E]=(0,l.useState)(""),[H,V]=(0,l.useState)([]),[W,z]=(0,l.useState)([]),[F,T]=(0,l.useState)(!1),Z=(0,N.X)();(0,l.useEffect)(()=>{s.isReady&&(s.query.workspace&&A(Array.isArray(s.query.workspace)?s.query.workspace[0]:s.query.workspace),s.query.user&&q(Array.isArray(s.query.user)?s.query.user[0]:s.query.user),s.query.name&&E(Array.isArray(s.query.name)?s.query.name[0]:s.query.name))},[s.isReady,s.query.workspace,s.query.user,s.query.name]);let B=(e,r,t)=>{let l={...s.query};e&&e!==_?l.workspace=e:delete l.workspace,r&&r!==R?l.user=r:delete l.user,t&&""!==t.trim()?l.name=t.trim():delete l.name,s.replace({pathname:s.pathname,query:l},void 0,{shallow:!0})},P=e=>{E(e),B(b,L,e)};return(0,l.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await C.default.get(x.fX),s=Object.keys(e),r=await C.default.get(m.getClusters),t=[...new Set(r.map(e=>e.workspace||"default").filter(e=>e))],l=new Set(s);t.includes("default")&&l.has("default"),t.forEach(e=>l.add(e)),V(Array.from(l).sort());let a=await C.default.get(p.R),n=[...new Set(r.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],i=new Map;a.forEach(e=>{i.set(e.userId,{userId:e.userId,username:e.username,display:M(e.username,e.userId)})}),n.forEach(e=>{i.has(e.userId)||i.set(e.userId,{userId:e.userId,username:e.username,display:M(e.username,e.userId)})}),z(Array.from(i.values()).sort((e,s)=>e.display.localeCompare(s.display)))}catch(e){console.error("Error fetching data for filters:",e),V(["default"]),z([])}})()},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"}),(0,t.jsx)("div",{className:"flex items-center ml-6 space-x-3",children:(0,t.jsxs)("label",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:F,onChange:e=>T(e.target.checked),className:"sr-only"}),(0,t.jsx)("div",{className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(F?"bg-sky-600":"bg-gray-300"),children:(0,t.jsx)("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white transition-transform ".concat(F?"translate-x-5":"translate-x-1")})}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-700",children:"Show history (Last 30 days)"})]})}),(0,t.jsxs)("div",{className:"relative ml-4 mr-2",children:[(0,t.jsx)("input",{type:"text",placeholder:"Filter by cluster name",value:I,onChange:e=>P(e.target.value),className:"h-8 w-32 sm:w-48 px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),I&&(0,t.jsx)("button",{onClick:()=>P(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",children:(0,t.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)(k.Ph,{value:b,onValueChange:e=>{A(e),B(e,L,I)},children:[(0,t.jsx)(k.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,t.jsx)(k.ki,{placeholder:"Filter by workspace...",children:b===_?"All Workspaces":b})}),(0,t.jsxs)(k.Bw,{children:[(0,t.jsx)(k.Ql,{value:_,children:"All Workspaces"}),H.map(e=>(0,t.jsx)(k.Ql,{value:e,children:e},e))]})]}),(0,t.jsxs)(k.Ph,{value:L,onValueChange:e=>{q(e),B(b,e,I)},children:[(0,t.jsx)(k.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,t.jsx)(k.ki,{placeholder:"Filter by user...",children:L===R?"All Users":(null===(e=W.find(e=>e.userId===L))||void 0===e?void 0:e.display)||L})}),(0,t.jsxs)(k.Bw,{children:[(0,t.jsx)(k.Ql,{value:R,children:"All Users"}),W.map(e=>(0,t.jsx)(k.Ql,{value:e.userId,children:e.display},e.userId))]})]})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[r&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(n.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,t.jsxs)("button",{onClick:()=>{C.default.invalidate(m.getClusters),C.default.invalidate(m.uR),C.default.invalidate(x.fX),C.default.invalidate(p.R),d.current&&d.current()},disabled:r,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),!Z&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(O,{refreshInterval:i.yc,setLoading:c,refreshDataRef:d,workspaceFilter:b,userFilter:L,nameFilter:I,showHistory:F,onOpenSSHModal:e=>{v(e),h(!0)},onOpenVSCodeModal:e=>{v(e),g(!0)}}),(0,t.jsx)(w.Oh,{isOpen:u,onClose:()=>h(!1),cluster:y}),(0,t.jsx)(w._R,{isOpen:f,onClose:()=>g(!1),cluster:y})]})}function O(e){let{refreshInterval:s,setLoading:r,refreshDataRef:a,workspaceFilter:c,userFilter:x,nameFilter:p,showHistory:j,onOpenSSHModal:g,onOpenVSCodeModal:y}=e,[v,w]=(0,l.useState)([]),[N,k]=(0,l.useState)({key:null,direction:"ascending"}),[S,M]=(0,l.useState)(!1),[I,O]=(0,l.useState)(!0),[E,H]=(0,l.useState)(1),[V,W]=(0,l.useState)(10),F=l.useCallback(async()=>{r(!0),M(!0);try{let e=await C.default.get(m.getClusters);if(j){let s=await C.default.get(m.uR),r=e.map(e=>({...e,isHistorical:!1})),t=s.map(e=>({...e,isHistorical:!0})),l=[...r];t.forEach(s=>{e.some(e=>(e.cluster||e.name)===(s.cluster||s.name))||l.push(s)}),w(l)}else{let s=e.map(e=>({...e,isHistorical:!1}));w(s)}}catch(e){console.error("Error fetching cluster data:",e),w([])}r(!1),M(!1),O(!1)},[r,j]),T=l.useMemo(()=>{let e=v;return c&&c!==_&&(e=e.filter(e=>(e.workspace||"default").toLowerCase()===c.toLowerCase())),x&&x!==R&&(e=e.filter(e=>(e.user_hash||e.user)===x)),p&&(e=A(e,p)),(0,f.R0)(e,N.key,N.direction)},[v,N,c,x,p]);l.useEffect(()=>{a&&(a.current=F)},[a,F]),(0,l.useEffect)(()=>{w([]);let e=!0;F();let r=setInterval(()=>{e&&F()},s);return()=>{e=!1,clearInterval(r)}},[s,F]),(0,l.useEffect)(()=>{H(1)},[v.length]);let Z=e=>{let s="ascending";N.key===e&&"ascending"===N.direction&&(s="descending"),k({key:e,direction:s})},B=e=>N.key===e?"ascending"===N.direction?" ↑":" ↓":"",P=Math.ceil(T.length/V),U=(E-1)*V,D=U+V,Q=T.slice(U,D);return(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Zb,{children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(h.iA,{className:"min-w-full",children:[(0,t.jsx)(h.xD,{children:(0,t.jsxs)(h.SC,{children:[(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("status"),children:["Status",B("status")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("cluster"),children:["Cluster",B("cluster")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden sm:table-cell",onClick:()=>Z("user"),children:["User",B("user")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden md:table-cell",onClick:()=>Z("workspace"),children:["Workspace",B("workspace")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden lg:table-cell",onClick:()=>Z("infra"),children:["Infra",B("infra")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden xl:table-cell",onClick:()=>Z("resources_str"),children:["Resources",B("resources_str")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("time"),children:["Started",B("time")]}),j&&(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden lg:table-cell",onClick:()=>Z("duration"),children:["Duration",B("duration")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden md:table-cell",onClick:()=>Z("autostop"),children:["Autostop",B("autostop")]}),(0,t.jsx)(h.ss,{className:"sticky right-0 bg-white",children:"Actions"})]})}),(0,t.jsx)(h.RM,{children:S&&I?(0,t.jsx)(h.SC,{children:(0,t.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(n.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):Q.length>0?Q.map((e,s)=>(0,t.jsxs)(h.SC,{children:[(0,t.jsx)(h.pj,{children:(0,t.jsx)(b.OE,{status:e.status})}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(o(),{href:"/clusters/".concat(e.isHistorical?e.cluster_hash:e.cluster||e.name),className:"text-blue-600",children:e.cluster||e.name})}),(0,t.jsx)(h.pj,{className:"hidden sm:table-cell",children:e.user}),(0,t.jsx)(h.pj,{className:"hidden md:table-cell",children:(0,t.jsx)(o(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,t.jsx)(h.pj,{className:"hidden lg:table-cell",children:(0,t.jsx)(i.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,t.jsxs)("span",{children:[(0,t.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,t.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})}),(0,t.jsx)(h.pj,{className:"hidden xl:table-cell",children:(0,t.jsx)(i.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:e.resources_str})})}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(i.Zg,{date:e.time})}),j&&(0,t.jsx)(h.pj,{className:"hidden lg:table-cell",children:q(e.duration)}),(0,t.jsx)(h.pj,{className:"hidden md:table-cell",children:e.isHistorical?"-":L(e.autostop,e.to_down)}),(0,t.jsx)(h.pj,{className:"text-left sticky right-0 bg-white",children:!e.isHistorical&&(0,t.jsx)(z,{cluster:e.cluster,status:e.status,onOpenSSHModal:g,onOpenVSCodeModal:y})})]},s)):(0,t.jsx)(h.SC,{children:(0,t.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:j?"No clusters found":"No active clusters"})})})]})})}),v.length>0&&(0,t.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsxs)("select",{value:V,onChange:e=>{W(parseInt(e.target.value,10)),H(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,t.jsx)("option",{value:10,children:"10"}),(0,t.jsx)("option",{value:30,children:"30"}),(0,t.jsx)("option",{value:50,children:"50"}),(0,t.jsx)("option",{value:100,children:"100"}),(0,t.jsx)("option",{value:200,children:"200"})]}),(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,t.jsxs)("div",{children:[U+1," – ",Math.min(D,v.length)," of"," ",v.length]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{H(e=>Math.max(e-1,1))},disabled:1===E,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,t.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,t.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{H(e=>Math.min(e+1,P))},disabled:E===P||0===P,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,t.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}let E=(e,s)=>{s&&s(e)},H=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},V=e=>"RUNNING"===e?["connect","VSCode"]:[],W={connect:(0,t.jsx)(y,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,t.jsx)(v,{className:"w-4 h-4 text-gray-500 inline-block"})};function z(e){let{withLabel:s=!1,cluster:r,status:l,onOpenSSHModal:a,onOpenVSCodeModal:n}=e,c=V(l),o=(0,N.X)(),d=e=>{switch(e){case"connect":H(r,a);break;case"VSCode":E(r,n);break;default:return}};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(W).map(e=>{let r,l,[a,n]=e;switch(a){case"connect":r="Connect",l="Connect with SSH";break;case"VSCode":r="VSCode",l="Open in VS Code"}return(s||(r=""),c.includes(a))?(0,t.jsx)(i.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("button",{onClick:()=>d(a),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[n,!o&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},a):(0,t.jsx)(i.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:a,children:[n,!o&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},a)})})})}},803:function(e,s,r){r.d(s,{z:function(){return o}});var t=r(5893),l=r(7294),a=r(8426),n=r(2003),i=r(2350);let c=(0,n.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=l.forwardRef((e,s)=>{let{className:r,variant:l,size:n,asChild:o=!1,...d}=e,u=o?a.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(c({variant:l,size:n,className:r})),ref:s,...d})});o.displayName="Button"},7673:function(e,s,r){r.d(s,{Ol:function(){return o},Zb:function(){return c},aY:function(){return h},eW:function(){return m},ll:function(){return d}});var t=r(5893),l=r(7294),a=r(5697),n=r.n(a),i=r(2350);let c=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...a,children:l})});c.displayName="Card",c.propTypes={className:n().string,children:n().node};let o=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...a,children:l})});o.displayName="CardHeader",o.propTypes={className:n().string,children:n().node};let d=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a,children:l})});d.displayName="CardTitle",d.propTypes={className:n().string,children:n().node};let u=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",r),...a,children:l})});u.displayName="CardDescription",u.propTypes={className:n().string,children:n().node};let h=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",r),...a,children:l})});h.displayName="CardContent",h.propTypes={className:n().string,children:n().node};let m=l.forwardRef((e,s)=>{let{className:r,children:l,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",r),...a,children:l})});m.displayName="CardFooter",m.propTypes={className:n().string,children:n().node}},2003:function(e,s,r){r.d(s,{j:function(){return n}});var t=r(512);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=t.W,n=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:i}=s,c=Object.keys(n).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let a=l(s)||l(t);return n[e][a]}),o=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return a(e,c,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...l}=s;return Object.entries(l).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...o}[s]):({...i,...o})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
@@ -0,0 +1,6 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42,211],{9333:function(e,r,n){n.d(r,{Z:function(){return t}});/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let t=(0,n(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},4042:function(e,r,n){n.r(r),n.d(r,{Config:function(){return p}});var t=n(5893),s=n(7294),l=n(1163),a=n(803),i=n(7673),o=n(7324),c=n(1812),d=n(8799),u=n(9333),f=n(1272),m=n(6989),x=n(7145);function h(){let[e,r]=(0,s.useState)(null),[n,l]=(0,s.useState)(null),a=async()=>{let e=await x.x.get("/api/health"),n=await e.json();n.version&&r(n.version),n.commit&&l(n.commit)};return((0,s.useEffect)(()=>{a()},[]),e)?(0,t.jsx)(m.Md,{content:n?"Commit: ".concat(n):"Commit information not available",className:"text-sm text-muted-foreground",children:(0,t.jsxs)("div",{className:"text-sm text-gray-500 cursor-help border-b border-dotted border-gray-400 inline-block",children:["Version: ",e]})}):null}var g=n(7853);function p(){let e=(0,l.useRouter)(),[r,n]=(0,s.useState)(""),[m,p]=(0,s.useState)(!0),[v,b]=(0,s.useState)(!1),[y,j]=(0,s.useState)(null),[N,w]=(0,s.useState)(!1),[k,C]=(0,s.useState)(!1),L=(0,s.useRef)(null);(0,s.useEffect)(()=>{A(),(async()=>{C(await (0,g.TO)())})()},[]),(0,s.useEffect)(()=>()=>{L.current&&clearTimeout(L.current)},[]);let A=async()=>{p(!0),j(null);try{let e=await (0,o.iE)();0===Object.keys(e).length?n(""):n(f.ZP.dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),j(e)}finally{p(!1)}},z=async()=>{b(!0),j(null),L.current&&(clearTimeout(L.current),L.current=null);try{let e=await x.x.get("/users/role");if(!e.ok){let r=await e.json();throw Error(r.detail||"Failed to get user role")}let n=await e.json(),t=n.role;if("admin"!=t){j(Error("".concat(n.name," is logged in as non-admin and cannot edit config"))),b(!1);return}let s=f.ZP.load(r);if(null==s&&(s={}),"object"!=typeof s||Array.isArray(s)){let e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(s),e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",j(Error(e)),b(!1);return}await (0,o.rF)(s),w(!0),L.current=setTimeout(()=>{w(!1),L.current=null},5e3)}catch(e){console.error("Error saving config:",e),j(e)}finally{b(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsx)("div",{className:"text-base flex items-center",children:(0,t.jsx)("span",{className:"text-sky-blue",children:"SkyPilot API Server"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"text-sm flex items-center",children:(m||v)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(d.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:v?"Applying...":"Loading..."})]})}),k&&(0,t.jsxs)("button",{onClick:()=>{let e=(0,g.ki)(),r=window.location.hostname;window.open("".concat(e,"/d/skypilot-apiserver-overview/skypilot-api-server?orgId=1&from=now-1h&to=now&timezone=browser&var-app=").concat(r),"_blank")},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-sky-blue-bright border border-transparent rounded-md shadow-sm hover:bg-sky-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-blue mr-4",children:[(0,t.jsx)("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),"View API Server Metrics"]}),(0,t.jsx)(h,{})]})]}),(0,t.jsxs)(i.Zb,{className:"w-full",children:[(0,t.jsx)(i.Ol,{children:(0,t.jsx)(i.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,t.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,t.jsxs)(i.aY,{className:"space-y-4",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,t.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),N&&(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]}),(0,t.jsx)("div",{className:"ml-auto pl-3",children:(0,t.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>{w(!1),L.current&&(clearTimeout(L.current),L.current=null)},className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,t.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,t.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),y&&(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(c.X,{error:y,title:"Failed to apply new configuration",onDismiss:()=>j(null)})}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("textarea",{value:r,onChange:e=>n(e.target.value),className:"w-full h-96 p-3 border border-gray-300 rounded font-mono text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:m?"Loading configuration...":"# Enter SkyPilot configuration in YAML format\n# Example:\n# kubernetes:\n# allowed_contexts: [default, my-context]",disabled:m||v})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-3 pt-3",children:[(0,t.jsx)(a.z,{variant:"outline",onClick:()=>{e.push("/workspaces")},disabled:v,children:"Cancel"}),(0,t.jsx)(a.z,{onClick:z,disabled:m||v,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})]})]})]})]})}},1812:function(e,r,n){n.d(r,{X:function(){return a}});var t=n(5893),s=n(7294);let l=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let r=e.message;return r.includes("failed:")&&(r=r.split("failed:")[1].trim()),r},a=e=>{let{error:r,title:n="Error",onDismiss:a}=e,[i,o]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{r&&o(!1)},[r]),!r||i)return null;let c="string"==typeof r?r:l(r);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[n,":"]})," ",c]})})]}),(0,t.jsx)("button",{onClick:()=>{o(!0),a&&a()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,r,n){n.d(r,{z:function(){return c}});var t=n(5893),s=n(7294),l=n(8426),a=n(2003),i=n(2350);let o=(0,a.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,r)=>{let{className:n,variant:s,size:a,asChild:c=!1,...d}=e,u=c?l.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(o({variant:s,size:a,className:n})),ref:r,...d})});c.displayName="Button"},7673:function(e,r,n){n.d(r,{Ol:function(){return c},Zb:function(){return o},aY:function(){return f},eW:function(){return m},ll:function(){return d}});var t=n(5893),s=n(7294),l=n(5697),a=n.n(l),i=n(2350);let o=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...l,children:s})});o.displayName="Card",o.propTypes={className:a().string,children:a().node};let c=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",n),...l,children:s})});c.displayName="CardHeader",c.propTypes={className:a().string,children:a().node};let d=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("h3",{ref:r,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",n),...l,children:s})});d.displayName="CardTitle",d.propTypes={className:a().string,children:a().node};let u=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("p",{ref:r,className:(0,i.cn)("text-sm text-muted-foreground",n),...l,children:s})});u.displayName="CardDescription",u.propTypes={className:a().string,children:a().node};let f=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("p-6 pt-0",n),...l,children:s})});f.displayName="CardContent",f.propTypes={className:a().string,children:a().node};let m=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("flex items-center p-6 pt-0",n),...l,children:s})});m.displayName="CardFooter",m.propTypes={className:a().string,children:a().node}},7853:function(e,r,n){n.d(r,{TO:function(){return l},ki:function(){return a}});let t=null,s=null,l=async()=>null!==t?t:s||(s=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),r=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return t=r.status>=200&&r.status<500}catch(e){return console.debug("Grafana availability check failed:",e),t=!1,!1}finally{s=null}})()),a=()=>"".concat(window.location.origin,"/grafana")},2003:function(e,r,n){n.d(r,{j:function(){return a}});var t=n(512);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,a=(e,r)=>n=>{var t;if((null==r?void 0:r.variants)==null)return l(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:a,defaultVariants:i}=r,o=Object.keys(a).map(e=>{let r=null==n?void 0:n[e],t=null==i?void 0:i[e];if(null===r)return null;let l=s(r)||s(t);return a[e][l]}),c=n&&Object.entries(n).reduce((e,r)=>{let[n,t]=r;return void 0===t||(e[n]=t),e},{});return l(e,o,null==r?void 0:null===(t=r.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:n,className:t,...s}=r;return Object.entries(s).every(e=>{let[r,n]=e;return Array.isArray(n)?n.includes({...i,...c}[r]):({...i,...c})[r]===n})?[...e,n,t]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[470],{3850:function(e,t,r){r.d(t,{E9:function(){return g},J$:function(){return l},PC:function(){return f},Ps:function(){return i},QT:function(){return u},Vp:function(){return d},W2:function(){return c},Ye:function(){return a},aD:function(){return v},eU:function(){return x},fp:function(){return h},fy:function(){return p},h0:function(){return m},mU:function(){return j},oy:function(){return y},r7:function(){return w}});var s=r(5893);r(7294);var n=r(8507),o=r(8586);function i(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function c(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function l(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function a(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("path",{d:"M6 12l4 4 8-8"})})}function h(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,s.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function x(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("ellipse",{cx:"12",cy:"4",rx:"8",ry:"2"}),(0,s.jsx)("ellipse",{cx:"12",cy:"20",rx:"8",ry:"2"}),(0,s.jsx)("path",{d:"M4 4v16"}),(0,s.jsx)("path",{d:"M20 4v16"}),(0,s.jsx)("path",{d:"M9 9h6"}),(0,s.jsx)("path",{d:"M9 12h6"}),(0,s.jsx)("path",{d:"M9 15h6"})]})}function u(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,s.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,s.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,s.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function d(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,s.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function f(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,s.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,s.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,s.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,s.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,s.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,s.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,s.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,s.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,s.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function m(e){return(0,s.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,s.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,s.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function p(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function w(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function j(e){return(0,s.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,s.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function g(e){return(0,s.jsx)("svg",{...e,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,s.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let v=n.Z,y=o.Z},9470:function(e,t,r){r.r(t),r.d(t,{Layout:function(){return v}});var s=r(5893),n=r(7294),o=r(5675),i=r.n(o),c=r(1163),l=r(1664),a=r.n(l),h=r(3850),x=r(355),u=r(6021),d=r(3225),f=r(6989),m=r(3001);let p=(0,n.createContext)(null);function w(e){let{children:t}=e,[r,o]=(0,n.useState)(!0),[i,c]=(0,n.useState)(null),[l,a]=(0,n.useState)(null),h=window.location.origin,x="".concat(h).concat(d.f4);return(0,n.useEffect)(()=>{fetch("".concat(x,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&(c(e.user.name),(async()=>{try{let e=await fetch("".concat(x,"/users/role"));if(e.ok){let t=await e.json();t.role&&a(t.role)}}catch(e){console.log("Could not fetch user role:",e)}})())}).catch(e=>{console.error("Error fetching user data:",e)})},[x]),(0,s.jsx)(p.Provider,{value:{isSidebarOpen:r,toggleSidebar:()=>{o(e=>!e)},userEmail:i,userRole:l},children:t})}function j(){let e,t;let r=(0,c.useRouter)(),o=(0,m.X)(),{userEmail:l,userRole:w}=function(){let e=(0,n.useContext)(p);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}(),[j,g]=(0,n.useState)(!1),v=(0,n.useRef)(null);(0,n.useEffect)(()=>{function e(e){v.current&&!v.current.contains(e.target)&&g(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[v]);let y=e=>"/workspaces"===e?r.pathname.startsWith("/workspaces")||r.pathname.startsWith("/workspace"):r.pathname.startsWith(e),k=e=>{let t=y(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(o?"px-2 py-1":"px-1 pt-1 space-x-2")};return(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,s.jsxs)("div",{className:"flex items-center h-full",children:[(0,s.jsx)("div",{className:"flex items-center ".concat(o?"space-x-2 mr-2":"space-x-4 mr-6"),children:(0,s.jsx)(a(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,s.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,s.jsx)(i(),{src:"".concat(d.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})}),(0,s.jsxs)("div",{className:"flex items-center ".concat(o?"space-x-1":"space-x-2 md:space-x-4"," ").concat(o?"mr-2":"mr-6"),children:[(0,s.jsxs)(a(),{href:"/clusters",className:k("/clusters"),prefetch:!1,children:[(0,s.jsx)(h.QT,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Clusters"})]}),(0,s.jsxs)(a(),{href:"/jobs",className:k("/jobs"),prefetch:!1,children:[(0,s.jsx)(h.Vp,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Jobs"})]}),(0,s.jsxs)(a(),{href:"/volumes",className:k("/volumes"),prefetch:!1,children:[(0,s.jsx)(h.eU,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Volumes"})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,s.jsxs)(a(),{href:"/infra",className:k("/infra"),prefetch:!1,children:[(0,s.jsx)(h.PC,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Infra"})]}),(0,s.jsxs)(a(),{href:"/workspaces",className:k("/workspaces"),prefetch:!1,children:[(0,s.jsx)(h.E9,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Workspaces"})]}),(0,s.jsxs)(a(),{href:"/users",className:k("/users"),prefetch:!1,children:[(0,s.jsx)(h.oy,{className:"w-4 h-4"}),!o&&(0,s.jsx)("span",{children:"Users"})]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1 ".concat(o?"ml-0":"ml-auto"),children:[(0,s.jsx)(f.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,s.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 py-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[!o&&(0,s.jsx)("span",{className:"mr-1",children:"Docs"}),(0,s.jsx)(h.h0,{className:"".concat(o?"w-4 h-4":"w-3.5 h-3.5")})]})}),(0,s.jsx)(f.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,s.jsx)(h.fy,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,s.jsx)(f.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,s.jsx)(h.mU,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,s.jsx)(f.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,s.jsx)(h.aD,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,s.jsx)(f.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,s.jsx)(a(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(y("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,s.jsx)(x.Z,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),l&&(0,s.jsxs)("div",{className:"relative",ref:v,children:[(0,s.jsx)("button",{onClick:()=>g(!j),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,s.jsx)("div",{className:"".concat(o?"w-6 h-6":"w-7 h-7"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium ").concat(o?"text-xs":"text-sm"," hover:bg-blue-700 transition-colors"),children:l?l.includes("@")?l.split("@")[0].charAt(0).toUpperCase():l.charAt(0).toUpperCase():"?"})}),j&&(0,s.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=l,t=null,l&&l.includes("@")&&(e=l.split("@")[0],t=l),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),w&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===w?(0,s.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,s.jsx)(h.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,s.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,s.jsx)(u.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,s.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,s.jsx)(a(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>g(!1),prefetch:!1,children:"See all users"})]})]})]})]})})}function g(e){let{children:t,highlighted:r}=e;return(0,m.X)(),(0,s.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,s.jsx)(j,{})}),(0,s.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,s.jsx)("main",{className:"p-6",children:t})})]})}function v(e){return(0,s.jsx)(w,{children:(0,s.jsx)(g,{...e})})}},3001:function(e,t,r){r.d(t,{X:function(){return n}});var s=r(7294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[513,211],{803:function(e,r,t){t.d(r,{z:function(){return d}});var s=t(5893),n=t(7294),a=t(8426),l=t(2003),o=t(2350);let i=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=n.forwardRef((e,r)=>{let{className:t,variant:n,size:l,asChild:d=!1,...c}=e,u=d?a.g7:"button";return(0,s.jsx)(u,{className:(0,o.cn)(i({variant:n,size:l,className:t})),ref:r,...c})});d.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return d},Zb:function(){return i},aY:function(){return f},eW:function(){return m},ll:function(){return c}});var s=t(5893),n=t(7294),a=t(5697),l=t.n(a),o=t(2350);let i=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a,children:n})});i.displayName="Card",i.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex flex-col space-y-1.5 p-6",t),...a,children:n})});d.displayName="CardHeader",d.propTypes={className:l().string,children:l().node};let c=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("h3",{ref:r,className:(0,o.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a,children:n})});c.displayName="CardTitle",c.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("p",{ref:r,className:(0,o.cn)("text-sm text-muted-foreground",t),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let f=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("p-6 pt-0",t),...a,children:n})});f.displayName="CardContent",f.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex items-center p-6 pt-0",t),...a,children:n})});m.displayName="CardFooter",m.propTypes={className:l().string,children:l().node}},4513:function(e,r,t){t.r(r),t.d(r,{NewWorkspace:function(){return y}});var s=t(5893),n=t(7294),a=t(1163),l=t(1664),o=t.n(l),i=t(5152),d=t.n(i),c=t(7324),u=t(803),f=t(2350);let m=n.forwardRef((e,r)=>{let{className:t,type:n,...a}=e;return(0,s.jsx)("input",{type:n,className:(0,f.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a})});m.displayName="Input";var p=t(5320),x=n.forwardRef((e,r)=>(0,s.jsx)(p.WV.label,{...e,ref:r,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));x.displayName="Label";let b=(0,t(2003).j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),h=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)(x,{ref:r,className:(0,f.cn)(b(),t),...n})});h.displayName=x.displayName;var g=t(7673);let v=d()(()=>Promise.all([t.e(616),t.e(799),t.e(804),t.e(798),t.e(947),t.e(470),t.e(969),t.e(856),t.e(973),t.e(938),t.e(843)]).then(t.bind(t,5843)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[5843]},ssr:!1});function y(){(0,a.useRouter)();let[e,r]=(0,n.useState)(""),[t,l]=(0,n.useState)(!1),[i,d]=(0,n.useState)({}),[f,p]=(0,n.useState)(!0);(0,n.useEffect)(()=>{x()},[]);let x=async()=>{try{let e=await (0,c.fX)();d(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{p(!1)}},b=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),N=e.trim()&&!y;return t?(0,s.jsx)(v,{workspaceName:e,isNewWorkspace:!0}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,s.jsxs)("div",{className:"text-base flex items-center",children:[(0,s.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,s.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,s.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,s.jsxs)(g.Zb,{className:"max-w-md",children:[(0,s.jsx)(g.Ol,{children:(0,s.jsx)(g.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,s.jsxs)(g.aY,{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(h,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,s.jsx)(m,{id:"workspace-name",value:e,onChange:e=>r(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&N&&b()}}),y?(0,s.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,s.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,s.jsx)(u.z,{onClick:b,disabled:!N||f,className:"w-full bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:f?"Loading...":"Next: Configure Workspace"})]})]})]})}},2003:function(e,r,t){t.d(r,{j:function(){return l}});var s=t(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.W,l=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return a(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=r,i=Object.keys(l).map(e=>{let r=null==t?void 0:t[e],s=null==o?void 0:o[e];if(null===r)return null;let a=n(r)||n(s);return l[e][a]}),d=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return a(e,i,null==r?void 0:null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...n}=r;return Object.entries(n).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...o,...d}[r]):({...o,...d})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[513,211],{803:function(e,r,t){t.d(r,{z:function(){return d}});var s=t(5893),n=t(7294),a=t(8426),l=t(2003),o=t(2350);let i=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=n.forwardRef((e,r)=>{let{className:t,variant:n,size:l,asChild:d=!1,...c}=e,u=d?a.g7:"button";return(0,s.jsx)(u,{className:(0,o.cn)(i({variant:n,size:l,className:t})),ref:r,...c})});d.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return d},Zb:function(){return i},aY:function(){return f},eW:function(){return m},ll:function(){return c}});var s=t(5893),n=t(7294),a=t(5697),l=t.n(a),o=t(2350);let i=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a,children:n})});i.displayName="Card",i.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex flex-col space-y-1.5 p-6",t),...a,children:n})});d.displayName="CardHeader",d.propTypes={className:l().string,children:l().node};let c=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("h3",{ref:r,className:(0,o.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a,children:n})});c.displayName="CardTitle",c.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("p",{ref:r,className:(0,o.cn)("text-sm text-muted-foreground",t),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let f=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("p-6 pt-0",t),...a,children:n})});f.displayName="CardContent",f.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex items-center p-6 pt-0",t),...a,children:n})});m.displayName="CardFooter",m.propTypes={className:l().string,children:l().node}},4513:function(e,r,t){t.r(r),t.d(r,{NewWorkspace:function(){return y}});var s=t(5893),n=t(7294),a=t(1163),l=t(1664),o=t.n(l),i=t(5152),d=t.n(i),c=t(7324),u=t(803),f=t(2350);let m=n.forwardRef((e,r)=>{let{className:t,type:n,...a}=e;return(0,s.jsx)("input",{type:n,className:(0,f.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a})});m.displayName="Input";var p=t(5320),x=n.forwardRef((e,r)=>(0,s.jsx)(p.WV.label,{...e,ref:r,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));x.displayName="Label";let b=(0,t(2003).j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),h=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)(x,{ref:r,className:(0,f.cn)(b(),t),...n})});h.displayName=x.displayName;var g=t(7673);let v=d()(()=>Promise.all([t.e(616),t.e(799),t.e(804),t.e(798),t.e(947),t.e(989),t.e(470),t.e(969),t.e(856),t.e(973),t.e(938),t.e(843)]).then(t.bind(t,5843)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[5843]},ssr:!1});function y(){(0,a.useRouter)();let[e,r]=(0,n.useState)(""),[t,l]=(0,n.useState)(!1),[i,d]=(0,n.useState)({}),[f,p]=(0,n.useState)(!0);(0,n.useEffect)(()=>{x()},[]);let x=async()=>{try{let e=await (0,c.fX)();d(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{p(!1)}},b=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),N=e.trim()&&!y;return t?(0,s.jsx)(v,{workspaceName:e,isNewWorkspace:!0}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,s.jsxs)("div",{className:"text-base flex items-center",children:[(0,s.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,s.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,s.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,s.jsxs)(g.Zb,{className:"max-w-md",children:[(0,s.jsx)(g.Ol,{children:(0,s.jsx)(g.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,s.jsxs)(g.aY,{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(h,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,s.jsx)(m,{id:"workspace-name",value:e,onChange:e=>r(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&N&&b()}}),y?(0,s.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,s.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,s.jsx)(u.z,{onClick:b,disabled:!N||f,className:"w-full bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:f?"Loading...":"Next: Configure Workspace"})]})]})]})}},2003:function(e,r,t){t.d(r,{j:function(){return l}});var s=t(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.W,l=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return a(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=r,i=Object.keys(l).map(e=>{let r=null==t?void 0:t[e],s=null==o?void 0:o[e];if(null===r)return null;let a=n(r)||n(s);return l[e][a]}),d=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return a(e,i,null==r?void 0:null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...n}=r;return Object.entries(n).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...o,...d}[r]):({...o,...d})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[544],{2350:function(n,r,t){"use strict";t.d(r,{cn:function(){return c}});var u=t(512),e=t(8388);function c(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return(0,e.m6)((0,u.W)(r))}},1163:function(n,r,t){n.exports=t(6036)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[645],{1812:function(e,t,r){r.d(t,{X:function(){return l}});var s=r(5893),n=r(7294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let t=e.message;return t.includes("failed:")&&(t=t.split("failed:")[1].trim()),t},l=e=>{let{error:t,title:r="Error",onDismiss:l}=e,[i,o]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{t&&o(!1)},[t]),!t||i)return null;let c="string"==typeof t?t:a(t);return(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,s.jsx)("div",{className:"ml-3",children:(0,s.jsxs)("div",{className:"text-sm text-red-800",children:[(0,s.jsxs)("strong",{children:[r,":"]})," ",c]})})]}),(0,s.jsx)("button",{onClick:()=>{o(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,s.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,t,r){r.d(t,{z:function(){return c}});var s=r(5893),n=r(7294),a=r(8426),l=r(2003),i=r(2350);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=n.forwardRef((e,t)=>{let{className:r,variant:n,size:l,asChild:c=!1,...d}=e,u=c?a.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(o({variant:n,size:l,className:r})),ref:t,...d})});c.displayName="Button"},7673:function(e,t,r){r.d(t,{Ol:function(){return c},Zb:function(){return o},aY:function(){return f},eW:function(){return m},ll:function(){return d}});var s=r(5893),n=r(7294),a=r(5697),l=r.n(a),i=r(2350);let o=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...a,children:n})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let c=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...a,children:n})});c.displayName="CardHeader",c.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("h3",{ref:t,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a,children:n})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("p",{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",r),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let f=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("p-6 pt-0",r),...a,children:n})});f.displayName="CardContent",f.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex items-center p-6 pt-0",r),...a,children:n})});m.displayName="CardFooter",m.propTypes={className:l().string,children:l().node}},326:function(e,t,r){r.d(t,{$N:function(){return h},Be:function(){return x},Vq:function(){return o},cN:function(){return m},cZ:function(){return u},fK:function(){return f}});var s=r(5893),n=r(7294),a=r(6327),l=r(2350),i=r(3767);let o=a.fC;a.xz;let c=a.h_;a.x8;let d=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)(a.aV,{ref:t,className:(0,l.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...n})});d.displayName=a.aV.displayName;let u=n.forwardRef((e,t)=>{let{className:r,children:n,...o}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(d,{}),(0,s.jsxs)(a.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[n,(0,s.jsxs)(a.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,s.jsx)(i.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=a.VY.displayName;let f=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};f.displayName="DialogHeader";let m=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};m.displayName="DialogFooter";let h=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)(a.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",r),...n})});h.displayName=a.Dx.displayName;let x=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)(a.dk,{ref:t,className:(0,l.cn)("text-sm text-gray-500",r),...n})});x.displayName=a.dk.displayName},8764:function(e,t,r){r.d(t,{RM:function(){return o},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return i}});var s=r(5893),n=r(7294),a=r(2350);let l=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:t,className:(0,a.cn)("w-full caption-bottom text-base",r),...n})})});l.displayName="Table";let i=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("thead",{ref:t,className:(0,a.cn)("[&_tr]:border-b",r),...n})});i.displayName="TableHeader";let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tbody",{ref:t,className:(0,a.cn)("[&_tr:last-child]:border-0",r),...n})});o.displayName="TableBody",n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tfoot",{ref:t,className:(0,a.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...n})}).displayName="TableFooter";let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("tr",{ref:t,className:(0,a.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...n})});c.displayName="TableRow";let d=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("th",{ref:t,className:(0,a.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",r),...n})});d.displayName="TableHead";let u=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("td",{ref:t,className:(0,a.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...n})});u.displayName="TableCell",n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("caption",{ref:t,className:(0,a.cn)("mt-4 text-base text-muted-foreground",r),...n})}).displayName="TableCaption"},7774:function(e,t,r){r.r(t),r.d(t,{Volumes:function(){return R}});var s=r(5893),n=r(7294),a=r(5697),l=r.n(a),i=r(8799),o=r(803),c=r(8764),d=r(7145);async function u(){try{return(await d.x.fetch("/volumes",{},"GET")).map(e=>{var t,r,s;let n=e.cloud||"";return e.region&&(n+="/".concat(e.region)),e.zone&&(n+="/".concat(e.zone)),{name:e.name,launched_at:e.launched_at,user_hash:e.user_hash,user_name:e.user_name||"-",workspace:e.workspace||"-",last_attached_at:e.last_attached_at,status:e.status,type:e.type,cloud:e.cloud,region:e.region,zone:e.zone,infra:n,size:"".concat(e.size,"Gi"),config:e.config,storage_class:(null===(t=e.config)||void 0===t?void 0:t.storage_class_name)||"-",access_mode:(null===(r=e.config)||void 0===r?void 0:r.access_mode)||"-",namespace:(null===(s=e.config)||void 0===s?void 0:s.namespace)||"-",name_on_cloud:e.name_on_cloud}})||[]}catch(e){return console.error("Failed to fetch volumes:",e),[]}}async function f(e){let t="";try{let r=(await d.x.post("/volumes/delete",{names:[e]})).headers.get("X-Request-ID"),s=await d.x.get("/api/get?request_id=".concat(r));if(500===s.status){try{let e=await s.json();if(e.detail&&e.detail.error)try{t=JSON.parse(e.detail.error).message}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{success:!1,msg:t}}return{success:!0}}catch(e){return console.error("Failed to delete volume:",e),{success:!1,msg:e.message}}}var m=r(1214),h=r(4545),x=r(3626),p=r(7603),g=r(3001),j=r(7673),v=r(326),y=r(1812),N=r(1664),b=r.n(N),w=r(6989);let k=m.nb.REFRESH_INTERVAL;function R(){let[e,t]=(0,n.useState)(!1),r=(0,n.useRef)(null),a=(0,g.X)(),[l,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)(null),[m,h]=(0,n.useState)(null),[p,j]=(0,n.useState)(!1),N=()=>{r.current&&r.current()},w=async()=>{if(d){j(!0),h(null);try{let e=await f(d.name);if(!e.success)throw Error(e.msg);c(!1),u(null),N()}catch(e){h(e)}finally{j(!1)}}},R=()=>{c(!1),u(null),h(null)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,s.jsx)("div",{className:"text-base",children:(0,s.jsx)(b(),{href:"/volumes",className:"text-sky-blue hover:underline leading-none",children:"Volumes"})}),(0,s.jsxs)("div",{className:"flex items-center",children:[e&&(0,s.jsxs)("div",{className:"flex items-center mr-2",children:[(0,s.jsx)(i.Z,{size:15,className:"mt-0"}),(0,s.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,s.jsxs)("button",{onClick:N,disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,s.jsx)(x.Z,{className:"h-4 w-4 mr-1.5"}),!a&&(0,s.jsx)("span",{children:"Refresh"})]})]})]}),(0,s.jsx)(C,{refreshInterval:k,setLoading:t,refreshDataRef:r,onDeleteVolume:e=>{u(e),c(!0),h(null)}}),(0,s.jsx)(v.Vq,{open:l,onOpenChange:R,children:(0,s.jsxs)(v.cZ,{className:"sm:max-w-md",children:[(0,s.jsxs)(v.fK,{children:[(0,s.jsx)(v.$N,{children:"Delete Volume"}),(0,s.jsxs)(v.Be,{children:['Are you sure you want to delete volume "',(null==d?void 0:d.name)||"this volume",'"? This action cannot be undone.']})]}),(0,s.jsx)(y.X,{error:m,title:"Deletion Failed",onDismiss:()=>h(null)}),(0,s.jsxs)(v.cN,{children:[(0,s.jsx)(o.z,{variant:"outline",onClick:R,disabled:p,children:"Cancel"}),(0,s.jsx)(o.z,{variant:"destructive",onClick:w,disabled:p,children:p?"Deleting...":"Delete"})]})]})})]})}function C(e){let{refreshInterval:t,setLoading:r,refreshDataRef:a,onDeleteVolume:l}=e,[d,f]=(0,n.useState)([]),[m,x]=(0,n.useState)({key:null,direction:"ascending"}),[g,v]=(0,n.useState)(!1),[y,N]=(0,n.useState)(!0),[b,k]=(0,n.useState)(1),[R,C]=(0,n.useState)(10),_=(0,n.useCallback)(async()=>{r(!0),v(!0);try{let e=await u();f(e)}catch(e){console.error("Failed to fetch volumes:",e),f([])}finally{r(!1),v(!1),N(!1)}},[r]),S=(0,n.useMemo)(()=>(0,h.R0)(d,m.key,m.direction),[d,m]);(0,n.useEffect)(()=>{a&&(a.current=_)},[a,_]),(0,n.useEffect)(()=>{f([]);let e=!0;_();let r=setInterval(()=>{e&&_()},t);return()=>{e=!1,clearInterval(r)}},[t,_]),(0,n.useEffect)(()=>{k(1)},[d.length]);let z=e=>{let t="ascending";m.key===e&&"ascending"===m.direction&&(t="descending"),x({key:e,direction:t})},T=e=>m.key===e?"ascending"===m.direction?" ↑":" ↓":"",D=Math.ceil(S.length/R),L=(b-1)*R,E=L+R,M=S.slice(L,E),O=e=>e||"-",V=e=>{if(!e)return"-";try{let t=new Date(1e3*e);return(0,s.jsx)(w.Zg,{date:t})}catch(e){return"Invalid Date"}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(j.Zb,{children:(0,s.jsxs)(c.iA,{children:[(0,s.jsx)(c.xD,{children:(0,s.jsxs)(c.SC,{children:[(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("name"),children:["Name",T("name")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("infra"),children:["Infra",T("infra")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("status"),children:["Status",T("status")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("size"),children:["Size",T("size")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("user_name"),children:["User",T("user_name")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("last_attached_at"),children:["Last Use",T("last_attached_at")]}),(0,s.jsxs)(c.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>z("type"),children:["Type",T("type")]}),(0,s.jsx)(c.ss,{children:"Actions"})]})}),(0,s.jsx)(c.RM,{children:g&&y?(0,s.jsx)(c.SC,{children:(0,s.jsx)(c.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:(0,s.jsxs)("div",{className:"flex justify-center items-center",children:[(0,s.jsx)(i.Z,{size:20,className:"mr-2"}),(0,s.jsx)("span",{children:"Loading..."})]})})}):M.length>0?M.map(e=>(0,s.jsxs)(c.SC,{children:[(0,s.jsx)(c.pj,{className:"font-medium",children:e.name}),(0,s.jsx)(c.pj,{children:e.infra||"N/A"}),(0,s.jsx)(c.pj,{children:(0,s.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-sm font-medium ".concat("READY"===e.status?"bg-green-100 text-green-800":"IN_USE"===e.status?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"),children:e.status||"UNKNOWN"})}),(0,s.jsx)(c.pj,{children:O(e.size)}),(0,s.jsx)(c.pj,{children:e.user_name||"N/A"}),(0,s.jsx)(c.pj,{children:V(e.last_attached_at)}),(0,s.jsx)(c.pj,{children:e.type||"N/A"}),(0,s.jsx)(c.pj,{children:(0,s.jsx)(o.z,{variant:"ghost",size:"sm",onClick:()=>l(e),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:"Delete volume",children:(0,s.jsx)(p.Z,{className:"w-4 h-4"})})})]},e.name)):(0,s.jsx)(c.SC,{children:(0,s.jsx)(c.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:"No volumes found"})})})]})}),d.length>0&&(0,s.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,s.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,s.jsxs)("div",{className:"relative inline-block",children:[(0,s.jsxs)("select",{value:R,onChange:e=>{C(parseInt(e.target.value,10)),k(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,s.jsx)("option",{value:10,children:"10"}),(0,s.jsx)("option",{value:30,children:"30"}),(0,s.jsx)("option",{value:50,children:"50"}),(0,s.jsx)("option",{value:100,children:"100"}),(0,s.jsx)("option",{value:200,children:"200"})]}),(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,s.jsxs)("div",{children:[L+1," – ",Math.min(E,d.length)," of"," ",d.length]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{k(e=>Math.max(e-1,1))},disabled:1===b,className:"text-gray-500 h-8 w-8 p-0",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,s.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,s.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{k(e=>Math.min(e+1,D))},disabled:b===D||0===D,className:"text-gray-500 h-8 w-8 p-0",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,s.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}C.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,onDeleteVolume:l().func.isRequired}},7145:function(e,t,r){r.d(t,{x:function(){return n}});var s=r(3225);let n={fetch:async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",n=window.location.origin,a="".concat(n).concat(s.f4).concat(e),l=await fetch(a,{method:r,headers:"POST"===r?{"Content-Type":"application/json"}:{},body:"POST"===r?JSON.stringify(t):void 0}),i=l.headers.get("X-Skypilot-Request-ID")||l.headers.get("X-Request-ID"),o=await fetch("".concat(n).concat(s.f4,"/api/get?request_id=").concat(i)),c=await o.json();return c.return_value?JSON.parse(c.return_value):[]},post:async(e,t)=>{let r=window.location.origin,n="".concat(r).concat(s.f4).concat(e);return await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},stream:async(e,t,r)=>{let s=(await n.post(e,t)).body.getReader();try{for(;;){let{done:e,value:t}=await s.read();if(e)break;let n=new TextDecoder().decode(t);r(n)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let t=window.location.origin,r="".concat(t).concat(s.f4).concat(e);return await fetch(r)}}},4545:function(e,t,r){function s(e){return e.startsWith("sky-jobs-controller-")}function n(e,t,r){return null===t?e:[...e].sort((e,s)=>e[t]<s[t]?"ascending"===r?-1:1:e[t]>s[t]?"ascending"===r?1:-1:0)}r.d(t,{R0:function(){return n},Ym:function(){return s}})},3001:function(e,t,r){r.d(t,{X:function(){return n}});var s=r(7294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}},2350:function(e,t,r){r.d(t,{cn:function(){return a}});var s=r(512),n=r(8388);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.m6)((0,s.W)(t))}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66,544],{7145:function(e,r,t){"use strict";t.d(r,{x:function(){return a}});var o=t(3225);let a={fetch:async function(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",a=window.location.origin,s="".concat(a).concat(o.f4).concat(e),n=await fetch(s,{method:t,headers:"POST"===t?{"Content-Type":"application/json"}:{},body:"POST"===t?JSON.stringify(r):void 0}),c=n.headers.get("X-Skypilot-Request-ID")||n.headers.get("X-Request-ID"),l=await fetch("".concat(a).concat(o.f4,"/api/get?request_id=").concat(c)),i=await l.json();return i.return_value?JSON.parse(i.return_value):[]},post:async(e,r)=>{let t=window.location.origin,a="".concat(t).concat(o.f4).concat(e);return await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},stream:async(e,r,t)=>{let o=(await a.post(e,r)).body.getReader();try{for(;;){let{done:e,value:r}=await o.read();if(e)break;let a=new TextDecoder().decode(r);t(a)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let r=window.location.origin,t="".concat(r).concat(o.f4).concat(e);return await fetch(t)}}},7324:function(e,r,t){"use strict";t.d(r,{MB:function(){return l},eA:function(){return c},fX:function(){return a},iE:function(){return u},rF:function(){return d},yz:function(){return s},zl:function(){return i}});var o=t(7145);async function a(){try{let e=await o.x.get("/workspaces");if(!e.ok)throw Error("Error scheduling getWorkspaces: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r){console.warn("X-Skypilot-Request-ID header not found in /workspaces response. Attempting to find request_id in response body as a fallback.");try{let t=await e.json();if(t&&t.request_id)r=t.request_id,console.log("Found request_id in /workspaces response body (fallback):",r);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /workspaces.")}catch(r){let e=r.message||"Error processing fallback for request_id from /workspaces response body.";throw console.error("Error in /workspaces request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!r)throw Error("Failed to obtain X-Skypilot-Request-ID from /workspaces response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching workspace data with request_id: ".concat(r));let t=await o.x.get("/api/get?request_id=".concat(r));if(!t.ok){let e="Error fetching workspace data for request ID ".concat(r,": ").concat(t.statusText," (status ").concat(t.status,")");try{let o=await t.json();if(o&&o.detail){let t=o.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching workspace data for request ID ".concat(r,": ").concat(t)}}catch(e){}throw Error(e)}let a=await t.json();if(console.log("[Connector Debug] Full resultData from /api/get:",a),"FAILED"===a.status){let e="Unknown error during task execution";if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",s)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse workspace data for request ID ".concat(r,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for status ".concat(a.status)),s=a.result);return console.log("Effectively fetched workspace data (to be returned):",s),s||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t="/enabled_clouds",a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let s=await o.x.get(t);if(!s.ok)throw Error("Error scheduling getEnabledClouds: ".concat(s.statusText," (status ").concat(s.status,")"));let n=s.headers.get("X-Skypilot-Request-ID");if(!n){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await s.json();if(e&&e.request_id)n=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",n);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(r){let e=r.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!n)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(n));let c=await o.x.get("/api/get?request_id=".concat(n));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(c.statusText," (status ").concat(c.status,")");try{let r=await c.json();if(r&&r.detail){let t=r.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(t)}}catch(e){}throw Error(e)}let l=await c.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",l),"FAILED"===l.status){let e=l.error||l.result&&l.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(n,": ").concat(e))}let i=[];if("SUCCEEDED"===l.status&&l.return_value)try{i=JSON.parse(l.return_value),console.log("Successfully parsed enabled_clouds data from return_value:",i)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",l.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(n,": ").concat(e.message))}else l.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(l.status)),i=l.result);return Array.isArray(i)?i:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function n(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await o.x.get("/api/get?request_id=".concat(e));if(!t.ok){let o="Error fetching ".concat(r," data for request ID ").concat(e,": ").concat(t.statusText," (status ").concat(t.status,")");try{let e=await t.json();if(console.error("[Error Debug] ".concat(r," HTTP error response:"),JSON.stringify(e,null,2)),e&&e.detail){if("object"==typeof e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t&&t.message)o="".concat(r," failed: ").concat(t.message);else if(t&&"object"==typeof t){let e=t.type||JSON.stringify(t);o="".concat(r," failed: ").concat(e)}}catch(t){o="".concat(r," failed: ").concat(e.detail.error)}else if("string"==typeof e.detail)o="".concat(r," failed: ").concat(e.detail);else{let t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=t(a,r?"".concat(r,".").concat(o):o);if(e)return e}return null},a=t(e.detail);a&&(o="".concat(r," failed: ").concat(a))}}}catch(e){console.error("[Error Debug] Failed to parse error response:",e)}throw Error(o)}let a=await t.json();if(console.log("[Connector Debug] ".concat(r," resultData:"),a),"FAILED"===a.status){console.error("[Error Debug] ".concat(r," failed. Full resultData:"),JSON.stringify(a,null,2)),console.error("[Error Debug] resultData.error:",a.error),console.error("[Error Debug] resultData.result:",a.result),console.error("[Error Debug] resultData.return_value:",a.return_value);let e="Unknown error during ".concat(r," task execution");if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){a.return_value&&(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}if(e==="Unknown error during ".concat(r," task execution")){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=r(a,t?"".concat(t,".").concat(o):o);if(e)return e}return null},t=r(a);t&&(e=t)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),s)}catch(t){throw console.error("Failed to parse ".concat(r," data from return_value:"),t,"Raw return_value:",a.return_value),Error("Failed to parse ".concat(r," data for request ID ").concat(e,": ").concat(t.message))}else a.result&&(console.warn("Using resultData.result as fallback for ".concat(r," status ").concat(a.status)),s=a.result);return s}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await o.x.post("/workspaces/update",{workspace_name:e,config:r});if(!t.ok)throw Error("Error scheduling updateWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for updateWorkspace");return await n(a,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let l=async(e,r)=>{try{let t=await o.x.post("/workspaces/create",{workspace_name:e,config:r});if(!t.ok)throw await t.text(),Error("Error scheduling createWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for createWorkspace");return await n(a,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function i(e){try{console.log("Deleting workspace ".concat(e));let r=await o.x.post("/workspaces/delete",{workspace_name:e});if(!r.ok)throw Error("Error scheduling deleteWorkspace: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for deleteWorkspace");console.log("[Delete Debug] Got request ID for deleteWorkspace: ".concat(t));try{let e=await n(t,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await o.x.get("/workspaces/config");if(!e.ok)throw Error("Error scheduling getConfig: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r)throw Error("Failed to obtain request ID for getConfig");return await n(r,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function d(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let r=await o.x.post("/workspaces/config",{config:e});if(!r.ok)throw Error("Error scheduling updateConfig: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for updateConfig");return await n(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}},2350:function(e,r,t){"use strict";t.d(r,{cn:function(){return s}});var o=t(512),a=t(8388);function s(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,a.m6)((0,o.W)(r))}},1163:function(e,r,t){e.exports=t(6036)}}]);
@@ -0,0 +1,6 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[682],{3626:function(e,t,s){s.d(t,{Z:function(){return a}});/**
2
+ * @license lucide-react v0.407.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */let a=(0,s(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},8682:function(e,t,s){s.r(t),s.d(t,{ContextDetails:function(){return w},GPUs:function(){return v},InfrastructureSection:function(){return y}});var a=s(5893),l=s(7294),r=s(8799);s(9470);var n=s(3626),c=s(3001),d=s(7853),o=s(2045),i=s(3266),m=s(8969),x=s(6378),h=s(6856),u=s(1214),g=s(1163),f=s(1664),p=s.n(f),j=s(6989);let b=u.nb.REFRESH_INTERVAL,N=u.MO.NAME_TRUNCATE_LENGTH;function y(e){let{title:t,isLoading:s,isDataLoaded:l,contexts:n,gpus:c,groupedPerContextGPUs:d,groupedPerNodeGPUs:o,handleContextClick:i,contextStats:m={},isSSH:x=!1}=e,h=n||[];return s||!l?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:t}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",t,"..."]})]})]})}):l&&0===h.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:t}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",t," found or ",t," is not configured."]})]})}):l&&h.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:t}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[h.length," ",1===h.length?x?"pool":"context":x?"pools":"contexts"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:x?"Node Pool":"Context"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(h.length>5?"max-h-[250px] overflow-y-auto block":""),children:h.map(e=>{let t=d[e]||[],s=o[e]||[],l=t.reduce((e,t)=>e+(t.gpu_total||0),0),r=m[x?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0},n=Object.keys(t.reduce((e,t)=>(e[t.gpu_name]=(e[t.gpu_name]||0)+(t.gpu_total||0),e),{})).join(", "),c=x?e.replace(/^ssh-/,""):e;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(j.Md,{content:c,className:"text-sm text-muted-foreground",children:(0,a.jsx)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>i(e),children:c.length>N?"".concat(c.substring(0,Math.floor((N-3)/2)),"...").concat(c.substring(c.length-Math.ceil((N-3)/2))):c})})}),(0,a.jsx)("td",{className:"p-3",children:r.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:r.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:r.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:r.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:(s||[]).length}),(0,a.jsx)("td",{className:"p-3",children:n||"-"}),(0,a.jsx)("td",{className:"p-3",children:l})]},e)})})]})})}),c&&c.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[c.reduce((e,t)=>e+t.gpu_free,0)," ","of"," ",c.reduce((e,t)=>e+t.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(c.length>5?"max-h-[250px] overflow-y-auto block":""),children:c.map(e=>{let t=e.gpu_total-e.gpu_free,s=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?t/e.gpu_total*100:0,r=d?Object.values(d).flat().filter(t=>t.gpu_name===e.gpu_name&&(x?t.context.startsWith("ssh-"):!t.context.startsWith("ssh-"))).map(e=>e.gpu_requestable_qty_per_node).filter((e,t,s)=>s.indexOf(e)===t).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:e.gpu_name}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[r||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"flex-1 bg-gray-100 rounded-md h-5 flex overflow-hidden shadow-sm min-w-[100px] w-full",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs font-medium",children:l>15&&"".concat(t," used")}),s>0&&(0,a.jsx)("div",{style:{width:"".concat(s,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs font-medium",children:s>15&&"".concat(e.gpu_free," free")})]})})})]},e.gpu_name)})})]})})})]})]})}):null}function w(e){let{contextName:t,gpusInContext:s,nodesInContext:n}=e;t.startsWith("ssh-");let[c,o]=(0,l.useState)([]),[i,m]=(0,l.useState)("$__all"),[x,h]=(0,l.useState)({from:"now-1h",to:"now"}),[u,g]=(0,l.useState)(!1),[f,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{p(await (0,d.TO)())})()},[]);let j=(0,l.useCallback)(async()=>{if(f){g(!0);try{let e=(0,d.ki)();for(let t of["/api/datasources/proxy/1/api/v1/label/node/values"])try{let s=await fetch("".concat(e).concat(t),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(s.ok){let e=await s.json();if(e.data&&e.data.length>0){o(e.data.sort()),console.log("Successfully fetched hosts from ".concat(t,":"),e.data);break}}else console.log("HTTP ".concat(s.status," from ").concat(t,": ").concat(s.statusText))}catch(e){console.log("Failed to fetch from ".concat(t,":"),e);continue}}catch(e){console.error("Error fetching available hosts:",e)}finally{g(!1)}}},[f]);(0,l.useEffect)(()=>{f&&n&&n.length>0&&j()},[n,f,j]);let b=e=>{let t=(0,d.ki)(),s="$__all"===i?"$__all":i;return"".concat(t,"/d-solo/skypilot-dcgm-cluster-dashboard/skypilot-dcgm-kubernetes-cluster-dashboard?orgId=1&timezone=browser&var-datasource=prometheus&var-host=").concat(encodeURIComponent(s),"&var-gpu=$__all&refresh=5s&theme=light&from=").concat(encodeURIComponent(x.from),"&to=").concat(encodeURIComponent(x.to),"&panelId=").concat(e,"&__feature.dashboardSceneSolo")},N=e=>{h({"15m":{from:"now-15m",to:"now"},"1h":{from:"now-1h",to:"now"},"6h":{from:"now-6h",to:"now"},"24h":{from:"now-24h",to:"now"},"7d":{from:"now-7d",to:"now"}}[e])};return(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h4",{className:"text-lg font-semibold",children:"Available GPUs"})}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:s.map(e=>{let t=e.gpu_total-e.gpu_free,s=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?t/e.gpu_total*100:0;return(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[e.gpu_name,(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsxs)("div",{className:"w-full bg-gray-100 rounded-md h-4 flex overflow-hidden shadow-sm",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs",children:l>15&&"".concat(t," used")}),s>0&&(0,a.jsx)("div",{style:{width:"".concat(s,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs",children:s>15&&"".concat(e.gpu_free," free")})]})]},e.gpu_name)})}),n&&n.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"IP Address"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:n.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.ip_address||"-"}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(t)))})]})})]}),f&&n&&n.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4 mt-6",children:"GPU Metrics"}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"host-select",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Node:"}),(0,a.jsxs)("select",{id:"host-select",value:i,onChange:e=>{m(e.target.value)},disabled:u,className:"px-3 py-1 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-sky-blue focus:border-transparent",children:[(0,a.jsx)("option",{value:"$__all",children:"All Nodes"}),c.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),u&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(r.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>N(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(x.from==="now-".concat(e.value)&&"now"===x.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing:"," ","$__all"===i?"All nodes":i," • Time: ",x.from," to ",x.to,c.length>0&&(0,a.jsxs)("span",{children:[" • ",c.length," nodes available"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("6"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(i,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("18"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory",className:"rounded"},"gpu-memory-".concat(i,"-").concat(x.from,"-").concat(x.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:b("10"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Consumption",className:"rounded"},"gpu-power-".concat(i,"-").concat(x.from,"-").concat(x.to))})})]})]})]})})})}function v(){let[e,t]=(0,l.useState)(!0),[s,d]=(0,l.useState)(!0),[u,f]=(0,l.useState)(!0),j=l.useRef(null),N=(0,c.X)(),[v,_]=(0,l.useState)(!1),[C,S]=(0,l.useState)(!1),k=(0,g.useRouter)(),[P,U]=(0,l.useState)([]),[I,E]=(0,l.useState)([]),[G,L]=(0,l.useState)([]),[R,A]=(0,l.useState)([]),[M,T]=(0,l.useState)([]),[q,Z]=(0,l.useState)(0),[z,F]=(0,l.useState)(0),[W,H]=(0,l.useState)({}),[D,O]=(0,l.useState)(null),$=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0};e.showLoadingIndicators&&(t(!0),d(!0));try{let e=await x.default.get(o.l4),{gpuData:t,cloudData:s}=e||{};if(t){let{allContextNames:e,allGPUs:s,perContextGPUs:a,perNodeGPUs:l,contextStats:r}=t;U(e||[]),E(s||[]),L(a||[]),A(l||[]),H(r||{}),_(!0)}else e&&null===e.gpuData?(U([]),E([]),L([]),A([]),H({}),_(!0)):e||console.log("No infra data received from cache");s?(T(s.clouds||[]),Z(s.totalClouds||0),F(s.enabledClouds||0),S(!0)):e&&null===e.cloudData?(T([]),Z(0),F(0),S(!0)):e||console.log("No cloud data received from cache")}catch(e){console.error("Error in fetchData:",e),U([]),E([]),L([]),A([]),H({}),T([]),Z(0),F(0),_(!0),S(!0)}finally{e.showLoadingIndicators&&(t(!1),d(!1)),u&&e.showLoadingIndicators&&f(!1)}},[u]);(0,l.useEffect)(()=>{j.current=$},[$]),(0,l.useEffect)(()=>{(async()=>{await h.ZP.preloadForPage("infra"),$({showLoadingIndicators:!0})})()},[$]),(0,l.useEffect)(()=>{let e=!0,t=setInterval(()=>{e&&j.current&&j.current({showLoadingIndicators:!1})},b);return()=>{e=!1,clearInterval(t)}},[]),(0,l.useEffect)(()=>()=>{_(!1),S(!1),f(!0)},[]),(I||[]).length,(I||[]).reduce((e,t)=>e+t.gpu_total,0),(I||[]).reduce((e,t)=>e+t.gpu_free,0);let B=l.useMemo(()=>G?G.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[G]),J=l.useMemo(()=>P&&Array.isArray(P)?P.filter(e=>e.startsWith("ssh-")):[],[P]),K=l.useMemo(()=>P&&Array.isArray(P)?P.filter(e=>!e.startsWith("ssh-")):[],[P]),V=l.useMemo(()=>{if(!G||!I)return[];let e=new Set;return G.forEach(t=>{t.context.startsWith("ssh-")&&e.add(t.gpu_name)}),I.filter(t=>e.has(t.gpu_name))},[I,G]),X=l.useMemo(()=>{if(!G||!I)return[];let e=new Set;return G.forEach(t=>{t.context.startsWith("ssh-")||e.add(t.gpu_name)}),I.filter(t=>e.has(t.gpu_name))},[I,G]),Q=l.useMemo(()=>R?R.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[R]);(0,l.useEffect)(()=>{k.isReady&&k.query.context&&O(decodeURIComponent(Array.isArray(k.query.context)?k.query.context[0]:k.query.context))},[k.isReady,k.query.context]);let Y=e=>{O(e),k.push("/infra/".concat(encodeURIComponent(e)))},ee=e||s,et=v&&C&&!u;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(D?"":"cursor-default"),children:"Infrastructure"}),D&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),D.startsWith("ssh-")?(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:D.startsWith("ssh-")?D.replace(/^ssh-/,""):D})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[ee&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(r.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsxs)("button",{onClick:()=>{x.default.invalidate(i.getClusters),x.default.invalidate(m.getManagedJobs,[{allUsers:!0}]),x.default.invalidate(o.l4),j.current&&j.current({showLoadingIndicators:!0})},disabled:ee,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 mr-1.5"}),!N&&"Refresh"]})]})]}),et?D?e&&!v?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(t=>{let s=B[t]||[],l=Q[t]||[];return e&&!v?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(0,a.jsx)(w,{contextName:t,gpusInContext:s,nodesInContext:l})})(D):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{title:"SSH Node Pool",isLoading:e,isDataLoaded:v,contexts:J,gpus:V,groupedPerContextGPUs:B,groupedPerNodeGPUs:Q,handleContextClick:Y,contextStats:W,isSSH:!0}),(0,a.jsx)(y,{title:"Kubernetes",isLoading:e,isDataLoaded:v,contexts:K,gpus:X,groupedPerContextGPUs:B,groupedPerNodeGPUs:Q,handleContextClick:Y,contextStats:W,isSSH:!1}),s||!C?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[z," of ",q," enabled"]})]}),M&&0!==M.length?(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:M.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 font-medium text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"p-3",children:e.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:e.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})})]},e.name))})]})}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No enabled clouds available."})]})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-32",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading infrastructure data..."})]})]})}},7853:function(e,t,s){s.d(t,{TO:function(){return r},ki:function(){return n}});let a=null,l=null,r=async()=>null!==a?a:l||(l=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),t=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return a=t.status>=200&&t.status<500}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{l=null}})()),n=()=>"".concat(window.location.origin,"/grafana")}}]);