import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{R as d,T as p,V as m,I as h,P as x,C as f,S as j,a as g,G as y,L as N,b,c as w,d as S,e as P}from"./index--z_DgN94.js";import{I as n,a as i}from"./misc-BapXpylh.js";import{c}from"./chunk-UIGDSWPH-BWkP6tD5.js";import{s as v}from"./progress-bar-D66irkpP.js";import{S as I}from"./tooltip-C2AQeNhD.js";import{u as C}from"./pe-Bs-DFNma.js";function T({appName:a,reset:s=!1,tooltipText:r,...t}){const l=c(),u=C(),o=e.jsx("button",{type:"submit",...t,className:i(t.className,l.state!=="idle"?"cursor-progress":null,l.data?.status==="error"?"cursor-not-allowed":null)});return e.jsxs(l.Form,{action:"/set-playground",method:"POST",className:"inline-flex items-center justify-center",children:[u,e.jsx("input",{type:"hidden",name:"appName",value:a}),s?e.jsx("input",{type:"hidden",name:"reset",value:"true"}):null,v,r?e.jsx(I,{content:r,children:o}):o]})}function L({playgroundAppName:a,allApps:s}){const r=c();return e.jsxs(d,{name:"appName",value:a,onValueChange:t=>{r.submit({appName:t},{method:"POST",action:"/set-playground"})},children:[e.jsxs(p,{"aria-label":"Select app for playground",className:i("radix-placeholder:text-gray-500 flex h-full w-full items-center justify-between text-left focus-visible:outline-none",r.state!=="idle"?"cursor-progress":null,r.data?.status==="error"?"cursor-not-allowed":null),children:[e.jsx("span",{className:"scrollbar-thin scrollbar-thumb-scrollbar w-80 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:e.jsx(m,{placeholder:"Select current app",className:"inline-block w-40 text-ellipsis"})}),e.jsx(h,{children:e.jsx(n,{name:"TriangleDownSmall"})})]}),e.jsx(x,{children:e.jsxs(f,{position:"popper",align:"start",className:"z-20 max-h-[50vh] bg-black text-white lg:max-h-[70vh]",children:[e.jsx(j,{className:"flex h-5 cursor-default items-center justify-center",children:e.jsx(n,{name:"ChevronUp"})}),e.jsx(g,{className:"p-3",children:e.jsxs(y,{children:[e.jsx(N,{className:"px-5 pb-3 font-mono uppercase",children:"App"}),s.filter(t=>t.name!=="playground").map(t=>e.jsx(k,{value:t.name,children:t.displayName},t.name))]})}),e.jsx(b,{className:"flex h-5 cursor-default items-center justify-center",children:e.jsx(n,{name:"ChevronDown"})})]})})]})}function k({value:a,children:s}){return e.jsxs(w,{value:a,className:"radix-disabled:text-red-500 radix-highlighted:opacity-100 radix-highlighted:outline-none radix-state-checked:opacity-100 relative flex cursor-pointer items-center rounded px-10 py-2 leading-none opacity-80 select-none",children:[e.jsx(S,{children:s}),e.jsx(P,{className:"absolute left-0 inline-flex w-[25px] items-center justify-center",children:e.jsx(n,{name:"CheckSmall"})})]})}function U({appName:a,isOutdated:s}){return ENV.EPICSHOP_DEPLOYED?null:e.jsx(T,{appName:a,tooltipText:s?"The app the playground was set to has been updated. Click to update to the latest version.":"Playground is not set to the right app. Click to set Playground.",children:e.jsxs("span",{className:"text-foreground-destructive flex items-center justify-center gap-1 hover:underline",children:[e.jsx(n,{name:"Unlinked",className:"animate-ping"})," ",e.jsx("span",{className:"uppercase",children:s?"Playground Outdated":"Set to Playground"})]})})}export{L as P,U as S,T as a};
//# sourceMappingURL=set-playground-kIjHv9mG.js.map
