@agents-shire/cli-darwin-arm64 1.0.2 → 1.0.4

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.
@@ -1,42 +0,0 @@
1
- import{la as n,oa as u0,qa as b,ra as T0,ua as y}from"/chunk-08yrv2nn.js";import{Aa as A,Ea as N,Fa as P1,Na as G0,Sa as i}from"/chunk-p8qycd26.js";var C=A(N(),1);var P0=A(N(),1);function w0($,Z=globalThis?.document){let J=y($);P0.useEffect(()=>{let W=(L)=>{if(L.key==="Escape")J(L)};return Z.addEventListener("keydown",W,{capture:!0}),()=>Z.removeEventListener("keydown",W,{capture:!0})},[J,Z])}var X0=A(G0(),1),z1="DismissableLayer",q0="dismissableLayer.update",B1="dismissableLayer.pointerDownOutside",H1="dismissableLayer.focusOutside",x0,S0=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),K1=C.forwardRef(($,Z)=>{let{disableOutsidePointerEvents:J=!1,onEscapeKeyDown:W,onPointerDownOutside:L,onFocusOutside:X,onInteractOutside:Y,onDismiss:q,...O}=$,Q=C.useContext(S0),[z,j]=C.useState(null),H=z?.ownerDocument??globalThis?.document,[,R]=C.useState({}),w=i(Z,(B)=>j(B)),G=Array.from(Q.layers),[K]=[...Q.layersWithOutsidePointerEventsDisabled].slice(-1),U=G.indexOf(K),E=z?G.indexOf(z):-1,M=Q.layersWithOutsidePointerEventsDisabled.size>0,D=E>=U,I=E1((B)=>{let S=B.target,g=[...Q.branches].some((c)=>c.contains(S));if(!D||g)return;if(L?.(B),Y?.(B),!B.defaultPrevented)q?.()},H),F=V1((B)=>{let S=B.target;if([...Q.branches].some((c)=>c.contains(S)))return;if(X?.(B),Y?.(B),!B.defaultPrevented)q?.()},H);return w0((B)=>{if(E!==Q.layers.size-1)return;if(W?.(B),!B.defaultPrevented&&q)B.preventDefault(),q()},H),C.useEffect(()=>{if(!z)return;if(J){if(Q.layersWithOutsidePointerEventsDisabled.size===0)x0=H.body.style.pointerEvents,H.body.style.pointerEvents="none";Q.layersWithOutsidePointerEventsDisabled.add(z)}return Q.layers.add(z),N0(),()=>{if(J&&Q.layersWithOutsidePointerEventsDisabled.size===1)H.body.style.pointerEvents=x0}},[z,H,J,Q]),C.useEffect(()=>{return()=>{if(!z)return;Q.layers.delete(z),Q.layersWithOutsidePointerEventsDisabled.delete(z),N0()}},[z,Q]),C.useEffect(()=>{let B=()=>R({});return document.addEventListener(q0,B),()=>document.removeEventListener(q0,B)},[]),X0.jsx(b.div,{...O,ref:w,style:{pointerEvents:M?D?"auto":"none":void 0,...$.style},onFocusCapture:n($.onFocusCapture,F.onFocusCapture),onBlurCapture:n($.onBlurCapture,F.onBlurCapture),onPointerDownCapture:n($.onPointerDownCapture,I.onPointerDownCapture)})});K1.displayName=z1;var j1="DismissableLayerBranch",U1=C.forwardRef(($,Z)=>{let J=C.useContext(S0),W=C.useRef(null),L=i(Z,W);return C.useEffect(()=>{let X=W.current;if(X)return J.branches.add(X),()=>{J.branches.delete(X)}},[J.branches]),X0.jsx(b.div,{...$,ref:L})});U1.displayName=j1;function E1($,Z=globalThis?.document){let J=y($),W=C.useRef(!1),L=C.useRef(()=>{});return C.useEffect(()=>{let X=(q)=>{if(q.target&&!W.current){let Q=function(){y0(B1,J,z,{discrete:!0})};var O=Q;let z={originalEvent:q};if(q.pointerType==="touch")Z.removeEventListener("click",L.current),L.current=Q,Z.addEventListener("click",L.current,{once:!0});else Q()}else Z.removeEventListener("click",L.current);W.current=!1},Y=window.setTimeout(()=>{Z.addEventListener("pointerdown",X)},0);return()=>{window.clearTimeout(Y),Z.removeEventListener("pointerdown",X),Z.removeEventListener("click",L.current)}},[Z,J]),{onPointerDownCapture:()=>W.current=!0}}function V1($,Z=globalThis?.document){let J=y($),W=C.useRef(!1);return C.useEffect(()=>{let L=(X)=>{if(X.target&&!W.current)y0(H1,J,{originalEvent:X},{discrete:!1})};return Z.addEventListener("focusin",L),()=>Z.removeEventListener("focusin",L)},[Z,J]),{onFocusCapture:()=>W.current=!0,onBlurCapture:()=>W.current=!1}}function N0(){let $=new CustomEvent(q0);document.dispatchEvent($)}function y0($,Z,J,{discrete:W}){let L=J.originalEvent.target,X=new CustomEvent($,{bubbles:!1,cancelable:!0,detail:J});if(Z)L.addEventListener($,Z,{once:!0});if(W)T0(L,X);else L.dispatchEvent(X)}var b0=A(N(),1),Y0=0;function Y4(){b0.useEffect(()=>{let $=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",$[0]??h0()),document.body.insertAdjacentElement("beforeend",$[1]??h0()),Y0++,()=>{if(Y0===1)document.querySelectorAll("[data-radix-focus-guard]").forEach((Z)=>Z.remove());Y0--}},[])}function h0(){let $=document.createElement("span");return $.setAttribute("data-radix-focus-guard",""),$.tabIndex=0,$.style.outline="none",$.style.opacity="0",$.style.position="fixed",$.style.pointerEvents="none",$}var T=A(N(),1);var m0=A(G0(),1),Q0="focusScope.autoFocusOnMount",z0="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},R1="FocusScope",C1=T.forwardRef(($,Z)=>{let{loop:J=!1,trapped:W=!1,onMountAutoFocus:L,onUnmountAutoFocus:X,...Y}=$,[q,O]=T.useState(null),Q=y(L),z=y(X),j=T.useRef(null),H=i(Z,(G)=>O(G)),R=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(W){let E=function(F){if(R.paused||!q)return;let B=F.target;if(q.contains(B))j.current=B;else h(j.current,{select:!0})},M=function(F){if(R.paused||!q)return;let B=F.relatedTarget;if(B===null)return;if(!q.contains(B))h(j.current,{select:!0})},D=function(F){if(document.activeElement!==document.body)return;for(let S of F)if(S.removedNodes.length>0)h(q)};var G=E,K=M,U=D;document.addEventListener("focusin",E),document.addEventListener("focusout",M);let I=new MutationObserver(D);if(q)I.observe(q,{childList:!0,subtree:!0});return()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",M),I.disconnect()}}},[W,q,R.paused]),T.useEffect(()=>{if(q){_0.add(R);let G=document.activeElement;if(!q.contains(G)){let U=new CustomEvent(Q0,f0);if(q.addEventListener(Q0,Q),q.dispatchEvent(U),!U.defaultPrevented){if(M1(A1(v0(q)),{select:!0}),document.activeElement===G)h(q)}}return()=>{q.removeEventListener(Q0,Q),setTimeout(()=>{let U=new CustomEvent(z0,f0);if(q.addEventListener(z0,z),q.dispatchEvent(U),!U.defaultPrevented)h(G??document.body,{select:!0});q.removeEventListener(z0,z),_0.remove(R)},0)}}},[q,Q,z,R]);let w=T.useCallback((G)=>{if(!J&&!W)return;if(R.paused)return;let K=G.key==="Tab"&&!G.altKey&&!G.ctrlKey&&!G.metaKey,U=document.activeElement;if(K&&U){let E=G.currentTarget,[M,D]=I1(E);if(!(M&&D)){if(U===E)G.preventDefault()}else if(!G.shiftKey&&U===D){if(G.preventDefault(),J)h(M,{select:!0})}else if(G.shiftKey&&U===M){if(G.preventDefault(),J)h(D,{select:!0})}}},[J,W,R.paused]);return m0.jsx(b.div,{tabIndex:-1,...Y,ref:H,onKeyDown:w})});C1.displayName=R1;function M1($,{select:Z=!1}={}){let J=document.activeElement;for(let W of $)if(h(W,{select:Z}),document.activeElement!==J)return}function I1($){let Z=v0($),J=k0(Z,$),W=k0(Z.reverse(),$);return[J,W]}function v0($){let Z=[],J=document.createTreeWalker($,NodeFilter.SHOW_ELEMENT,{acceptNode:(W)=>{let L=W.tagName==="INPUT"&&W.type==="hidden";if(W.disabled||W.hidden||L)return NodeFilter.FILTER_SKIP;return W.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});while(J.nextNode())Z.push(J.currentNode);return Z}function k0($,Z){for(let J of $)if(!D1(J,{upTo:Z}))return J}function D1($,{upTo:Z}){if(getComputedStyle($).visibility==="hidden")return!0;while($){if(Z!==void 0&&$===Z)return!1;if(getComputedStyle($).display==="none")return!0;$=$.parentElement}return!1}function O1($){return $ instanceof HTMLInputElement&&"select"in $}function h($,{select:Z=!1}={}){if($&&$.focus){let J=document.activeElement;if($.focus({preventScroll:!0}),$!==J&&O1($)&&Z)$.select()}}var _0=F1();function F1(){let $=[];return{add(Z){let J=$[0];if(Z!==J)J?.pause();$=g0($,Z),$.unshift(Z)},remove(Z){$=g0($,Z),$[0]?.resume()}}}function g0($,Z){let J=[...$],W=J.indexOf(Z);if(W!==-1)J.splice(W,1);return J}function A1($){return $.filter((Z)=>Z.tagName!=="A")}var a=A(N(),1),p0=A(P1(),1);var d0=A(G0(),1),w1="Portal",x1=a.forwardRef(($,Z)=>{let{container:J,...W}=$,[L,X]=a.useState(!1);u0(()=>X(!0),[]);let Y=J||L&&globalThis?.document?.body;return Y?p0.default.createPortal(d0.jsx(b.div,{...W,ref:Z}),Y):null});x1.displayName=w1;var N1=function($){if(typeof document>"u")return null;var Z=Array.isArray($)?$[0]:$;return Z.ownerDocument.body},m=new WeakMap,o=new WeakMap,t={},B0=0,c0=function($){return $&&($.host||c0($.parentNode))},T1=function($,Z){return Z.map(function(J){if($.contains(J))return J;var W=c0(J);if(W&&$.contains(W))return W;return console.error("aria-hidden",J,"in not contained inside",$,". Doing nothing"),null}).filter(function(J){return Boolean(J)})},S1=function($,Z,J,W){var L=T1(Z,Array.isArray($)?$:[$]);if(!t[J])t[J]=new WeakMap;var X=t[J],Y=[],q=new Set,O=new Set(L),Q=function(j){if(!j||q.has(j))return;q.add(j),Q(j.parentNode)};L.forEach(Q);var z=function(j){if(!j||O.has(j))return;Array.prototype.forEach.call(j.children,function(H){if(q.has(H))z(H);else try{var R=H.getAttribute(W),w=R!==null&&R!=="false",G=(m.get(H)||0)+1,K=(X.get(H)||0)+1;if(m.set(H,G),X.set(H,K),Y.push(H),G===1&&w)o.set(H,!0);if(K===1)H.setAttribute(J,"true");if(!w)H.setAttribute(W,"true")}catch(U){console.error("aria-hidden: cannot operate on ",H,U)}})};return z(Z),q.clear(),B0++,function(){if(Y.forEach(function(j){var H=m.get(j)-1,R=X.get(j)-1;if(m.set(j,H),X.set(j,R),!H){if(!o.has(j))j.removeAttribute(W);o.delete(j)}if(!R)j.removeAttribute(J)}),B0--,!B0)m=new WeakMap,m=new WeakMap,o=new WeakMap,t={}}},V4=function($,Z,J){if(J===void 0)J="data-aria-hidden";var W=Array.from(Array.isArray($)?$:[$]),L=Z||N1($);if(!L)return function(){return null};return W.push.apply(W,Array.from(L.querySelectorAll("[aria-live], script"))),S1(W,L,J,"aria-hidden")};var x=function(){return x=Object.assign||function(Z){for(var J,W=1,L=arguments.length;W<L;W++){J=arguments[W];for(var X in J)if(Object.prototype.hasOwnProperty.call(J,X))Z[X]=J[X]}return Z},x.apply(this,arguments)};function e($,Z){var J={};for(var W in $)if(Object.prototype.hasOwnProperty.call($,W)&&Z.indexOf(W)<0)J[W]=$[W];if($!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var L=0,W=Object.getOwnPropertySymbols($);L<W.length;L++)if(Z.indexOf(W[L])<0&&Object.prototype.propertyIsEnumerable.call($,W[L]))J[W[L]]=$[W[L]]}return J}function i0($,Z,J){if(J||arguments.length===2){for(var W=0,L=Z.length,X;W<L;W++)if(X||!(W in Z)){if(!X)X=Array.prototype.slice.call(Z,0,W);X[W]=Z[W]}}return $.concat(X||Array.prototype.slice.call(Z))}var L0=A(N(),1);var P=A(N(),1);var f="right-scroll-bar-position",k="width-before-scroll-bar",H0="with-scroll-bars-hidden",K0="--removed-body-scroll-bar-size";var Z0=A(N(),1);function $0($,Z){if(typeof $==="function")$(Z);else if($)$.current=Z;return $}var l0=A(N(),1);function s0($,Z){var J=l0.useState(function(){return{value:$,callback:Z,facade:{get current(){return J.value},set current(W){var L=J.value;if(L!==W)J.value=W,J.callback(W,L)}}}})[0];return J.callback=Z,J.facade}var y1=typeof window<"u"?Z0.useLayoutEffect:Z0.useEffect,r0=new WeakMap;function j0($,Z){var J=s0(Z||null,function(W){return $.forEach(function(L){return $0(L,W)})});return y1(function(){var W=r0.get(J);if(W){var L=new Set(W),X=new Set($),Y=J.current;L.forEach(function(q){if(!X.has(q))$0(q,null)}),X.forEach(function(q){if(!L.has(q))$0(q,Y)})}r0.set(J,$)},[$]),J}function h1($){return $}function b1($,Z){if(Z===void 0)Z=h1;var J=[],W=!1,L={read:function(){if(W)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");if(J.length)return J[J.length-1];return $},useMedium:function(X){var Y=Z(X,W);return J.push(Y),function(){J=J.filter(function(q){return q!==Y})}},assignSyncMedium:function(X){W=!0;while(J.length){var Y=J;J=[],Y.forEach(X)}J={push:function(q){return X(q)},filter:function(){return J}}},assignMedium:function(X){W=!0;var Y=[];if(J.length){var q=J;J=[],q.forEach(X),Y=J}var O=function(){var z=Y;Y=[],z.forEach(X)},Q=function(){return Promise.resolve().then(O)};Q(),J={push:function(z){Y.push(z),Q()},filter:function(z){return Y=Y.filter(z),J}}}};return L}function U0($){if($===void 0)$={};var Z=b1(null);return Z.options=x({async:!0,ssr:!1},$),Z}var n0=A(N(),1),a0=function($){var Z=$.sideCar,J=e($,["sideCar"]);if(!Z)throw Error("Sidecar: please provide `sideCar` property to import the right car");var W=Z.read();if(!W)throw Error("Sidecar medium not found");return n0.createElement(W,x({},J))};a0.isSideCarExport=!0;function E0($,Z){return $.useMedium(Z),a0}var J0=U0();var V0=function(){return},l=P.forwardRef(function($,Z){var J=P.useRef(null),W=P.useState({onScrollCapture:V0,onWheelCapture:V0,onTouchMoveCapture:V0}),L=W[0],X=W[1],Y=$.forwardProps,q=$.children,O=$.className,Q=$.removeScrollBar,z=$.enabled,j=$.shards,H=$.sideCar,R=$.noRelative,w=$.noIsolation,G=$.inert,K=$.allowPinchZoom,U=$.as,E=U===void 0?"div":U,M=$.gapMode,D=e($,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=H,F=j0([J,Z]),B=x(x({},D),L);return P.createElement(P.Fragment,null,z&&P.createElement(I,{sideCar:J0,removeScrollBar:Q,shards:j,noRelative:R,noIsolation:w,inert:G,setCallbacks:X,allowPinchZoom:!!K,lockRef:J,gapMode:M}),Y?P.cloneElement(P.Children.only(q),x(x({},B),{ref:F})):P.createElement(E,x({},B,{className:O,ref:F}),q))});l.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};l.classNames={fullWidth:k,zeroRight:f};var V=A(N(),1);var u=A(N(),1);var e0=A(N(),1);var o0;var t0=function(){if(o0)return o0;if(typeof __webpack_nonce__<"u")return __webpack_nonce__;return};function f1(){if(!document)return null;var $=document.createElement("style");$.type="text/css";var Z=t0();if(Z)$.setAttribute("nonce",Z);return $}function k1($,Z){if($.styleSheet)$.styleSheet.cssText=Z;else $.appendChild(document.createTextNode(Z))}function _1($){var Z=document.head||document.getElementsByTagName("head")[0];Z.appendChild($)}var R0=function(){var $=0,Z=null;return{add:function(J){if($==0){if(Z=f1())k1(Z,J),_1(Z)}$++},remove:function(){if($--,!$&&Z)Z.parentNode&&Z.parentNode.removeChild(Z),Z=null}}};var C0=function(){var $=R0();return function(Z,J){e0.useEffect(function(){return $.add(Z),function(){$.remove()}},[Z&&J])}};var s=function(){var $=C0(),Z=function(J){var{styles:W,dynamic:L}=J;return $(W,L),null};return Z};var g1={left:0,top:0,right:0,gap:0},M0=function($){return parseInt($||"",10)||0},m1=function($){var Z=window.getComputedStyle(document.body),J=Z[$==="padding"?"paddingLeft":"marginLeft"],W=Z[$==="padding"?"paddingTop":"marginTop"],L=Z[$==="padding"?"paddingRight":"marginRight"];return[M0(J),M0(W),M0(L)]},I0=function($){if($===void 0)$="margin";if(typeof window>"u")return g1;var Z=m1($),J=document.documentElement.clientWidth,W=window.innerWidth;return{left:Z[0],top:Z[1],right:Z[2],gap:Math.max(0,W-J+Z[2]-Z[0])}};var v1=s(),v="data-scroll-locked",u1=function($,Z,J,W){var{left:L,top:X,right:Y,gap:q}=$;if(J===void 0)J="margin";return`
2
- .`.concat(H0,` {
3
- overflow: hidden `).concat(W,`;
4
- padding-right: `).concat(q,"px ").concat(W,`;
5
- }
6
- body[`).concat(v,`] {
7
- overflow: hidden `).concat(W,`;
8
- overscroll-behavior: contain;
9
- `).concat([Z&&"position: relative ".concat(W,";"),J==="margin"&&`
10
- padding-left: `.concat(L,`px;
11
- padding-top: `).concat(X,`px;
12
- padding-right: `).concat(Y,`px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: `).concat(q,"px ").concat(W,`;
16
- `),J==="padding"&&"padding-right: ".concat(q,"px ").concat(W,";")].filter(Boolean).join(""),`
17
- }
18
-
19
- .`).concat(f,` {
20
- right: `).concat(q,"px ").concat(W,`;
21
- }
22
-
23
- .`).concat(k,` {
24
- margin-right: `).concat(q,"px ").concat(W,`;
25
- }
26
-
27
- .`).concat(f," .").concat(f,` {
28
- right: 0 `).concat(W,`;
29
- }
30
-
31
- .`).concat(k," .").concat(k,` {
32
- margin-right: 0 `).concat(W,`;
33
- }
34
-
35
- body[`).concat(v,`] {
36
- `).concat(K0,": ").concat(q,`px;
37
- }
38
- `)},$1=function(){var $=parseInt(document.body.getAttribute(v)||"0",10);return isFinite($)?$:0},p1=function(){u.useEffect(function(){return document.body.setAttribute(v,($1()+1).toString()),function(){var $=$1()-1;if($<=0)document.body.removeAttribute(v);else document.body.setAttribute(v,$.toString())}},[])},D0=function($){var{noRelative:Z,noImportant:J,gapMode:W}=$,L=W===void 0?"margin":W;p1();var X=u.useMemo(function(){return I0(L)},[L]);return u.createElement(v1,{styles:u1(X,!Z,L,!J?"!important":"")})};var O0=!1;if(typeof window<"u")try{p=Object.defineProperty({},"passive",{get:function(){return O0=!0,!0}}),window.addEventListener("test",p,p),window.removeEventListener("test",p,p)}catch($){O0=!1}var p,_=O0?{passive:!1}:!1;var d1=function($){return $.tagName==="TEXTAREA"},Z1=function($,Z){if(!($ instanceof Element))return!1;var J=window.getComputedStyle($);return J[Z]!=="hidden"&&!(J.overflowY===J.overflowX&&!d1($)&&J[Z]==="visible")},c1=function($){return Z1($,"overflowY")},i1=function($){return Z1($,"overflowX")},F0=function($,Z){var J=Z.ownerDocument,W=Z;do{if(typeof ShadowRoot<"u"&&W instanceof ShadowRoot)W=W.host;var L=J1($,W);if(L){var X=W1($,W),Y=X[1],q=X[2];if(Y>q)return!0}W=W.parentNode}while(W&&W!==J.body);return!1},l1=function($){var{scrollTop:Z,scrollHeight:J,clientHeight:W}=$;return[Z,J,W]},s1=function($){var{scrollLeft:Z,scrollWidth:J,clientWidth:W}=$;return[Z,J,W]},J1=function($,Z){return $==="v"?c1(Z):i1(Z)},W1=function($,Z){return $==="v"?l1(Z):s1(Z)},r1=function($,Z){return $==="h"&&Z==="rtl"?-1:1},L1=function($,Z,J,W,L){var X=r1($,window.getComputedStyle(Z).direction),Y=X*W,q=J.target,O=Z.contains(q),Q=!1,z=Y>0,j=0,H=0;do{if(!q)break;var R=W1($,q),w=R[0],G=R[1],K=R[2],U=G-K-X*w;if(w||U){if(J1($,q))j+=U,H+=w}var E=q.parentNode;q=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!O&&q!==document.body||O&&(Z.contains(q)||Z===q));if(z&&(L&&Math.abs(j)<1||!L&&Y>j))Q=!0;else if(!z&&(L&&Math.abs(H)<1||!L&&-Y>H))Q=!0;return Q};var W0=function($){return"changedTouches"in $?[$.changedTouches[0].clientX,$.changedTouches[0].clientY]:[0,0]},q1=function($){return[$.deltaX,$.deltaY]},G1=function($){return $&&"current"in $?$.current:$},n1=function($,Z){return $[0]===Z[0]&&$[1]===Z[1]},a1=function($){return`
39
- .block-interactivity-`.concat($,` {pointer-events: none;}
40
- .allow-interactivity-`).concat($,` {pointer-events: all;}
41
- `)},o1=0,d=[];function X1($){var Z=V.useRef([]),J=V.useRef([0,0]),W=V.useRef(),L=V.useState(o1++)[0],X=V.useState(s)[0],Y=V.useRef($);V.useEffect(function(){Y.current=$},[$]),V.useEffect(function(){if($.inert){document.body.classList.add("block-interactivity-".concat(L));var G=i0([$.lockRef.current],($.shards||[]).map(G1),!0).filter(Boolean);return G.forEach(function(K){return K.classList.add("allow-interactivity-".concat(L))}),function(){document.body.classList.remove("block-interactivity-".concat(L)),G.forEach(function(K){return K.classList.remove("allow-interactivity-".concat(L))})}}return},[$.inert,$.lockRef.current,$.shards]);var q=V.useCallback(function(G,K){if("touches"in G&&G.touches.length===2||G.type==="wheel"&&G.ctrlKey)return!Y.current.allowPinchZoom;var U=W0(G),E=J.current,M="deltaX"in G?G.deltaX:E[0]-U[0],D="deltaY"in G?G.deltaY:E[1]-U[1],I,F=G.target,B=Math.abs(M)>Math.abs(D)?"h":"v";if("touches"in G&&B==="h"&&F.type==="range")return!1;var S=window.getSelection(),g=S&&S.anchorNode,c=g?g===F||g.contains(F):!1;if(c)return!1;var r=F0(B,F);if(!r)return!0;if(r)I=B;else I=B==="v"?"h":"v",r=F0(B,F);if(!r)return!1;if(!W.current&&"changedTouches"in G&&(M||D))W.current=I;if(!I)return!0;var A0=W.current||I;return L1(A0,K,G,A0==="h"?M:D,!0)},[]),O=V.useCallback(function(G){var K=G;if(!d.length||d[d.length-1]!==X)return;var U="deltaY"in K?q1(K):W0(K),E=Z.current.filter(function(I){return I.name===K.type&&(I.target===K.target||K.target===I.shadowParent)&&n1(I.delta,U)})[0];if(E&&E.should){if(K.cancelable)K.preventDefault();return}if(!E){var M=(Y.current.shards||[]).map(G1).filter(Boolean).filter(function(I){return I.contains(K.target)}),D=M.length>0?q(K,M[0]):!Y.current.noIsolation;if(D){if(K.cancelable)K.preventDefault()}}},[]),Q=V.useCallback(function(G,K,U,E){var M={name:G,delta:K,target:U,should:E,shadowParent:t1(U)};Z.current.push(M),setTimeout(function(){Z.current=Z.current.filter(function(D){return D!==M})},1)},[]),z=V.useCallback(function(G){J.current=W0(G),W.current=void 0},[]),j=V.useCallback(function(G){Q(G.type,q1(G),G.target,q(G,$.lockRef.current))},[]),H=V.useCallback(function(G){Q(G.type,W0(G),G.target,q(G,$.lockRef.current))},[]);V.useEffect(function(){return d.push(X),$.setCallbacks({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:H}),document.addEventListener("wheel",O,_),document.addEventListener("touchmove",O,_),document.addEventListener("touchstart",z,_),function(){d=d.filter(function(G){return G!==X}),document.removeEventListener("wheel",O,_),document.removeEventListener("touchmove",O,_),document.removeEventListener("touchstart",z,_)}},[]);var{removeScrollBar:R,inert:w}=$;return V.createElement(V.Fragment,null,w?V.createElement(X,{styles:a1(L)}):null,R?V.createElement(D0,{noRelative:$.noRelative,gapMode:$.gapMode}):null)}function t1($){var Z=null;while($!==null){if($ instanceof ShadowRoot)Z=$.host,$=$.host;$=$.parentNode}return Z}var Y1=E0(J0,X1);var Q1=L0.forwardRef(function($,Z){return L0.createElement(l,x({},$,{ref:Z,sideCar:Y1}))});Q1.classNames=l.classNames;var e1=Q1;
42
- export{K1 as ea,Y4 as fa,C1 as ga,x1 as ha,V4 as ia,e1 as ja};
@@ -1,2 +0,0 @@
1
- import{la as H,na as R,pa as F,qa as _,sa as m,ta as I,ua as l,va as v}from"/chunk-08yrv2nn.js";import{Aa as C,Ea as t,Na as e,Sa as E}from"/chunk-p8qycd26.js";var z=C(t(),1);var D=C(e(),1),x="rovingFocusGroup.onEntryFocus",qq={bubbles:!1,cancelable:!0},j="RovingFocusGroup",[S,u,zq]=m(j),[Jq,Uq]=R(j,[zq]),[Qq,Wq]=Jq(j),d=z.forwardRef((q,W)=>{return D.jsx(S.Provider,{scope:q.__scopeRovingFocusGroup,children:D.jsx(S.Slot,{scope:q.__scopeRovingFocusGroup,children:D.jsx(Xq,{...q,ref:W})})})});d.displayName=j;var Xq=z.forwardRef((q,W)=>{let{__scopeRovingFocusGroup:Z,orientation:J,loop:k=!1,dir:G,currentTabStopId:h,defaultCurrentTabStopId:O,onCurrentTabStopIdChange:N,onEntryFocus:Y,preventScrollOnEntryFocus:$=!1,...w}=q,A=z.useRef(null),M=E(W,A),U=I(G),[P,Q]=F({prop:h,defaultProp:O??null,onChange:N,caller:j}),[V,g]=z.useState(!1),K=l(Y),B=u(Z),T=z.useRef(!1),[c,f]=z.useState(0);return z.useEffect(()=>{let X=A.current;if(X)return X.addEventListener(x,K),()=>X.removeEventListener(x,K)},[K]),D.jsx(Qq,{scope:Z,orientation:J,dir:U,loop:k,currentTabStopId:P,onItemFocus:z.useCallback((X)=>Q(X),[Q]),onItemShiftTab:z.useCallback(()=>g(!0),[]),onFocusableItemAdd:z.useCallback(()=>f((X)=>X+1),[]),onFocusableItemRemove:z.useCallback(()=>f((X)=>X-1),[]),children:D.jsx(_.div,{tabIndex:V||c===0?-1:0,"data-orientation":J,...w,ref:M,style:{outline:"none",...q.style},onMouseDown:H(q.onMouseDown,()=>{T.current=!0}),onFocus:H(q.onFocus,(X)=>{let s=!T.current;if(X.target===X.currentTarget&&s&&!V){let b=new CustomEvent(x,qq);if(X.currentTarget.dispatchEvent(b),!b.defaultPrevented){let y=B().filter((L)=>L.focusable),r=y.find((L)=>L.active),n=y.find((L)=>L.id===P),o=[r,n,...y].filter(Boolean).map((L)=>L.ref.current);i(o,$)}}T.current=!1}),onBlur:H(q.onBlur,()=>g(!1))})})}),p="RovingFocusGroupItem",a=z.forwardRef((q,W)=>{let{__scopeRovingFocusGroup:Z,focusable:J=!0,active:k=!1,tabStopId:G,children:h,...O}=q,N=v(),Y=G||N,$=Wq(p,Z),w=$.currentTabStopId===Y,A=u(Z),{onFocusableItemAdd:M,onFocusableItemRemove:U,currentTabStopId:P}=$;return z.useEffect(()=>{if(J)return M(),()=>U()},[J,M,U]),D.jsx(S.ItemSlot,{scope:Z,id:Y,focusable:J,active:k,children:D.jsx(_.span,{tabIndex:w?0:-1,"data-orientation":$.orientation,...O,ref:W,onMouseDown:H(q.onMouseDown,(Q)=>{if(!J)Q.preventDefault();else $.onItemFocus(Y)}),onFocus:H(q.onFocus,()=>$.onItemFocus(Y)),onKeyDown:H(q.onKeyDown,(Q)=>{if(Q.key==="Tab"&&Q.shiftKey){$.onItemShiftTab();return}if(Q.target!==Q.currentTarget)return;let V=Kq(Q,$.orientation,$.dir);if(V!==void 0){if(Q.metaKey||Q.ctrlKey||Q.altKey||Q.shiftKey)return;Q.preventDefault();let K=A().filter((B)=>B.focusable).map((B)=>B.ref.current);if(V==="last")K.reverse();else if(V==="prev"||V==="next"){if(V==="prev")K.reverse();let B=K.indexOf(Q.currentTarget);K=$.loop?Vq(K,B+1):K.slice(B+1)}setTimeout(()=>i(K))}}),children:typeof h==="function"?h({isCurrentTabStop:w,hasTabStop:P!=null}):h})})});a.displayName=p;var Zq={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $q(q,W){if(W!=="rtl")return q;return q==="ArrowLeft"?"ArrowRight":q==="ArrowRight"?"ArrowLeft":q}function Kq(q,W,Z){let J=$q(q.key,Z);if(W==="vertical"&&["ArrowLeft","ArrowRight"].includes(J))return;if(W==="horizontal"&&["ArrowUp","ArrowDown"].includes(J))return;return Zq[J]}function i(q,W=!1){let Z=document.activeElement;for(let J of q){if(J===Z)return;if(J.focus({preventScroll:W}),document.activeElement!==Z)return}}function Vq(q,W){return q.map((Z,J)=>q[(W+J)%q.length])}var Pq=d,kq=a;
2
- export{Uq as u,Pq as v,kq as w};
@@ -1 +0,0 @@
1
- import{p as Sq}from"/chunk-6zekv36x.js";import{q as Lq,r as Aq,s as c,t as b}from"/chunk-bs8nhy4h.js";import"/chunk-abx95kyf.js";import{L as Bq,M as Iq,N as Cq,O as U,P as m,Q as _}from"/chunk-gxhame5n.js";import{R as Rq}from"/chunk-9eadacms.js";import{$ as zq,S as i,T as l,U as r,V as t,W as e,X as qq,Y as Jq,Z as Kq,_ as kq,aa as Mq,ba as Xq,ca as Hq,da as Uq}from"/chunk-jenng4z6.js";import"/chunk-9g67pqq7.js";import{ka as _q}from"/chunk-4ny2qr6s.js";import"/chunk-08yrv2nn.js";import{xa as Oq}from"/chunk-dpy2bnvw.js";import{za as x}from"/chunk-0sevb013.js";import{Aa as A,Ab as o,Cb as a,Db as s,Ea as Vq,Gb as Qq,Qa as N,Wa as j,Xa as Y,ac as Wq,bb as E,bc as Yq,cc as Zq,dc as $q,ec as Gq,gb as D,jb as F,lb as n}from"/chunk-p8qycd26.js";var Z=A(Vq(),1);var q=A(N(),1),xq=new Set(["txt","json","yaml","yml","toml","csv","log","sh","bash","zsh","js","ts","jsx","tsx","py","rb","ex","exs","erl","rs","go","java","c","cpp","h","html","css","scss","xml","sql","env","gitignore","dockerfile","makefile"]),jq=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp"]);function Eq(K){let Q=K.toLowerCase(),W=Q.lastIndexOf(".");return W>0?Q.slice(W+1):Q}function yq(K){let Q=Eq(K);if(Q==="md")return"markdown";if(xq.has(Q))return"text";if(jq.has(Q))return"image";if(Q==="pdf")return"pdf";return"unsupported"}function T(K){if(K===0)return"—";if(K<1024)return`${K} B`;if(K<1048576)return`${(K/1024).toFixed(1)} KB`;return`${(K/1048576).toFixed(1)} MB`}function Dq({path:K,onNavigate:Q}){let W=K.split("/").filter(Boolean);return q.jsxDEV("div",{className:"flex items-center gap-1 text-sm",children:[q.jsxDEV(Y,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>Q("/"),children:"shared"},void 0,!1,void 0,this),W.map((O,k)=>{let z="/"+W.slice(0,k+1).join("/");return q.jsxDEV(Z.Fragment,{children:[q.jsxDEV("span",{className:"text-muted-foreground",children:"/"},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>Q(z),children:O},void 0,!1,void 0,this)]},z,!0,void 0,this)})]},void 0,!0,void 0,this)}function nq({file:K,projectName:Q,content:W,loading:O,error:k}){let z=yq(K.name),B=`/api/projects/${Q}/shared-drive/preview?path=${encodeURIComponent(K.path)}`;if(k)return q.jsxDEV("p",{className:"text-sm text-destructive p-4",children:k},void 0,!1,void 0,this);if(O)return q.jsxDEV("p",{className:"text-sm text-muted-foreground p-4",children:"Loading preview..."},void 0,!1,void 0,this);switch(z){case"markdown":return W!==null?q.jsxDEV(Lq,{defaultValue:"preview",children:[q.jsxDEV(Aq,{children:[q.jsxDEV(c,{value:"preview",children:"Preview"},void 0,!1,void 0,this),q.jsxDEV(c,{value:"source",children:"Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(b,{value:"preview",className:"overflow-auto",children:q.jsxDEV(Sq,{children:W},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(b,{value:"source",className:"overflow-auto",children:q.jsxDEV("pre",{className:"text-sm font-mono whitespace-pre-wrap bg-muted rounded p-4",children:W},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null;case"text":return W!==null?q.jsxDEV("pre",{className:"text-sm font-mono whitespace-pre-wrap bg-muted rounded p-4 overflow-auto",children:W},void 0,!1,void 0,this):null;case"image":return q.jsxDEV("img",{src:B,alt:K.name,loading:"lazy",className:"max-w-full max-h-[70vh] object-contain"},void 0,!1,void 0,this);case"pdf":return q.jsxDEV("iframe",{src:B,className:"w-full h-[70vh] rounded border",title:K.name},void 0,!1,void 0,this);case"unsupported":return q.jsxDEV("div",{className:"flex flex-col items-center justify-center py-12 gap-4 text-muted-foreground",children:[q.jsxDEV(F,{className:"h-12 w-12"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Preview is not available for this file type."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}function u(){let{projectId:K,projectName:Q}=Qq(),[W,O]=Z.useState("/"),{data:k,isLoading:z,isError:B,error:mq,refetch:Nq}=Wq(K,W),Pq=k?.files??[],Tq=Yq(K??""),cq=Zq(K??""),bq=$q(K??""),Fq=Gq(K??""),[uq,I]=Z.useState(!1),[C,v]=Z.useState(""),[M,y]=Z.useState(null),[g,P]=Z.useState(null),X=Z.useRef(null),[$,R]=Z.useState(null),[vq,w]=Z.useState(null),[gq,h]=Z.useState(!1),[wq,f]=Z.useState(null),S=Z.useRef(null),p=(J)=>{P(null),R(null),S.current=null,O(J)},fq=(J)=>{if($?.path===J.path){R(null),S.current=null;return}let G=yq(J.name);if(R(J),w(null),f(null),S.current=J.path,G==="markdown"||G==="text"){h(!0);let H=J.path;Fq.mutate(J.path,{onSuccess:(L)=>{if(S.current!==H)return;h(!1),w(L.content)},onError:(L)=>{if(S.current!==H)return;h(!1),f(L.message||"Failed to load preview")}})}else h(!1)},d=()=>{if(!C.trim())return;Tq.mutate({name:C.trim(),path:W}),v(""),I(!1)},pq=(J)=>{if(cq.mutate(J.path),y(null),$?.path===J.path)R(null)},aq=52428800,dq=(J)=>{let G=J.target.files?.[0];if(!G)return;if(G.size>52428800){if(P(`File is too large (${T(G.size)}). Maximum upload size is ${T(52428800)}.`),X.current)X.current.value="";return}P(null);let H=new FileReader;if(H.onload=()=>{let L=H.result.split(",")[1];bq.mutate({name:G.name,content:L,path:W})},H.readAsDataURL(G),X.current)X.current.value=""},V=[...Pq].sort((J,G)=>{if(J.type!==G.type)return J.type==="directory"?-1:1;return J.name.localeCompare(G.name)});if(!K)return q.jsxDEV(s,{},void 0,!1,void 0,this);return q.jsxDEV(Oq,{children:[q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[q.jsxDEV(Y,{variant:"ghost",size:"icon","aria-label":"Back",onClick:()=>x(`/projects/${Q}`),children:q.jsxDEV(E,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("h1",{className:"text-2xl font-bold",children:"Shared Drive"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center justify-between",children:[q.jsxDEV(Dq,{path:W,onNavigate:p},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("input",{ref:X,type:"file",className:"hidden",onChange:dq},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"outline",size:"sm",onClick:()=>X.current?.click(),children:"Upload File"},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"outline",size:"sm",onClick:()=>I(!0),children:"New Folder"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),g&&q.jsxDEV("p",{className:"text-sm text-destructive",children:g},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-4",children:[q.jsxDEV("div",{className:`rounded-md border ${$?"w-1/2":"w-full"} min-w-0`,children:q.jsxDEV(Bq,{children:[q.jsxDEV(Iq,{children:q.jsxDEV(U,{children:[q.jsxDEV(m,{children:"Name"},void 0,!1,void 0,this),q.jsxDEV(m,{className:"w-[100px]",children:"Size"},void 0,!1,void 0,this),!$&&q.jsxDEV(m,{className:"w-[100px] text-right",children:"Actions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(Cq,{children:z?q.jsxDEV(U,{children:q.jsxDEV(_,{colSpan:$?2:3,className:"text-center py-8",children:q.jsxDEV(a,{size:"sm",className:"text-muted-foreground mx-auto"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):B?q.jsxDEV(U,{children:q.jsxDEV(_,{colSpan:$?2:3,children:q.jsxDEV(Rq,{message:mq?.message||"Failed to load files",onRetry:()=>Nq()},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this):V.length===0?q.jsxDEV(U,{children:q.jsxDEV(_,{colSpan:$?2:3,className:"text-center text-muted-foreground py-8",children:"This directory is empty"},void 0,!1,void 0,this)},void 0,!1,void 0,this):V.map((J)=>q.jsxDEV(U,{className:$?.path===J.path?"bg-muted/50":void 0,children:[q.jsxDEV(_,{children:J.type==="directory"?q.jsxDEV(Y,{variant:"link",className:"flex items-center gap-2 text-foreground h-auto p-0",onClick:()=>p(J.path),children:[q.jsxDEV(n,{className:"h-4 w-4 text-muted-foreground"},void 0,!1,void 0,this),J.name]},void 0,!0,void 0,this):q.jsxDEV(Y,{variant:"link",className:"flex items-center gap-2 text-foreground h-auto p-0",onClick:()=>fq(J),children:[q.jsxDEV(F,{className:"h-4 w-4 text-muted-foreground"},void 0,!1,void 0,this),J.name]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(_,{className:"text-muted-foreground",children:J.type==="file"?T(J.size):"—"},void 0,!1,void 0,this),!$&&q.jsxDEV(_,{className:"text-right",children:q.jsxDEV("div",{className:"flex items-center justify-end gap-1",children:[J.type==="file"&&q.jsxDEV(Y,{variant:"ghost",size:"sm",asChild:!0,children:q.jsxDEV("a",{href:`/api/projects/${Q}/shared-drive/download?path=${encodeURIComponent(J.path)}`,download:!0,children:"Download"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>y(J),children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},J.path,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$&&q.jsxDEV("div",{className:"w-1/2 min-w-0 rounded-md border flex flex-col max-h-[calc(100vh-12rem)]",children:[q.jsxDEV("div",{className:"flex items-center justify-between border-b px-4 py-2",children:[q.jsxDEV("span",{className:"text-sm font-medium truncate",children:$.name},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-1",children:[q.jsxDEV(Y,{variant:"ghost",size:"sm",asChild:!0,children:q.jsxDEV("a",{href:`/api/projects/${Q}/shared-drive/download?path=${encodeURIComponent($.path)}`,download:!0,children:q.jsxDEV(D,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>y($),children:"Delete"},void 0,!1,void 0,this),q.jsxDEV(Y,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Close preview",onClick:()=>R(null),children:q.jsxDEV(o,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:q.jsxDEV(nq,{file:$,projectName:Q,content:vq,loading:gq,error:wq},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(kq,{open:uq,onOpenChange:I,children:q.jsxDEV(zq,{children:[q.jsxDEV(Mq,{children:[q.jsxDEV(Hq,{children:"New Folder"},void 0,!1,void 0,this),q.jsxDEV(Uq,{children:"Create a new folder in the shared drive."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"py-4",children:q.jsxDEV(_q,{placeholder:"Folder name",value:C,onChange:(J)=>v(J.target.value),onKeyDown:(J)=>{if(J.key==="Enter")d()},autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(Xq,{children:[q.jsxDEV(Y,{variant:"outline",onClick:()=>I(!1),children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV(Y,{onClick:d,disabled:!C.trim(),children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV(i,{open:!!M,onOpenChange:(J)=>!J&&y(null),children:q.jsxDEV(l,{children:[q.jsxDEV(r,{children:[q.jsxDEV(e,{children:["Delete ",M?.type==="directory"?"folder":"file","?"]},void 0,!0,void 0,this),q.jsxDEV(qq,{children:["This will permanently delete “",M?.name,"”",M?.type==="directory"&&" and all its contents",". This action cannot be undone."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV(t,{children:[q.jsxDEV(Kq,{children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV(Jq,{className:j({variant:"destructive"}),onClick:()=>M&&pq(M),children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var hq=A(N(),1);function oq(){return hq.jsxDEV(u,{},void 0,!1,void 0,this)}export{oq as default};
@@ -1 +0,0 @@
1
- import{d as x,h as E}from"/chunk-w24pb2qv.js";import{k as T,l as B,m as I,n as y,o as j}from"/chunk-0v5erpy0.js";import"/chunk-abx95kyf.js";import"/chunk-19284fra.js";import{I as M}from"/chunk-62c2ejc6.js";import{R as V}from"/chunk-9eadacms.js";import{$ as U,S as D,T as F,U as L,V as S,W as z,X as H,Y as O,Z as $,_ as J,aa as X,ba as Y,ca as W,da as Z}from"/chunk-jenng4z6.js";import"/chunk-9g67pqq7.js";import{ka as G}from"/chunk-4ny2qr6s.js";import"/chunk-08yrv2nn.js";import{xa as d}from"/chunk-dpy2bnvw.js";import{za as C}from"/chunk-0sevb013.js";import{Aa as s,Db as R,Ea as ce,Eb as q,Hb as K,Ib as Q,Jb as _,Oa as N,Qa as u,Wa as P,Xa as n,_a as k}from"/chunk-p8qycd26.js";var a=s(ce(),1);var e=s(u(),1);function de(m){switch(m){case"running":return"default";case"starting":return"secondary";case"error":return"destructive";default:return"secondary"}}var ue=/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;function h(){let m=N(),{data:p=[],isLoading:te,isError:oe,error:ae,refetch:re}=q(),ne=K(),g=Q(),ie=_();M("projects:lobby",()=>{m.invalidateQueries({queryKey:["projects"]})});let[le,i]=a.useState(!1),[r,v]=a.useState(""),[c,f]=a.useState(null),[w,b]=a.useState(null);a.useEffect(()=>{b(null)},[p]);let l=ue.test(r),A=()=>{if(!l)return;ne.mutate(r),v(""),i(!1)},se=()=>{if(!c)return;g.mutate(c.id),f(null)};if(te)return e.jsxDEV(d,{children:e.jsxDEV(R,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(oe)return e.jsxDEV(d,{children:e.jsxDEV(V,{message:ae?.message||"Failed to load projects",onRetry:()=>re()},void 0,!1,void 0,this)},void 0,!1,void 0,this);return e.jsxDEV(d,{children:[e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("h1",{className:"text-2xl font-bold",children:"Projects"},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:()=>i(!0),children:"+ New Project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.length===0?e.jsxDEV("div",{className:"text-center py-16 max-w-md mx-auto",children:[e.jsxDEV("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"},void 0,!1,void 0,this),e.jsxDEV("p",{className:"text-muted-foreground mb-6",children:"Each project gets its own isolated VM with a team of AI agents that can collaborate on tasks together."},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:()=>i(!0),children:"Create Your First Project"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):e.jsxDEV("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map((t)=>e.jsxDEV(x,{role:"button",tabIndex:0,className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>C(`/projects/${t.name}`),onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),C(`/projects/${t.name}`)},children:e.jsxDEV(E,{className:"pt-6",children:e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("h3",{className:"font-semibold text-lg",children:t.name},void 0,!1,void 0,this),e.jsxDEV("div",{className:"flex items-center gap-2",children:[e.jsxDEV(j,{variant:de(t.status),children:t.status},void 0,!1,void 0,this),e.jsxDEV(T,{children:[e.jsxDEV(B,{asChild:!0,children:e.jsxDEV(n,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":`${t.name} actions`,onClick:(o)=>o.stopPropagation(),children:e.jsxDEV(k,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(I,{align:"end",children:[t.status==="error"&&e.jsxDEV(y,{disabled:w===t.id,onClick:()=>{b(t.id),ie.mutate(t.id)},children:w===t.id?"Restarting...":"Restart"},void 0,!1,void 0,this),e.jsxDEV(y,{className:"text-destructive focus:text-destructive",onClick:(o)=>{o.stopPropagation(),f(t)},children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},t.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(J,{open:le,onOpenChange:i,children:e.jsxDEV(U,{children:[e.jsxDEV(X,{children:[e.jsxDEV(W,{children:"New Project"},void 0,!1,void 0,this),e.jsxDEV(Z,{children:"Create a new project with its own isolated VM."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-4 space-y-2",children:[e.jsxDEV(G,{placeholder:"my-project",value:r,onChange:(t)=>v(t.target.value.toLowerCase()),onKeyDown:(t)=>{if(t.key==="Enter")A()},autoFocus:!0,"aria-describedby":r&&!l?"project-name-error":void 0,"aria-invalid":r!==""&&!l},void 0,!1,void 0,this),r&&!l&&e.jsxDEV("p",{id:"project-name-error",className:"text-sm text-destructive",children:"Use lowercase letters, numbers, and hyphens only. Must start and end with a letter or number."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(Y,{children:[e.jsxDEV(n,{variant:"outline",onClick:()=>i(!1),children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(n,{onClick:A,disabled:!l,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(D,{open:!!c,onOpenChange:(t)=>!t&&f(null),children:e.jsxDEV(F,{children:[e.jsxDEV(L,{children:[e.jsxDEV(z,{children:"Delete Project"},void 0,!1,void 0,this),e.jsxDEV(H,{children:["Are you sure you want to delete “",c?.name,"”? This will destroy the VM and all its data. This action cannot be undone."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(S,{children:[e.jsxDEV($,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(O,{className:P({variant:"destructive"}),onClick:se,disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ee=s(u(),1);function me(){return ee.jsxDEV(h,{},void 0,!1,void 0,this)}export{me as default};
@@ -1,2 +0,0 @@
1
- import{u as O,v as l,w as M}from"/chunk-abx95kyf.js";import{la as Z,na as V,pa as C,qa as Y,ta as F,va as G,wa as j}from"/chunk-08yrv2nn.js";import{Aa as X,Ea as B,Na as c,Qa as x,Va as k}from"/chunk-p8qycd26.js";var L=X(B(),1);var z=X(B(),1);var q=X(c(),1),$="Tabs",[d,qi]=V($,[O]),v=O(),[r,b]=d($),E=z.forwardRef((i,m)=>{let{__scopeTabs:f,value:y,onValueChange:g,defaultValue:R,orientation:h="horizontal",dir:J,activationMode:Q="automatic",...U}=i,W=F(J),[P,K]=C({prop:y,onChange:g,defaultProp:R??"",caller:$});return q.jsx(r,{scope:f,baseId:G(),value:P,onValueChange:K,orientation:h,dir:W,activationMode:Q,children:q.jsx(Y.div,{dir:W,"data-orientation":h,...U,ref:m})})});E.displayName=$;var I="TabsList",a=z.forwardRef((i,m)=>{let{__scopeTabs:f,loop:y=!0,...g}=i,R=b(I,f),h=v(f);return q.jsx(l,{asChild:!0,...h,orientation:R.orientation,dir:R.dir,loop:y,children:q.jsx(Y.div,{role:"tablist","aria-orientation":R.orientation,...g,ref:m})})});a.displayName=I;var A="TabsTrigger",T=z.forwardRef((i,m)=>{let{__scopeTabs:f,value:y,disabled:g=!1,...R}=i,h=b(A,f),J=v(f),Q=u(h.baseId,y),U=n(h.baseId,y),W=y===h.value;return q.jsx(M,{asChild:!0,...J,focusable:!g,active:W,children:q.jsx(Y.button,{type:"button",role:"tab","aria-selected":W,"aria-controls":U,"data-state":W?"active":"inactive","data-disabled":g?"":void 0,disabled:g,id:Q,...R,ref:m,onMouseDown:Z(i.onMouseDown,(P)=>{if(!g&&P.button===0&&P.ctrlKey===!1)h.onValueChange(y);else P.preventDefault()}),onKeyDown:Z(i.onKeyDown,(P)=>{if([" ","Enter"].includes(P.key))h.onValueChange(y)}),onFocus:Z(i.onFocus,()=>{let P=h.activationMode!=="manual";if(!W&&!g&&P)h.onValueChange(y)})})})});T.displayName=A;var S="TabsContent",t=z.forwardRef((i,m)=>{let{__scopeTabs:f,value:y,forceMount:g,children:R,...h}=i,J=b(S,f),Q=u(J.baseId,y),U=n(J.baseId,y),W=y===J.value,P=z.useRef(W);return z.useEffect(()=>{let K=requestAnimationFrame(()=>P.current=!1);return()=>cancelAnimationFrame(K)},[]),q.jsx(j,{present:g||W,children:({present:K})=>q.jsx(Y.div,{"data-state":W?"active":"inactive","data-orientation":J.orientation,role:"tabpanel","aria-labelledby":Q,hidden:!K,id:U,tabIndex:0,...h,ref:m,style:{...i.style,animationDuration:P.current?"0s":void 0},children:K&&R})})});t.displayName=S;function u(i,m){return`${i}-trigger-${m}`}function n(i,m){return`${i}-content-${m}`}var _=E,H=a,D=T,N=t;var w=X(x(),1),Ji=_,s=L.forwardRef(({className:i,...m},f)=>w.jsxDEV(H,{ref:f,className:k("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",i),...m},void 0,!1,void 0,this));s.displayName=H.displayName;var o=L.forwardRef(({className:i,...m},f)=>w.jsxDEV(D,{ref:f,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",i),...m},void 0,!1,void 0,this));o.displayName=D.displayName;var e=L.forwardRef(({className:i,...m},f)=>w.jsxDEV(N,{ref:f,className:k("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",i),...m},void 0,!1,void 0,this));e.displayName=N.displayName;
2
- export{Ji as q,s as r,o as s,e as t};
@@ -1,2 +0,0 @@
1
- import{Aa as a,Qa as m}from"/chunk-p8qycd26.js";var e=a(m(),1);function t({children:r}){return e.jsxDEV("main",{className:"pt-[max(2rem,env(safe-area-inset-top))] pb-[max(2rem,env(safe-area-inset-bottom))] pl-[max(1rem,env(safe-area-inset-left))] pr-[max(1rem,env(safe-area-inset-right))] sm:pl-[max(1.5rem,env(safe-area-inset-left))] sm:pr-[max(1.5rem,env(safe-area-inset-right))] lg:pl-[max(2rem,env(safe-area-inset-left))] lg:pr-[max(2rem,env(safe-area-inset-right))]",children:e.jsxDEV("div",{className:"mx-auto max-w-5xl",children:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
- export{t as xa};
@@ -1,2 +0,0 @@
1
- import{Aa as b,Ea as c,Qa as T,Va as o}from"/chunk-p8qycd26.js";var r=b(c(),1);var l=b(T(),1),m=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("div",{className:"relative w-full overflow-auto",children:l.jsxDEV("table",{ref:a,className:o("w-full caption-bottom text-sm",e),...t},void 0,!1,void 0,this)},void 0,!1,void 0,this));m.displayName="Table";var d=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("thead",{ref:a,className:o("[&_tr]:border-b",e),...t},void 0,!1,void 0,this));d.displayName="TableHeader";var n=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tbody",{ref:a,className:o("[&_tr:last-child]:border-0",e),...t},void 0,!1,void 0,this));n.displayName="TableBody";var s=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tfoot",{ref:a,className:o("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t},void 0,!1,void 0,this));s.displayName="TableFooter";var i=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("tr",{ref:a,className:o("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t},void 0,!1,void 0,this));i.displayName="TableRow";var f=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("th",{ref:a,className:o("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t},void 0,!1,void 0,this));f.displayName="TableHead";var R=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("td",{ref:a,className:o("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t},void 0,!1,void 0,this));R.displayName="TableCell";var H=r.forwardRef(({className:e,...t},a)=>l.jsxDEV("caption",{ref:a,className:o("mt-4 text-sm text-muted-foreground",e),...t},void 0,!1,void 0,this));H.displayName="TableCaption";
2
- export{m as L,d as M,n as N,i as O,f as P,R as Q};
@@ -1 +0,0 @@
1
- import{c as Y}from"/chunk-2kh30qex.js";import{d as w,h as y}from"/chunk-w24pb2qv.js";import{i as b,j as D}from"/chunk-r19vjw47.js";import{k as _,l as $,m as U,n as q,o as d}from"/chunk-0v5erpy0.js";import"/chunk-abx95kyf.js";import"/chunk-080ent60.js";import"/chunk-19284fra.js";import"/chunk-vp3by99k.js";import"/chunk-sxzad3y5.js";import{S as p,T as u,U as A,V as f,W as v,X as N,Y as C,Z as h}from"/chunk-jenng4z6.js";import"/chunk-9g67pqq7.js";import"/chunk-4ny2qr6s.js";import"/chunk-08yrv2nn.js";import{xa as Z}from"/chunk-dpy2bnvw.js";import{za as T}from"/chunk-0sevb013.js";import{Aa as l,Cb as I,Db as z,Ea as re,Gb as G,Ha as k,Lb as J,Mb as K,Ob as Q,Pb as W,Qa as m,Qb as X,Wa as O,Xa as o,_a as F,bb as L,sb as H}from"/chunk-p8qycd26.js";var s=l(re(),1);var e=l(m(),1),le=(i)=>i==="active"||i==="starting"||i==="bootstrapping";function P(){let{agentName:i}=k(),{projectId:a,projectName:j}=G(),{data:E=[]}=J(a),r=E.find((B)=>B.name===i)?.id,{data:M}=K(a,r),n=X(a??""),g=W(a??""),V=Q(a??""),[ee,c]=s.useState(!1),[te,R]=s.useState(!1),[ae,S]=s.useState(!1);if(!a||!r||!M)return e.jsxDEV(z,{},void 0,!1,void 0,this);let t=M,ne=(B,oe)=>{let{id:me,...ie}=oe;V.mutate({id:t.id,...ie}),c(!1)};return e.jsxDEV(Z,{children:[e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV("div",{className:"flex items-center justify-between",children:[e.jsxDEV("div",{className:"flex items-center gap-3",children:[e.jsxDEV(o,{variant:"ghost",size:"icon","aria-label":"Back",onClick:()=>T(`/projects/${j}/agents/${t.name}`),children:e.jsxDEV(L,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV("h1",{className:"text-2xl font-bold",children:t.name},void 0,!1,void 0,this),e.jsxDEV(d,{variant:b(t.status),children:t.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"flex items-center gap-2",children:[e.jsxDEV(o,{variant:"outline",onClick:()=>c(!0),children:[e.jsxDEV(H,{className:"h-4 w-4 mr-1"},void 0,!1,void 0,this),"Edit"]},void 0,!0,void 0,this),le(t.status)?e.jsxDEV(o,{variant:"outline",onClick:()=>S(!0),children:"Restart Agent"},void 0,!1,void 0,this):e.jsxDEV(o,{onClick:()=>n.mutate(r),disabled:n.isPending,children:[n.isPending&&e.jsxDEV(I,{size:"sm",className:"mr-1"},void 0,!1,void 0,this),"Start Agent"]},void 0,!0,void 0,this),e.jsxDEV(_,{children:[e.jsxDEV($,{asChild:!0,children:e.jsxDEV(o,{variant:"ghost",size:"icon","aria-label":"More actions",children:e.jsxDEV(F,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(U,{align:"end",children:e.jsxDEV(q,{className:"text-destructive focus:text-destructive",onClick:()=>R(!0),children:"Delete Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"space-y-6",children:[e.jsxDEV(w,{children:e.jsxDEV(y,{className:"pt-6",children:e.jsxDEV("dl",{className:"divide-y divide-border",children:[e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Name"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.description&&e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Description"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Model"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:t.model||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.harness&&e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Harness"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:e.jsxDEV(d,{variant:"outline",children:D(t.harness)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV("div",{className:"py-3 grid grid-cols-3 gap-4",children:[e.jsxDEV("dt",{className:"text-sm font-medium text-muted-foreground",children:"Status"},void 0,!1,void 0,this),e.jsxDEV("dd",{className:"text-sm col-span-2",children:e.jsxDEV(d,{variant:b(t.status),children:t.status},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(w,{children:e.jsxDEV(y,{className:"pt-6",children:[e.jsxDEV("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"System Prompt"},void 0,!1,void 0,this),e.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed",children:t.systemPrompt||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(Y,{open:ee,title:"Edit Agent",agent:t,onSave:ne,onClose:()=>c(!1)},void 0,!1,void 0,this),e.jsxDEV(p,{open:ae,onOpenChange:S,children:e.jsxDEV(u,{children:[e.jsxDEV(A,{children:[e.jsxDEV(v,{children:"Restart Agent"},void 0,!1,void 0,this),e.jsxDEV(N,{children:"This will stop the current runner and restart the agent. The VM will be preserved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(f,{children:[e.jsxDEV(h,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(C,{onClick:()=>n.mutate(r),disabled:n.isPending,children:n.isPending?"Restarting...":"Restart"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e.jsxDEV(p,{open:te,onOpenChange:R,children:e.jsxDEV(u,{children:[e.jsxDEV(A,{children:[e.jsxDEV(v,{children:"Delete Agent"},void 0,!1,void 0,this),e.jsxDEV(N,{children:"This will stop the agent and permanently remove its workspace directory. This cannot be undone."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.jsxDEV(f,{children:[e.jsxDEV(h,{children:"Cancel"},void 0,!1,void 0,this),e.jsxDEV(C,{className:O({variant:"destructive"}),onClick:()=>g.mutate(r),disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var x=l(m(),1);function de(){return x.jsxDEV(P,{},void 0,!1,void 0,this)}export{de as default};
@@ -1,12 +0,0 @@
1
- import{ea as Zm,fa as $m,ga as Um,ha as bm,ia as Bm,ja as Ym}from"/chunk-9g67pqq7.js";import{la as L,ma as Km,na as _,pa as Qm,qa as M,va as N,wa as x}from"/chunk-08yrv2nn.js";import{Aa as Y,Ab as pm,Ea as u,Na as A,Qa as n,Ra as qm,Sa as V,Va as $,Wa as Xm}from"/chunk-p8qycd26.js";var P=Y(u(),1);var i=Y(u(),1);var J=Y(u(),1);var Z=Y(u(),1);var g=Y(A(),1);function Jm(m){let y=om(m),z=Z.forwardRef((H,k)=>{let{children:X,...K}=H,Q=Z.Children.toArray(X),B=Q.find(my);if(B){let U=B.props.children,R=Q.map((h)=>{if(h===B){if(Z.Children.count(U)>1)return Z.Children.only(null);return Z.isValidElement(U)?U.props.children:null}else return h});return g.jsx(y,{...K,ref:k,children:Z.isValidElement(U)?Z.cloneElement(U,void 0,R):null})}return g.jsx(y,{...K,ref:k,children:X})});return z.displayName=`${m}.Slot`,z}function om(m){let y=Z.forwardRef((z,H)=>{let{children:k,...X}=z;if(Z.isValidElement(k)){let K=zy(k),Q=yy(X,k.props);if(k.type!==Z.Fragment)Q.ref=H?qm(H,K):K;return Z.cloneElement(k,Q)}return Z.Children.count(k)>1?Z.Children.only(null):null});return y.displayName=`${m}.SlotClone`,y}var em=Symbol("radix.slottable");function my(m){return Z.isValidElement(m)&&typeof m.type==="function"&&"__radixId"in m.type&&m.type.__radixId===em}function yy(m,y){let z={...y};for(let H in y){let k=m[H],X=y[H];if(/^on[A-Z]/.test(H)){if(k&&X)z[H]=(...Q)=>{let B=X(...Q);return k(...Q),B};else if(k)z[H]=k}else if(H==="style")z[H]={...k,...X};else if(H==="className")z[H]=[k,X].filter(Boolean).join(" ")}return{...m,...z}}function zy(m){let y=Object.getOwnPropertyDescriptor(m.props,"ref")?.get,z=y&&"isReactWarning"in y&&y.isReactWarning;if(z)return m.ref;if(y=Object.getOwnPropertyDescriptor(m,"ref")?.get,z=y&&"isReactWarning"in y&&y.isReactWarning,z)return m.props.ref;return m.props.ref||m.ref}var q=Y(A(),1),E="Dialog",[im,s]=_(E),[Hy,F]=im(E),vm=(m)=>{let{__scopeDialog:y,children:z,open:H,defaultOpen:k,onOpenChange:X,modal:K=!0}=m,Q=J.useRef(null),B=J.useRef(null),[U,R]=Qm({prop:H,defaultProp:k??!1,onChange:X,caller:E});return q.jsx(Hy,{scope:y,triggerRef:Q,contentRef:B,contentId:N(),titleId:N(),descriptionId:N(),open:U,onOpenChange:R,onOpenToggle:J.useCallback(()=>R((h)=>!h),[R]),modal:K,children:z})};vm.displayName=E;var Fm="DialogTrigger",Wm=J.forwardRef((m,y)=>{let{__scopeDialog:z,...H}=m,k=F(Fm,z),X=V(y,k.triggerRef);return q.jsx(M.button,{type:"button","aria-haspopup":"dialog","aria-expanded":k.open,"aria-controls":k.contentId,"data-state":r(k.open),...H,ref:X,onClick:L(m.onClick,k.onOpenToggle)})});Wm.displayName=Fm;var l="DialogPortal",[ky,Gm]=im(l,{forceMount:void 0}),Lm=(m)=>{let{__scopeDialog:y,forceMount:z,children:H,container:k}=m,X=F(l,y);return q.jsx(ky,{scope:y,forceMount:z,children:J.Children.map(H,(K)=>q.jsx(x,{present:z||X.open,children:q.jsx(bm,{asChild:!0,container:k,children:K})}))})};Lm.displayName=l;var S="DialogOverlay",fm=J.forwardRef((m,y)=>{let z=Gm(S,m.__scopeDialog),{forceMount:H=z.forceMount,...k}=m,X=F(S,m.__scopeDialog);return X.modal?q.jsx(x,{present:H||X.open,children:q.jsx(qy,{...k,ref:y})}):null});fm.displayName=S;var Xy=Jm("DialogOverlay.RemoveScroll"),qy=J.forwardRef((m,y)=>{let{__scopeDialog:z,...H}=m,k=F(S,z);return q.jsx(Ym,{as:Xy,allowPinchZoom:!0,shards:[k.contentRef],children:q.jsx(M.div,{"data-state":r(k.open),...H,ref:y,style:{pointerEvents:"auto",...H.style}})})}),f="DialogContent",Vm=J.forwardRef((m,y)=>{let z=Gm(f,m.__scopeDialog),{forceMount:H=z.forceMount,...k}=m,X=F(f,m.__scopeDialog);return q.jsx(x,{present:H||X.open,children:X.modal?q.jsx(Jy,{...k,ref:y}):q.jsx(Ky,{...k,ref:y})})});Vm.displayName=f;var Jy=J.forwardRef((m,y)=>{let z=F(f,m.__scopeDialog),H=J.useRef(null),k=V(y,z.contentRef,H);return J.useEffect(()=>{let X=H.current;if(X)return Bm(X)},[]),q.jsx(Pm,{...m,ref:k,trapFocus:z.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:L(m.onCloseAutoFocus,(X)=>{X.preventDefault(),z.triggerRef.current?.focus()}),onPointerDownOutside:L(m.onPointerDownOutside,(X)=>{let K=X.detail.originalEvent,Q=K.button===0&&K.ctrlKey===!0;if(K.button===2||Q)X.preventDefault()}),onFocusOutside:L(m.onFocusOutside,(X)=>X.preventDefault())})}),Ky=J.forwardRef((m,y)=>{let z=F(f,m.__scopeDialog),H=J.useRef(!1),k=J.useRef(!1);return q.jsx(Pm,{...m,ref:y,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(X)=>{if(m.onCloseAutoFocus?.(X),!X.defaultPrevented){if(!H.current)z.triggerRef.current?.focus();X.preventDefault()}H.current=!1,k.current=!1},onInteractOutside:(X)=>{if(m.onInteractOutside?.(X),!X.defaultPrevented){if(H.current=!0,X.detail.originalEvent.type==="pointerdown")k.current=!0}let K=X.target;if(z.triggerRef.current?.contains(K))X.preventDefault();if(X.detail.originalEvent.type==="focusin"&&k.current)X.preventDefault()}})}),Pm=J.forwardRef((m,y)=>{let{__scopeDialog:z,trapFocus:H,onOpenAutoFocus:k,onCloseAutoFocus:X,...K}=m,Q=F(f,z),B=J.useRef(null),U=V(y,B);return $m(),q.jsxs(q.Fragment,{children:[q.jsx(Um,{asChild:!0,loop:!0,trapped:H,onMountAutoFocus:k,onUnmountAutoFocus:X,children:q.jsx(Zm,{role:"dialog",id:Q.contentId,"aria-describedby":Q.descriptionId,"aria-labelledby":Q.titleId,"data-state":r(Q.open),...K,ref:U,onDismiss:()=>Q.onOpenChange(!1)})}),q.jsxs(q.Fragment,{children:[q.jsx(Qy,{titleId:Q.titleId}),q.jsx($y,{contentRef:B,descriptionId:Q.descriptionId})]})]})}),p="DialogTitle",um=J.forwardRef((m,y)=>{let{__scopeDialog:z,...H}=m,k=F(p,z);return q.jsx(M.h2,{id:k.titleId,...H,ref:y})});um.displayName=p;var Mm="DialogDescription",Om=J.forwardRef((m,y)=>{let{__scopeDialog:z,...H}=m,k=F(Mm,z);return q.jsx(M.p,{id:k.descriptionId,...H,ref:y})});Om.displayName=Mm;var Rm="DialogClose",Dm=J.forwardRef((m,y)=>{let{__scopeDialog:z,...H}=m,k=F(Rm,z);return q.jsx(M.button,{type:"button",...H,ref:y,onClick:L(m.onClick,()=>k.onOpenChange(!1))})});Dm.displayName=Rm;function r(m){return m?"open":"closed"}var Im="DialogTitleWarning",[am,Tm]=Km(Im,{contentName:f,titleName:p,docsSlug:"dialog"}),Qy=({titleId:m})=>{let y=Tm(Im),z=`\`${y.contentName}\` requires a \`${y.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${y.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${y.docsSlug}`;return J.useEffect(()=>{if(m){if(!document.getElementById(m))console.error(z)}},[z,m]),null},Zy="DialogDescriptionWarning",$y=({contentRef:m,descriptionId:y})=>{let H=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Tm(Zy).contentName}}.`;return J.useEffect(()=>{let k=m.current?.getAttribute("aria-describedby");if(y&&k){if(!document.getElementById(y))console.warn(H)}},[H,m,y]),null},c=vm,o=Wm,t=Lm,D=fm,I=Vm,a=um,T=Om,w=Dm;var C=Y(u(),1);var d=Y(A(),1);var Uy=Symbol("radix.slottable");function Cm(m){let y=({children:z})=>{return d.jsx(d.Fragment,{children:z})};return y.displayName=`${m}.Slottable`,y.__radixId=Uy,y}var b=Y(A(),1),jm="AlertDialog",[by,q0]=_(jm,[s]),G=s(),hm=(m)=>{let{__scopeAlertDialog:y,...z}=m,H=G(y);return b.jsx(c,{...H,...z,modal:!0})};hm.displayName=jm;var By="AlertDialogTrigger",Yy=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,k=G(z);return b.jsx(o,{...k,...H,ref:y})});Yy.displayName=By;var iy="AlertDialogPortal",gm=(m)=>{let{__scopeAlertDialog:y,...z}=m,H=G(y);return b.jsx(t,{...H,...z})};gm.displayName=iy;var vy="AlertDialogOverlay",Am=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,k=G(z);return b.jsx(D,{...k,...H,ref:y})});Am.displayName=vy;var O="AlertDialogContent",[Fy,Wy]=by(O),Gy=Cm("AlertDialogContent"),Nm=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,children:H,...k}=m,X=G(z),K=i.useRef(null),Q=V(y,K),B=i.useRef(null);return b.jsx(am,{contentName:O,titleName:Sm,docsSlug:"alert-dialog",children:b.jsx(Fy,{scope:z,cancelRef:B,children:b.jsxs(I,{role:"alertdialog",...X,...k,ref:Q,onOpenAutoFocus:L(k.onOpenAutoFocus,(U)=>{U.preventDefault(),B.current?.focus({preventScroll:!0})}),onPointerDownOutside:(U)=>U.preventDefault(),onInteractOutside:(U)=>U.preventDefault(),children:[b.jsx(Gy,{children:H}),b.jsx(fy,{contentRef:K})]})})})});Nm.displayName=O;var Sm="AlertDialogTitle",_m=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,k=G(z);return b.jsx(a,{...k,...H,ref:y})});_m.displayName=Sm;var xm="AlertDialogDescription",Em=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,k=G(z);return b.jsx(T,{...k,...H,ref:y})});Em.displayName=xm;var Ly="AlertDialogAction",cm=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,k=G(z);return b.jsx(w,{...k,...H,ref:y})});cm.displayName=Ly;var tm="AlertDialogCancel",dm=i.forwardRef((m,y)=>{let{__scopeAlertDialog:z,...H}=m,{cancelRef:k}=Wy(tm,z),X=G(z),K=V(y,k);return b.jsx(w,{...X,...H,ref:K})});dm.displayName=tm;var fy=({contentRef:m})=>{let y=`\`${O}\` requires a description for the component to be accessible for screen reader users.
6
-
7
- You can add a description to the \`${O}\` by passing a \`${xm}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
8
-
9
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${O}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
10
-
11
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{if(!document.getElementById(m.current?.getAttribute("aria-describedby")))console.warn(y)},[y,m]),null},nm=hm;var sm=gm,e=Am,mm=Nm,ym=cm,zm=dm,Hm=_m,km=Em;var W=Y(n(),1),Z0=nm;var Py=sm,lm=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(e,{className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",m),...y,ref:z},void 0,!1,void 0,this));lm.displayName=e.displayName;var uy=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(Py,{children:[W.jsxDEV(lm,{},void 0,!1,void 0,this),W.jsxDEV(mm,{ref:z,className:$("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background 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 sm:rounded-lg",m),...y},void 0,!1,void 0,this)]},void 0,!0,void 0,this));uy.displayName=mm.displayName;var My=({className:m,...y})=>W.jsxDEV("div",{className:$("flex flex-col space-y-2 text-center sm:text-left",m),...y},void 0,!1,void 0,this);My.displayName="AlertDialogHeader";var Oy=({className:m,...y})=>W.jsxDEV("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",m),...y},void 0,!1,void 0,this);Oy.displayName="AlertDialogFooter";var Ry=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(Hm,{ref:z,className:$("text-lg font-semibold",m),...y},void 0,!1,void 0,this));Ry.displayName=Hm.displayName;var Dy=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(km,{ref:z,className:$("text-sm text-muted-foreground",m),...y},void 0,!1,void 0,this));Dy.displayName=km.displayName;var Iy=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(ym,{ref:z,className:$(Xm(),m),...y},void 0,!1,void 0,this));Iy.displayName=ym.displayName;var ay=P.forwardRef(({className:m,...y},z)=>W.jsxDEV(zm,{ref:z,className:$(Xm({variant:"outline"}),"mt-2 sm:mt-0",m),...y},void 0,!1,void 0,this));ay.displayName=zm.displayName;var j=Y(u(),1);var v=Y(n(),1),B0=c;var Ty=t;var rm=j.forwardRef(({className:m,...y},z)=>v.jsxDEV(D,{ref:z,className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",m),...y},void 0,!1,void 0,this));rm.displayName=D.displayName;var wy=j.forwardRef(({className:m,children:y,...z},H)=>v.jsxDEV(Ty,{children:[v.jsxDEV(rm,{},void 0,!1,void 0,this),v.jsxDEV(I,{ref:H,className:$("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background 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 sm:rounded-lg",m),...z,children:[y,v.jsxDEV(w,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsxDEV(pm,{className:"h-4 w-4"},void 0,!1,void 0,this),v.jsxDEV("span",{className:"sr-only",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this));wy.displayName=I.displayName;var Cy=({className:m,...y})=>v.jsxDEV("div",{className:$("flex flex-col space-y-1.5 text-center sm:text-left",m),...y},void 0,!1,void 0,this);Cy.displayName="DialogHeader";var jy=({className:m,...y})=>v.jsxDEV("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",m),...y},void 0,!1,void 0,this);jy.displayName="DialogFooter";var hy=j.forwardRef(({className:m,...y},z)=>v.jsxDEV(a,{ref:z,className:$("text-lg font-semibold leading-none tracking-tight",m),...y},void 0,!1,void 0,this));hy.displayName=a.displayName;var gy=j.forwardRef(({className:m,...y},z)=>v.jsxDEV(T,{ref:z,className:$("text-sm text-muted-foreground",m),...y},void 0,!1,void 0,this));gy.displayName=T.displayName;
12
- export{Z0 as S,uy as T,My as U,Oy as V,Ry as W,Dy as X,Iy as Y,ay as Z,B0 as _,wy as $,Cy as aa,jy as ba,hy as ca,gy as da};
@@ -1 +0,0 @@
1
- import{A as V,B,x as f,y as p,z as c}from"/chunk-080ent60.js";import"/chunk-19284fra.js";import{H as Bz}from"/chunk-vp3by99k.js";import{I as r}from"/chunk-62c2ejc6.js";import{K as N}from"/chunk-sxzad3y5.js";import{L as Iz,M as Tz,N as Sz,O as m,P as M,Q as H}from"/chunk-gxhame5n.js";import{R as Fz}from"/chunk-9eadacms.js";import{$ as Hz,S as Jz,T as Kz,U as Wz,V as Xz,W as $z,X as Qz,Y as qz,Z as Zz,_ as Mz,aa as vz,ba as yz,ca as Az,da as Cz}from"/chunk-jenng4z6.js";import"/chunk-9g67pqq7.js";import{ka as O}from"/chunk-4ny2qr6s.js";import"/chunk-08yrv2nn.js";import{xa as Lz}from"/chunk-dpy2bnvw.js";import{za as d}from"/chunk-0sevb013.js";import{Aa as L,Cb as zz,Db as Gz,Ea as Ez,Gb as Yz,Lb as Nz,Oa as D,Qa as I,Wa as l,Xa as P,bb as a,fc as Pz,gc as Rz,hc as Uz,ic as _z,jc as wz,kc as Oz,sb as o,tb as s,ub as t,yb as e}from"/chunk-p8qycd26.js";var C=L(Ez(),1);var z=L(I(),1),g={label:"",agentId:"",message:"",scheduleType:"recurring",frequency:"daily",minute:"0",hour:"9",daysOfWeek:[],dayOfMonth:"1",intervalMinutes:"30",date:"",time:"09:00"},x=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],hz=new Date().getTimezoneOffset()/-60;function Dz(W){return((W-hz)%24+24)%24}function bz(W){return((W+hz)%24+24)%24}function dz(W,K){return new Date(`${W}T${K}:00`).toISOString()}function j(W){let K=new Date(W),X=K.getFullYear(),$=String(K.getMonth()+1).padStart(2,"0"),Q=String(K.getDate()).padStart(2,"0"),q=String(K.getHours()).padStart(2,"0"),R=String(K.getMinutes()).padStart(2,"0");return{date:`${X}-${$}-${Q}`,time:`${q}:${R}`}}function k(W){let K=parseInt(W.minute||"0"),X=parseInt(W.hour||"9"),$=Dz(X),Q=String(K),q=String($);switch(W.frequency){case"every_n_minutes":return`*/${W.intervalMinutes||"30"} * * * *`;case"hourly":return`${Q} * * * *`;case"daily":return`${Q} ${q} * * *`;case"weekly":{if(W.daysOfWeek.length===0)return`${Q} ${q} * * *`;let R=W.daysOfWeek.sort((_,w)=>_-w).map((_)=>x[_-1]?.toUpperCase().slice(0,3)).join(",");return`${Q} ${q} * * ${R}`}case"monthly":return`${Q} ${q} ${W.dayOfMonth||"1"} * *`;default:return`${Q} ${q} * * *`}}function E(W){let K=W.split(" ");if(K.length!==5)return W;let[X,$,Q,,q]=K;if(X?.startsWith("*/"))return`Every ${X.slice(2)} minutes`;if($==="*"&&Q==="*")return`Hourly at :${X?.padStart(2,"0")}`;let R=parseInt($||"0"),_=bz(R),w=lz(_,parseInt(X||"0"));if(q&&q!=="*")return`${q.split(",").map((U)=>U.slice(0,3)).map((U)=>U.charAt(0)+U.slice(1).toLowerCase()).join(", ")} at ${w}`;if(Q&&Q!=="*")return`Monthly on day ${Q} at ${w}`;return`Daily at ${w}`}function lz(W,K){let X=W>=12?"PM":"AM";return`${W%12||12}:${K.toString().padStart(2,"0")} ${X}`}function rz(W){let K=Date.now(),X=new Date(W).getTime(),$=Math.floor((K-X)/1000);if($<60)return"just now";if($<3600)return`${Math.floor($/60)}m ago`;if($<86400)return`${Math.floor($/3600)}h ago`;return`${Math.floor($/86400)}d ago`}function az(W){let K=W.split(" ");if(K.length!==5)return{};let[X,$,Q,,q]=K;if(X?.startsWith("*/"))return{frequency:"every_n_minutes",intervalMinutes:X.slice(2)};if($==="*")return{frequency:"hourly",minute:X||"0"};let R=String(bz(parseInt($||"9")));if(q&&q!=="*"){let _=q.split(",").map((w)=>{return x.findIndex((U)=>U.toUpperCase().slice(0,3)===w.toUpperCase().slice(0,3))+1});return{frequency:"weekly",hour:R,minute:X||"0",daysOfWeek:_}}if(Q&&Q!=="*")return{frequency:"monthly",hour:R,minute:X||"0",dayOfMonth:Q};return{frequency:"daily",hour:R,minute:X||"0"}}function i(){let W=D(),{projectId:K,projectName:X}=Yz(),{data:$=[],isLoading:Q,isError:q,error:R,refetch:_}=Pz(K),{data:w=[]}=Nz(K),v=Rz(K??""),U=Uz(K??""),T=_z(K??""),kz=wz(K??""),fz=Oz(K??"");r(K?`project:${K}:schedules`:null,()=>{W.invalidateQueries({queryKey:["schedules",K]})});let pz=w,n=$,[cz,y]=C.useState(!1),[A,u]=C.useState(null),[S,h]=C.useState(null),[J,F]=C.useState(g),Vz=()=>{u(null),F(g),y(!0)},mz=(G)=>{u(G.id);let Z=G.cronExpression?az(G.cronExpression):{};F({...g,label:G.label,agentId:G.agentId,message:G.message,scheduleType:G.scheduleType,...Z,date:G.scheduledAt?j(G.scheduledAt).date:"",time:G.scheduledAt?j(G.scheduledAt).time:"09:00"}),y(!0)},xz=()=>{let G={label:J.label,agentId:J.agentId,message:J.message,scheduleType:J.scheduleType},Z=J.scheduleType==="recurring"?{...G,cronExpression:k(J)}:{...G,scheduledAt:dz(J.date,J.time)};if(A)U.mutate({id:A,...Z});else v.mutate(Z);y(!1)},iz=()=>{if(S)T.mutate(S),h(null)},nz=(G)=>{kz.mutate({id:G.id,enabled:!G.enabled})},uz=(G)=>{fz.mutate(G.id)};if(!K)return z.jsxDEV(Gz,{},void 0,!1,void 0,this);let Y=(G,Z)=>{F((b)=>({...b,[G]:Z}))},jz=(G)=>{F((Z)=>({...Z,daysOfWeek:Z.daysOfWeek.includes(G)?Z.daysOfWeek.filter((b)=>b!==G):[...Z.daysOfWeek,G]}))};return z.jsxDEV(Lz,{children:[z.jsxDEV("div",{className:"space-y-6",children:[z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV(P,{variant:"ghost",size:"icon","aria-label":"Back",onClick:()=>d(`/projects/${X}`),children:z.jsxDEV(a,{className:"h-5 w-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("h1",{className:"text-2xl font-bold flex-1",children:"Scheduled Tasks"},void 0,!1,void 0,this),z.jsxDEV(P,{onClick:Vz,children:[z.jsxDEV(t,{className:"h-4 w-4 mr-1"},void 0,!1,void 0,this),"New Schedule"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q?z.jsxDEV("div",{className:"flex items-center justify-center py-12",children:z.jsxDEV(zz,{size:"lg",className:"text-muted-foreground"},void 0,!1,void 0,this)},void 0,!1,void 0,this):q?z.jsxDEV(Fz,{message:R?.message||"Failed to load schedules",onRetry:()=>_()},void 0,!1,void 0,this):n.length===0?z.jsxDEV("div",{className:"text-center py-12 text-muted-foreground",children:[z.jsxDEV("p",{children:"No scheduled tasks yet."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm mt-1",children:"Create a schedule to automatically send messages to agents."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"overflow-x-auto rounded-md border tabular-nums",children:z.jsxDEV(Iz,{children:[z.jsxDEV(Tz,{children:z.jsxDEV(m,{children:[z.jsxDEV(M,{children:"Label"},void 0,!1,void 0,this),z.jsxDEV(M,{children:"Agent"},void 0,!1,void 0,this),z.jsxDEV(M,{children:"Schedule"},void 0,!1,void 0,this),z.jsxDEV(M,{children:"Last Run"},void 0,!1,void 0,this),z.jsxDEV(M,{children:"Enabled"},void 0,!1,void 0,this),z.jsxDEV(M,{className:"text-right",children:"Actions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(Sz,{children:n.map((G)=>z.jsxDEV(m,{className:!G.enabled?"opacity-50":"",children:[z.jsxDEV(H,{className:"font-medium",children:G.label},void 0,!1,void 0,this),z.jsxDEV(H,{children:G.agentName},void 0,!1,void 0,this),z.jsxDEV(H,{className:"text-sm text-muted-foreground",children:G.scheduleType==="recurring"&&G.cronExpression?E(G.cronExpression):G.scheduledAt?new Date(G.scheduledAt).toLocaleString():"—"},void 0,!1,void 0,this),z.jsxDEV(H,{className:"text-sm text-muted-foreground",children:G.lastRunAt?rz(G.lastRunAt):"Never"},void 0,!1,void 0,this),z.jsxDEV(H,{children:z.jsxDEV(P,{variant:G.enabled?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>nz(G),children:G.enabled?"On":"Off"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(H,{className:"text-right",children:z.jsxDEV("div",{className:"flex items-center justify-end gap-1",children:[z.jsxDEV(P,{variant:"ghost",size:"sm",onClick:()=>uz(G),"aria-label":"Run now",children:z.jsxDEV(s,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(P,{variant:"ghost",size:"sm",onClick:()=>mz(G),"aria-label":"Edit",children:z.jsxDEV(o,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(P,{variant:"ghost",size:"sm",onClick:()=>h(G.id),"aria-label":"Delete",className:"text-destructive hover:text-destructive",children:z.jsxDEV(e,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},G.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(Mz,{open:cz,onOpenChange:y,children:z.jsxDEV(Hz,{className:"sm:max-w-lg",children:[z.jsxDEV(vz,{children:[z.jsxDEV(Az,{children:A?"Edit Schedule":"New Schedule"},void 0,!1,void 0,this),z.jsxDEV(Cz,{children:A?"Modify the schedule settings below.":"Configure a scheduled message to be sent to an agent automatically."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-4 py-2",children:[z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{htmlFor:"label",children:"Label"},void 0,!1,void 0,this),z.jsxDEV(O,{id:"label",value:J.label,onChange:(G)=>Y("label",G.target.value),placeholder:"Daily standup reminder"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{htmlFor:"agent",children:"Agent"},void 0,!1,void 0,this),z.jsxDEV(f,{value:J.agentId,onValueChange:(G)=>Y("agentId",G),children:[z.jsxDEV(c,{children:z.jsxDEV(p,{placeholder:"Select an agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(V,{children:pz.map((G)=>z.jsxDEV(B,{value:G.id,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{htmlFor:"message",children:"Message"},void 0,!1,void 0,this),z.jsxDEV(Bz,{id:"message",value:J.message,onChange:(G)=>Y("message",G.target.value),placeholder:"Give me a standup summary",rows:3},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Type"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1",children:[z.jsxDEV(P,{type:"button",variant:J.scheduleType==="recurring"?"default":"outline",size:"sm",onClick:()=>Y("scheduleType","recurring"),children:"Recurring"},void 0,!1,void 0,this),z.jsxDEV(P,{type:"button",variant:J.scheduleType==="once"?"default":"outline",size:"sm",onClick:()=>Y("scheduleType","once"),children:"Once"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.scheduleType==="recurring"&&z.jsxDEV("div",{className:"space-y-4 rounded-md border p-4",children:[z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Frequency"},void 0,!1,void 0,this),z.jsxDEV(f,{value:J.frequency,onValueChange:(G)=>Y("frequency",G),children:[z.jsxDEV(c,{children:z.jsxDEV(p,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(V,{children:[z.jsxDEV(B,{value:"every_n_minutes",children:"Every N minutes"},void 0,!1,void 0,this),z.jsxDEV(B,{value:"hourly",children:"Hourly"},void 0,!1,void 0,this),z.jsxDEV(B,{value:"daily",children:"Daily"},void 0,!1,void 0,this),z.jsxDEV(B,{value:"weekly",children:"Weekly"},void 0,!1,void 0,this),z.jsxDEV(B,{value:"monthly",children:"Monthly"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.frequency==="every_n_minutes"&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Every"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV(O,{type:"number",min:"1",max:"59",value:J.intervalMinutes,onChange:(G)=>Y("intervalMinutes",G.target.value),className:"w-20"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-sm text-muted-foreground",children:"minutes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.frequency==="hourly"&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"At minute"},void 0,!1,void 0,this),z.jsxDEV(O,{type:"number",min:"0",max:"59",value:J.minute,onChange:(G)=>Y("minute",G.target.value),className:"w-20"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(J.frequency==="daily"||J.frequency==="weekly"||J.frequency==="monthly")&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"At time"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV(O,{type:"number",min:"0",max:"23",value:J.hour,onChange:(G)=>Y("hour",G.target.value),className:"w-16",placeholder:"Hour"},void 0,!1,void 0,this),z.jsxDEV("span",{children:":"},void 0,!1,void 0,this),z.jsxDEV(O,{type:"number",min:"0",max:"59",value:J.minute,onChange:(G)=>Y("minute",G.target.value),className:"w-16",placeholder:"Min"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.frequency==="weekly"&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"On days"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1",children:x.map((G,Z)=>z.jsxDEV(P,{type:"button",variant:J.daysOfWeek.includes(Z+1)?"default":"outline",size:"sm",className:"h-10 w-11 text-xs",onClick:()=>jz(Z+1),children:G},G,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.frequency==="monthly"&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Day of month"},void 0,!1,void 0,this),z.jsxDEV(O,{type:"number",min:"1",max:"28",value:J.dayOfMonth,onChange:(G)=>Y("dayOfMonth",G.target.value),className:"w-20"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"text-xs text-muted-foreground",children:["Preview: ",k(J)," → ",E(k(J))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J.scheduleType==="once"&&z.jsxDEV("div",{className:"space-y-4 rounded-md border p-4",children:[z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Date"},void 0,!1,void 0,this),z.jsxDEV(O,{type:"date",value:J.date,onChange:(G)=>Y("date",G.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV(N,{children:"Time"},void 0,!1,void 0,this),z.jsxDEV(O,{type:"time",value:J.time,onChange:(G)=>Y("time",G.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(yz,{children:[z.jsxDEV(P,{variant:"outline",onClick:()=>y(!1),children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV(P,{onClick:xz,disabled:!J.label||!J.agentId||!J.message||v.isPending||U.isPending,children:v.isPending||U.isPending?"Saving...":A?"Save Changes":"Create Schedule"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(Jz,{open:!!S,onOpenChange:(G)=>{if(!G)h(null)},children:z.jsxDEV(Kz,{children:[z.jsxDEV(Wz,{children:[z.jsxDEV($z,{children:"Delete Schedule"},void 0,!1,void 0,this),z.jsxDEV(Qz,{children:"Are you sure you want to delete this schedule? This action cannot be undone."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(Xz,{children:[z.jsxDEV(Zz,{children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV(qz,{className:l({variant:"destructive"}),onClick:iz,disabled:T.isPending,children:T.isPending?"Deleting...":"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gz=L(I(),1);function oz(){return gz.jsxDEV(i,{},void 0,!1,void 0,this)}export{oz as default};