vibora 4.7.0 → 4.7.2
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.
|
@@ -43,7 +43,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
43
43
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eae(e){return VNe(e)||GNe(e)||qie(e)||qNe()}function eh(e){var t=null;return function(){if(!t){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];var s=e.apply(this,i);t={result:s}}return t.result}}var KNe=eh(function(){return navigator.userAgent.includes("Firefox")}),d0=eh(function(){var t=navigator,n=t.userAgent;return n.includes("AppleWebKit")&&!n.includes("Chrome")}),wD={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};function YNe(e){var t=e.dragLeave;return d0()?t.hasOwnProperty(wD.isLeavingWindow):!1}(function(){if(typeof window>"u"||!d0())return;function t(){return{enterCount:0,isOverWindow:!1}}var n=t();function r(){n=t()}Yp.bindAll(window,[{type:"dragstart",listener:function(){n.enterCount=0,n.isOverWindow=!0}},{type:"drop",listener:r},{type:"dragend",listener:r},{type:"dragenter",listener:function(a){!n.isOverWindow&&n.enterCount===0&&(a[wD.isEnteringWindow]=!0),n.isOverWindow=!0,n.enterCount++}},{type:"dragleave",listener:function(a){n.enterCount--,n.isOverWindow&&n.enterCount===0&&(a[wD.isLeavingWindow]=!0,n.isOverWindow=!1)}}],{capture:!0})})();function XNe(e){return"nodeName"in e}function ZNe(e){return XNe(e)&&e.ownerDocument!==document}function QNe(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n!=="dragleave"?!1:d0()?YNe({dragLeave:t}):r==null?!0:KNe()?ZNe(r):r instanceof HTMLIFrameElement}function JNe(e){var t=e.onDragEnd;return[{type:"pointermove",listener:(function(){var n=0;return function(){if(n<20){n++;return}t()}})()},{type:"pointerdown",listener:t}]}function Zb(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var eIe=function(t){var n=[],r=null,i=function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];n=o,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return i.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},i},Mk=eIe(function(e){return e()}),R_=(function(){var e=null;function t(r){var i=requestAnimationFrame(function(){e=null,r()});e={frameId:i,fn:r}}function n(){e&&(cancelAnimationFrame(e.frameId),e.fn(),e=null)}return{schedule:t,flush:n}})();function tIe(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(o){r(o),i={dropTargets:o.payload.location.current.dropTargets}}var s={start:function(l){var u=l.nativeSetDragImage,f={current:n,previous:i,initial:n};a({eventName:"onGenerateDragPreview",payload:{source:t,location:f,nativeSetDragImage:u}}),R_.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:f}})})},dragUpdate:function(l){var u=l.current;R_.flush(),Mk.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:n,previous:i,current:u}}})},drag:function(l){var u=l.current;Mk(function(){R_.flush();var f={initial:n,previous:i,current:u};a({eventName:"onDrag",payload:{source:t,location:f}})})},drop:function(l){var u=l.current,f=l.updatedSourcePayload;R_.flush(),Mk.cancel(),a({eventName:"onDrop",payload:{source:f??t,location:{current:u,previous:i,initial:n}}})}};return s}var TD={isActive:!1};function tae(){return!TD.isActive}function nIe(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function rIe(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function iIe(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!tae())return;var a=aIe({event:t,dragType:n,getDropTargetsOver:r});TD.isActive=!0;var s={current:a};jk({event:t,current:a.dropTargets});var o=tIe({source:n.payload,dispatchEvent:i,initial:a});function l(m){var E=rIe({current:s.current.dropTargets,next:m.dropTargets});s.current=m,E&&o.dragUpdate({current:s.current})}function u(m){var E=Zb(m),S=Zie(m.target)?Qie({x:E.clientX,y:E.clientY}):m.target,g=r({target:S,input:E,source:n.payload,current:s.current.dropTargets});g.length&&(m.preventDefault(),jk({event:m,current:g})),l({dropTargets:g,input:E})}function f(){s.current.dropTargets.length&&l({dropTargets:[],input:s.current.input}),o.drop({current:s.current,updatedSourcePayload:null}),d()}function d(){TD.isActive=!1,p()}var p=Yp.bindAll(window,[{type:"dragover",listener:function(E){u(E),o.drag({current:s.current})}},{type:"dragenter",listener:u},{type:"dragleave",listener:function(E){QNe({dragLeave:E})&&(l({input:s.current.input,dropTargets:[]}),n.startedFrom==="external"&&f())}},{type:"drop",listener:function(E){if(s.current={dropTargets:s.current.dropTargets,input:Zb(E)},!s.current.dropTargets.length){f();return}E.preventDefault(),jk({event:E,current:s.current.dropTargets}),o.drop({current:s.current,updatedSourcePayload:n.type==="external"?n.getDropPayload(E):null}),d()}},{type:"dragend",listener:function(E){s.current={dropTargets:s.current.dropTargets,input:Zb(E)},f()}}].concat(eae(JNe({onDragEnd:f}))),{capture:!0});o.start({nativeSetDragImage:nIe(t)})}function jk(e){var t,n=e.event,r=e.current,i=(t=r[0])===null||t===void 0?void 0:t.dropEffect;i!=null&&n.dataTransfer&&(n.dataTransfer.dropEffect=i)}function aIe(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=Zb(t);if(n.startedFrom==="external")return{input:i,dropTargets:[]};var a=r({input:i,source:n.payload,target:t.target,current:[]});return{input:i,dropTargets:a}}var NH={canStart:tae,start:iIe},CD=new Map;function sIe(e){var t=e.typeKey,n=e.mount,r=CD.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return CD.set(t,i),i}function oIe(e){var t=sIe(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),CD.delete(e.typeKey))}}function f0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(i){return i()})}}function nae(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function IH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IH(Object(n),!0).forEach(function(r){c0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Fk(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=lIe(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
44
44
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw a}}}}function lIe(e,t){if(e){if(typeof e=="string")return DH(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?DH(e,t):void 0}}function DH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bk(e){return e.slice(0).reverse()}function uIe(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i="data-drop-target-for-".concat(t),a="[".concat(i,"]");function s(m){return r.set(m.element,m),function(){return r.delete(m.element)}}function o(m){var E=f0(nae(m.element,{attribute:i,value:"true"}),s(m));return eh(E)}function l(m){var E,S,g,y,v=m.source,x=m.target,T=m.input,w=m.result,C=w===void 0?[]:w;if(x==null)return C;if(!(x instanceof Element))return x instanceof Node?l({source:v,target:x.parentElement,input:T,result:C}):C;var R=x.closest(a);if(R==null)return C;var O=r.get(R);if(O==null)return C;var N={input:T,source:v,element:O.element};if(O.canDrop&&!O.canDrop(N))return l({source:v,target:O.element.parentElement,input:T,result:C});var D=(E=(S=O.getData)===null||S===void 0?void 0:S.call(O,N))!==null&&E!==void 0?E:{},L=(g=(y=O.getDropEffect)===null||y===void 0?void 0:y.call(O,N))!==null&&g!==void 0?g:n,z={data:D,element:O.element,dropEffect:L,isActiveDueToStickiness:!1};return l({source:v,target:O.element.parentElement,input:T,result:[].concat(eae(C),[z])})}function u(m){var E=m.eventName,S=m.payload,g=Fk(S.location.current.dropTargets),y;try{for(g.s();!(y=g.n()).done;){var v,x=y.value,T=r.get(x.element),w=dc(dc({},S),{},{self:x});T==null||(v=T[E])===null||v===void 0||v.call(T,w)}}catch(C){g.e(C)}finally{g.f()}}var f={onGenerateDragPreview:u,onDrag:u,onDragStart:u,onDrop:u,onDropTargetChange:function(E){var S=E.payload,g=new Set(S.location.current.dropTargets.map(function(q){return q.element})),y=new Set,v=Fk(S.location.previous.dropTargets),x;try{for(v.s();!(x=v.n()).done;){var T,w=x.value;y.add(w.element);var C=r.get(w.element),R=g.has(w.element),O=dc(dc({},S),{},{self:w});if(C==null||(T=C.onDropTargetChange)===null||T===void 0||T.call(C,O),!R){var N;C==null||(N=C.onDragLeave)===null||N===void 0||N.call(C,O)}}}catch(q){v.e(q)}finally{v.f()}var D=Fk(S.location.current.dropTargets),L;try{for(D.s();!(L=D.n()).done;){var z,M,V=L.value;if(!y.has(V.element)){var H=dc(dc({},S),{},{self:V}),B=r.get(V.element);B==null||(z=B.onDropTargetChange)===null||z===void 0||z.call(B,H),B==null||(M=B.onDragEnter)===null||M===void 0||M.call(B,H)}}}catch(q){D.e(q)}finally{D.f()}}};function d(m){f[m.eventName](m)}function p(m){var E=m.source,S=m.target,g=m.input,y=m.current,v=l({source:E,target:S,input:g});if(v.length>=y.length)return v;for(var x=Bk(y),T=Bk(v),w=[],C=0;C<x.length;C++){var R,O=x[C],N=T[C];if(N!=null){w.push(N);continue}var D=w[C-1],L=x[C-1];if(D?.element!==L?.element)break;var z=r.get(O.element);if(!z)break;var M={input:g,source:E,element:z.element};if(z.canDrop&&!z.canDrop(M)||!((R=z.getIsSticky)!==null&&R!==void 0&&R.call(z,M)))break;w.push(dc(dc({},O),{},{isActiveDueToStickiness:!0}))}return Bk(w)}return{dropTargetForConsumers:o,getIsOver:p,dispatchEvent:d}}function cIe(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=dIe(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
45
45
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw a}}}}function dIe(e,t){if(e){if(typeof e=="string")return LH(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LH(e,t):void 0}}function LH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function PH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fIe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PH(Object(n),!0).forEach(function(r){c0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hIe(){var e=new Set,t=null;function n(a){t&&(!a.canMonitor||a.canMonitor(t.canMonitorArgs))&&t.active.add(a)}function r(a){var s=fIe({},a);e.add(s),n(s);function o(){e.delete(s),t&&t.active.delete(s)}return eh(o)}function i(a){var s=a.eventName,o=a.payload;if(s==="onGenerateDragPreview"){t={canMonitorArgs:{initial:o.location.initial,source:o.source},active:new Set};var l=cIe(e),u;try{for(l.s();!(u=l.n()).done;){var f=u.value;n(f)}}catch(g){l.e(g)}finally{l.f()}}if(t){for(var d=Array.from(t.active),p=0,m=d;p<m.length;p++){var E=m[p];if(t.active.has(E)){var S;(S=E[s])===null||S===void 0||S.call(E,o)}}s==="onDrop"&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function pIe(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,s=hIe(),o=uIe({typeKey:t,defaultDropEffect:a});function l(d){r?.(d),o.dispatchEvent(d),s.dispatchEvent(d),i?.(d)}function u(d){var p=d.event,m=d.dragType;NH.start({event:p,dragType:m,getDropTargetsOver:o.getIsOver,dispatchEvent:l})}function f(){function d(){var p={canStart:NH.canStart,start:u};return n(p)}return oIe({typeKey:t,mount:d})}return{registerUsage:f,dropTarget:o.dropTargetForConsumers,monitor:s.monitorForConsumers}}var rae=eh(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),mIe="pdnd:android-fallback",MH="text/plain",gIe="text/uri-list",bIe="application/vnd.pdnd",lS=new WeakMap;function vIe(e){return lS.set(e.element,e),function(){lS.delete(e.element)}}var jH=WNe(),u3=pIe({typeKey:"element",defaultDropEffect:"move",mount:function(t){return f0(jH.bindEvents(),Yp.bind(document,{type:"dragstart",listener:function(r){var i,a,s,o,l,u;if(t.canStart(r)&&!r.defaultPrevented&&r.dataTransfer){var f=r.target;if(f instanceof HTMLElement){var d=lS.get(f);if(d){var p=Zb(r),m={element:d.element,dragHandle:(i=d.dragHandle)!==null&&i!==void 0?i:null,input:p};if(d.canDrag&&!d.canDrag(m)){r.preventDefault();return}if(d.dragHandle){var E=Qie({x:p.clientX,y:p.clientY});if(!d.dragHandle.contains(E)){r.preventDefault();return}}var S=(a=(s=d.getInitialDataForExternal)===null||s===void 0?void 0:s.call(d,m))!==null&&a!==void 0?a:null;if(S)for(var g=0,y=Object.entries(S);g<y.length;g++){var v=Kie(y[g],2),x=v[0],T=v[1];r.dataTransfer.setData(x,T??"")}rae()&&!r.dataTransfer.types.includes(MH)&&!r.dataTransfer.types.includes(gIe)&&r.dataTransfer.setData(MH,mIe),r.dataTransfer.setData(bIe,"");var w={element:d.element,dragHandle:(o=d.dragHandle)!==null&&o!==void 0?o:null,data:(l=(u=d.getInitialData)===null||u===void 0?void 0:u.call(d,m))!==null&&l!==void 0?l:{}},C={type:"element",payload:w,startedFrom:"internal"};t.start({event:r,dragType:C})}}}}}))},dispatchEventToSource:function(t){var n,r,i=t.eventName,a=t.payload;(n=lS.get(a.source.element))===null||n===void 0||(r=n[i])===null||r===void 0||r.call(n,a)},onPostDispatch:jH.getOnPostDispatch()}),yw=u3.dropTarget,iae=u3.monitor;function aae(e){var t=f0(u3.registerUsage(),vIe(e),nae(e.element,{attribute:"draggable",value:"true"}));return eh(t)}function FH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function BH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FH(Object(n),!0).forEach(function(r){c0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yIe={top:function(t,n){return Math.abs(n.y-t.top)},right:function(t,n){return Math.abs(t.right-n.x)},bottom:function(t,n){return Math.abs(t.bottom-n.y)},left:function(t,n){return Math.abs(n.x-t.left)}},sae=Symbol("closestEdge");function oae(e,t){var n,r,i=t.element,a=t.input,s=t.allowedEdges,o={x:a.clientX,y:a.clientY},l=i.getBoundingClientRect(),u=s.map(function(d){return{edge:d,value:yIe[d](l,o)}}),f=(n=(r=u.sort(function(d,p){return d.value-p.value})[0])===null||r===void 0?void 0:r.edge)!==null&&n!==void 0?n:null;return BH(BH({},e),{},c0({},sae,f))}function wp(e){var t;return(t=e[sae])!==null&&t!==void 0?t:null}function _Ie({tab:e,isActive:t,canClose:n,onSelect:r,onClose:i,onEdit:a,onReorder:s}){const o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),p=k.useRef(!1);k.useEffect(()=>{const S=o.current;if(!(!S||!s))return f0(aae({element:S,getInitialData:()=>({type:"terminal-tab",tabId:e.id,position:e.position}),onDragStart:()=>{u(!0),p.current=!0},onDrop:()=>{u(!1)}}),yw({element:S,getData:({input:g,element:y})=>{const v={type:"terminal-tab",tabId:e.id,position:e.position};return oae(v,{input:g,element:y,allowedEdges:["left","right"]})},canDrop:({source:g})=>g.data.type==="terminal-tab"&&g.data.tabId!==e.id,onDragEnter:({self:g})=>{d(wp(g.data))},onDrag:({self:g})=>{d(wp(g.data))},onDragLeave:()=>{d(null)},onDrop:({source:g,self:y})=>{d(null);const v=wp(y.data),x=g.data.tabId,T=e.position;let w;v==="left"?w=T:w=T+1,s(x,w)}}))},[e.id,e.position,s]);const m=()=>{p.current=!1},E=()=>{p.current||r(),p.current=!1};return b.jsxs("button",{ref:o,onPointerDown:m,onClick:E,onDoubleClick:a,onContextMenu:S=>{S.preventDefault(),a()},className:Be("group relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors max-sm:px-2 max-sm:py-1",t?"bg-background text-foreground":"text-muted-foreground hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",t?"after:opacity-100":"after:opacity-0",l&&"opacity-50",s&&"cursor-grab active:cursor-grabbing"),title:e.directory?`${e.name}
|
|
46
|
-
${e.directory}`:e.name,children:[f&&b.jsx("div",{className:Be("absolute top-0 bottom-0 w-0.5 bg-primary z-10",f==="left"&&"-left-1",f==="right"&&"-right-1")}),e.directory&&b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0 opacity-60"}),e.name,n&&b.jsx("button",{onClick:S=>{S.stopPropagation(),i()},onPointerDown:S=>S.stopPropagation(),className:"ml-1 rounded opacity-0 hover:bg-muted group-hover:opacity-100",children:b.jsx(fe,{icon:fi,size:12,strokeWidth:2})})]})}function EIe({tabs:e,activeTabId:t,onTabSelect:n,onTabClose:r,onTabCreate:i,onTabEdit:a,onTabReorder:s}){const o=k.useRef(null),l=k.useRef(null),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,E]=k.useState(!0),S=k.useCallback(()=>{const v=o.current;if(!v)return;const{scrollLeft:x,scrollWidth:T,clientWidth:w}=v;f(x>0),p(x+w<T-1)},[]);k.useEffect(()=>{const v=l.current,x=o.current;if(!v||!x)return;const T=new IntersectionObserver(([w])=>{E(w.isIntersecting)},{root:x,threshold:.9});return T.observe(v),()=>T.disconnect()},[]),k.useEffect(()=>{const v=o.current;if(!v)return;S(),v.addEventListener("scroll",S);const x=new ResizeObserver(S);return x.observe(v),()=>{v.removeEventListener("scroll",S),x.disconnect()}},[S]),k.useEffect(()=>{S()},[e,S]);const g=k.useCallback(()=>{o.current?.scrollTo({left:0,behavior:"smooth"})},[]),y=k.useCallback(()=>{const v=o.current;v&&v.scrollTo({left:v.scrollWidth,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex items-center",children:[u&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:g,className:"shrink-0",children:b.jsx(fe,{icon:lte,size:14,strokeWidth:2})}),b.jsxs("div",{ref:o,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-none",children:[e.map(v=>b.jsx(_Ie,{tab:v,isActive:v.id===t,canClose:e.length>1,onSelect:()=>n(v.id),onClose:()=>r(v.id),onEdit:()=>a(v),onReorder:s},v.id)),b.jsx("span",{ref:l,children:b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Nv,size:14,strokeWidth:2})})})]}),d&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:y,className:"shrink-0",children:b.jsx(fe,{icon:Xy,size:14,strokeWidth:2})}),!m&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Nv,size:14,strokeWidth:2})})]})}function SIe({tab:e,open:t,onOpenChange:n,onSave:r,onCreate:i,defaultName:a=""}){const{t:s}=rn("terminals"),[o,l]=k.useState(""),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=!e&&i;k.useEffect(()=>{t&&(e?(l(e.name),f(e.directory??null)):(l(a),f(null)))},[t,e,a]);const E=()=>{if(m){i(o.trim(),u??void 0),n(!1);return}if(!e)return;const x={};o.trim()&&o.trim()!==e.name&&(x.name=o.trim()),u!==(e.directory??null)&&(x.directory=u),Object.keys(x).length>0&&r(e.id,x),n(!1)},S=x=>{x.key==="Enter"&&(x.preventDefault(),E())},g=()=>{f(null)},y=x=>{f(x)},v=u?u.split("/").pop():null;return b.jsxs(b.Fragment,{children:[b.jsx(ed,{open:t,onOpenChange:n,children:b.jsxs(td,{className:"sm:max-w-md",children:[b.jsx(Gf,{children:b.jsx(qf,{children:s(m?"newTab.title":"editTab.title")})}),b.jsxs(mf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"tabName",children:s("editTab.name")}),b.jsx(dn,{id:"tabName",value:o,onChange:x=>l(x.target.value),onKeyDown:S,placeholder:s("editTab.namePlaceholder"),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:s("editTab.directory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(qe,{type:"button",variant:"outline",className:"flex-1 justify-start font-normal",onClick:()=>p(!0),children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2 shrink-0"}),v?b.jsx("span",{className:"truncate font-mono text-xs",children:u}):b.jsx("span",{className:"text-muted-foreground",children:s("editTab.directoryPlaceholder")})]}),u&&b.jsx(qe,{type:"button",variant:"ghost",size:"icon",onClick:g,title:s("editTab.clearDirectory"),children:b.jsx(fe,{icon:fi,size:14,strokeWidth:2})})]})]})]}),b.jsxs(Df,{className:"mt-4",children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",type:"button"}),children:s("editTab.cancel")}),b.jsx(qe,{onClick:E,disabled:!o.trim(),children:s(m?"newTab.create":"editTab.save")})]})]})}),b.jsx(gf,{open:d,onOpenChange:p,onSelect:y,initialPath:u??void 0})]})}function UH(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function xIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Mi="all-tasks",$H=["IN_PROGRESS","IN_REVIEW"],zH="vibora:lastTerminalTab",wIe=u0(function(){const{t}=rn("terminals"),n=Ri(),{tab:r,repo:i}=Tx({from:"/terminals/"}),{terminals:a,tabs:s,connected:o,createTerminal:l,destroyTerminal:u,renameTerminal:f,assignTerminalToTab:d,createTab:p,updateTab:m,deleteTab:E,reorderTab:S,attachXterm:g,resizeTerminal:y,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,newTerminalIds:w,pendingTabCreation:C,lastCreatedTabId:R}=bie(),[O,N]=k.useState(null),{getFocusedTerminal:D}=Sie(),L=k.useMemo(()=>s.map(he=>he.id),[s]),z=r&&(L.includes(r)||r===Mi),M=z?r:s[0]?.id??null,V=k.useCallback(he=>{n({to:"/terminals",search:{tab:he,repo:he===Mi?i:void 0},replace:!0})},[n,i]),H=k.useCallback(he=>{n({to:"/terminals",search:ce=>({...ce,repo:he||void 0}),replace:!0})},[n]),B=Um();k.useEffect(()=>zM(()=>({lastCreatedTabId:B.lastCreatedTabId,pendingTabCreation:B.pendingTabCreation}),({lastCreatedTabId:ce})=>{ce&&(At.terminal.info("MobX reaction: lastCreatedTabId changed",{tabId:ce}),V(ce),setTimeout(()=>{B.clearLastCreatedTabId(),se.current++;const Ne=`Terminal ${se.current}`;At.terminal.debug("Creating terminal in new tab",{tabId:ce,name:Ne}),l({name:Ne,cols:80,rows:24,tabId:ce,positionInTab:0})},150))},{fireImmediately:!0}),[B,V,l]),k.useEffect(()=>{if(At.terminal.debug("Redirect effect running",{tabsLength:s.length,isValidTab:z,pendingTabCreation:C,lastCreatedTabId:R}),s.length!==0&&!(C||R)&&!z){const he=localStorage.getItem(zH),ce=he&&(s.some(Ne=>Ne.id===he)||he===Mi)?he:s[0].id;At.terminal.debug("Redirecting to tab",{targetTab:ce}),n({to:"/terminals",search:{tab:ce},replace:!0})}},[s,z,R,C,n]),k.useEffect(()=>{M&&localStorage.setItem(zH,M)},[M]);const{data:q=[],status:K}=DM(),{data:U=[]}=t0(),j=k.useMemo(()=>{const he=new Map;for(const ce of U)he.set(ce.path,ce.id);return he},[U]),$=k.useMemo(()=>new Set(q.filter(he=>$H.includes(he.status)&&he.worktreePath).map(he=>he.worktreePath)),[q]),Y=k.useMemo(()=>new Set(q.filter(he=>he.worktreePath).map(he=>he.worktreePath)),[q]),W=k.useMemo(()=>{const he=new Map;for(const ce of q)ce.worktreePath&&he.set(ce.worktreePath,{taskId:ce.id,repoId:j.get(ce.repoPath),repoName:ce.repoName,title:ce.title,repoPath:ce.repoPath,worktreePath:ce.worktreePath,baseBranch:ce.baseBranch,branch:ce.branch,prUrl:ce.prUrl});return he},[q,j]),J=k.useMemo(()=>{const he=new Set(q.filter(ce=>$H.includes(ce.status)).map(ce=>ce.repoName));return Array.from(he).sort()},[q]),ae=k.useRef(new Map),se=k.useRef(0),Q=k.useRef(!1),G=k.useRef(!1),Z=k.useMemo(()=>M===Mi?a.filter(he=>he.cwd&&$.has(he.cwd)).filter(he=>i?q.find(Ne=>Ne.worktreePath===he.cwd)?.repoName===i:!0).sort((he,ce)=>{const Ne=q.find(ve=>ve.worktreePath===he.cwd),Pe=q.find(ve=>ve.worktreePath===ce.cwd);return!Ne||!Pe?0:new Date(Pe.createdAt).getTime()-new Date(Ne.createdAt).getTime()}).map(UH):a.filter(he=>he.tabId===M).sort((he,ce)=>he.positionInTab-ce.positionInTab).map(UH),[M,a,$,i,q]),ee=k.useCallback(()=>{if(At.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:o,pendingTerminalCreate:Q.current,terminalCount:a.length}),Q.current){At.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,se.current++;const he=`Terminal ${se.current}`,ce=a.filter(Pe=>Pe.tabId===M),Ne=ce.length;At.terminal.info("Creating terminal",{name:he,tabId:M,positionInTab:Ne,terminalsInTabCount:ce.length}),l({name:he,cols:80,rows:24,tabId:M??void 0,positionInTab:Ne}),setTimeout(()=>{Q.current=!1},500)},[l,M,a,o]);k.useEffect(()=>{if(K!=="success"){At.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:K});return}for(const he of a)he.cwd&&Y.has(he.cwd)&&he.tabId&&(At.terminalsView.debug("Removing task terminal from regular tab",{terminalId:he.id,name:he.name,cwd:he.cwd,tabId:he.tabId}),d(he.id,null))},[a,Y,d,K]);const ne=k.useCallback(he=>{const ce=ae.current.get(he);ce&&(ce(),ae.current.delete(he)),u(he,{force:!0,reason:"user_closed"})},[u]),te=k.useCallback((he,ce)=>{const Ne=g(he,ce);ae.current.set(he,Ne),w.has(he)&&setTimeout(()=>{ce.focus()},50)},[g,w]),ye=k.useCallback((he,ce,Ne)=>{y(he,ce,Ne)},[y]),Ee=k.useCallback((he,ce)=>{f(he,ce)},[f]),pe=k.useCallback(()=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0;const he=`Tab ${s.length+1}`;At.terminal.debug("Quick creating tab",{name:he}),p(he,void 0,void 0),setTimeout(()=>{G.current=!1},500)},[p,s.length]),_e=k.useCallback((he,ce)=>{At.terminal.debug("Reordering tab",{tabId:he,newPosition:ce}),S(he,ce)},[S]),Se=k.useCallback((he,ce)=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0,At.terminal.debug("Creating tab",{name:he,directory:ce}),p(he,void 0,ce),setTimeout(()=>{G.current=!1},500)},[p]),Te=k.useCallback(he=>{const ce=a.filter(Ne=>Ne.tabId===he);for(const Ne of ce){const Pe=ae.current.get(Ne.id);Pe&&(Pe(),ae.current.delete(Ne.id))}E(he)},[a,E]),de=s.map(xIe),Ce=k.useCallback(he=>{N(he)},[]),ge=k.useCallback((he,ce)=>{m(he,ce)},[m]);return Va("meta+d",ee,{enabled:M!==Mi&&o,allowInTerminal:!0,deps:[ee,M,o]}),Va("meta+w",()=>{if(M&&M!==Mi){const he=D(M);he&&ne(he)}},{enabled:M!==Mi,allowInTerminal:!0,deps:[M,D,ne]}),b.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[b.jsxs("button",{onClick:()=>V(Mi),className:Be("relative flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===Mi?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===Mi?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:jp,size:12,strokeWidth:2}),b.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),b.jsx("div",{className:"mx-2 h-4 w-px shrink-0 bg-border"}),b.jsx("div",{className:"min-w-0 flex-1",children:b.jsx(EIe,{tabs:de,activeTabId:M??"",onTabSelect:V,onTabClose:Te,onTabCreate:pe,onTabEdit:Ce,onTabReorder:_e})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===Mi&&J.length>1&&b.jsxs(Bi,{value:i??"",onValueChange:he=>H(he||null),children:[b.jsxs($i,{size:"sm",className:"max-sm:w-auto",children:[b.jsx(fe,{icon:pte,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Ui,{children:i||t("allRepos")})]}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"",children:t("allRepos")}),J.map(he=>b.jsx(Cn,{value:he,children:he},he))]})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:ee,disabled:!o||M===Mi,className:"max-sm:px-2 border-transparent text-primary",children:[b.jsx(fe,{icon:Wx,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),b.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:b.jsx(RNe,{terminals:Z,onTerminalClose:M===Mi?void 0:ne,onTerminalAdd:o&&M!==Mi?ee:void 0,onTerminalReady:te,onTerminalResize:ye,onTerminalRename:M===Mi?void 0:Ee,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,taskInfoByCwd:M===Mi?W:void 0})}),b.jsx(SIe,{tab:O,open:O!==null,onOpenChange:he=>{he||N(null)},onSave:ge,onCreate:Se,defaultName:`Tab ${s.length+1}`})]})}),TIe=js("/terminals/")({component:wIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0,repo:typeof e.repo=="string"?e.repo:void 0})});function CIe(){return{x:0,y:0}}function AIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?CIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:Jie,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(d0()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=iae({onDragStart:o,onDrop:o})}var kIe=eh(function(){return d0()&&"ontouchend"in document}),OIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function RIe(e){return function(n){var r=n.container;if(kIe()||rae())return OIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const lae=k.createContext(null);function NIe({children:e}){const[t,n]=k.useState(null);return b.jsx(lae.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function uae(){const e=k.useContext(lae);if(!e)throw new Error("useDrag must be used within DragProvider");return e}const cae=k.createContext(null);function IIe({children:e}){const[t,n]=k.useState(new Set),[r,i]=k.useState(null),a=k.useCallback(u=>{n(f=>{const d=new Set(f);return d.has(u)?d.delete(u):d.add(u),d}),i(u)},[]),s=k.useCallback((u,f)=>{if(!r){n(new Set([u])),i(u);return}const d=f.indexOf(r),p=f.indexOf(u);if(d===-1||p===-1){n(new Set([u])),i(u);return}const[m,E]=d<p?[d,p]:[p,d],S=f.slice(m,E+1);n(g=>{const y=new Set(g);for(const v of S)y.add(v);return y})},[r]),o=k.useCallback(()=>{n(new Set),i(null)},[]),l=k.useCallback(u=>t.has(u),[t]);return b.jsx(cae.Provider,{value:{selectedIds:t,lastSelectedId:r,toggleSelection:a,selectRange:s,clearSelection:o,isSelected:l},children:e})}function c3(){const e=k.useContext(cae);if(!e)throw new Error("useSelection must be used within a SelectionProvider");return e}function DIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function dae({task:e,open:t,onOpenChange:n}){const r=nw(),i=rw(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,E]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),E(e.linearTicketUrl||""),l(!0))},[t,e]);const S=()=>{const v={},x=a.trim();if(!x)return;x!==e.title&&(v.title=x);const T=u.trim();T!==(e.description||"")&&(v.description=T);const w=d.trim();w!==(e.prUrl||"")&&(v.prUrl=w||null);const C=m.trim();C!==(e.linearTicketUrl||"")&&(v.linearTicketUrl=C||null,v.linearTicketId=C?DIe(C):null),Object.keys(v).length>0&&r.mutate({taskId:e.id,updates:v}),n(!1)},g=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),S())},y=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return b.jsx(ed,{open:t,onOpenChange:n,children:b.jsxs(td,{className:"sm:max-w-md",onKeyDown:g,children:[b.jsx(Gf,{children:b.jsx(qf,{children:"Task Settings"})}),b.jsxs(mf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-title",children:"Title"}),b.jsx(dn,{id:"config-title",value:a,onChange:v=>s(v.target.value),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-description",children:"Description"}),b.jsx(Bte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),b.jsx(dn,{id:"config-pr-url",value:d,onChange:v=>p(v.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),b.jsx(dn,{id:"config-linear-url",value:m,onChange:v=>E(v.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),b.jsxs(Df,{className:"mt-4 flex-row justify-between sm:justify-between",children:[b.jsxs(go,{children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:"Delete Task"}),b.jsx(Eo,{children:"This will permanently delete this task. This action cannot be undone."})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(hi,{id:"delete-worktree",checked:o,onCheckedChange:v=>l(v===!0)}),b.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),b.jsxs(yo,{children:[b.jsx(So,{children:"Cancel"}),b.jsx(qp,{onClick:y,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(qe,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),b.jsx(qe,{onClick:S,disabled:!a.trim(),children:"Save"})]})]})]})})}function fae({task:e,isDragPreview:t}){const{setActiveTask:n}=uae(),{isSelected:r,toggleSelection:i}=c3(),a=Ri(),s=r(e.id),o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),[p,m]=k.useState(null),[E,S]=k.useState(!1),g=k.useRef(!1);k.useEffect(()=>{const T=o.current;if(!(!T||t))return f0(aae({element:T,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:w})=>{AIe({nativeSetDragImage:w,getOffset:RIe({x:"16px",y:"8px"}),render:({container:C})=>{m(C)}})},onDragStart:()=>{u(!0),n(e),g.current=!0},onDrop:()=>{u(!1),n(null),m(null)}}),yw({element:T,getData:({input:w,element:C})=>{const R={type:"task",taskId:e.id,status:e.status};return oae(R,{input:w,element:C,allowedEdges:["top","bottom"]})},canDrop:({source:w})=>w.data.taskId!==e.id,onDragEnter:({self:w})=>{d(wp(w.data))},onDrag:({self:w})=>{d(wp(w.data))},onDragLeave:()=>{d(null)},onDrop:()=>{d(null)}}))},[e,t,n]);const y=()=>{g.current=!1},v=()=>{if(g.current){g.current=!1;return}a({to:"/tasks/$taskId",params:{taskId:e.id}}),g.current=!1},x=b.jsxs("div",{className:"group/card relative",children:[!t&&b.jsx("div",{className:Be("absolute left-2 top-2 z-20 transition-opacity",s?"opacity-100":"opacity-0 group-hover/card:opacity-100"),onPointerDown:T=>T.stopPropagation(),children:b.jsx(hi,{checked:s,onCheckedChange:()=>i(e.id)})}),b.jsxs(wa,{ref:t?void 0:o,onPointerDown:y,onClick:v,className:Be("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",l&&"opacity-50",s&&"ring-2 ring-primary bg-primary/5"),children:[f&&b.jsx("div",{className:Be("absolute left-0 right-0 h-0.5 bg-primary z-10",f==="top"&&"-top-1",f==="bottom"&&"-bottom-1")}),b.jsxs(E2e,{className:Be("p-3 pb-1 flex flex-row items-start justify-between gap-2",!t&&"pl-8"),children:[b.jsx(S2e,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&b.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:T=>{T.stopPropagation(),S(!0)},onPointerDown:T=>T.stopPropagation(),children:b.jsx(fe,{icon:eD,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsxs(Mf,{className:"p-3 pt-1",children:[e.description&&b.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),b.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2}),b.jsx("span",{children:e.repoName}),e.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:ou,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:gM,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]})]});return b.jsxs(b.Fragment,{children:[x,p&&xr.createPortal(b.jsx("div",{className:"w-72 max-w-[90vw]",children:b.jsx(fae,{task:e,isDragPreview:!0})}),p),b.jsx(dae,{task:e,open:E,onOpenChange:S})]})}const LIe={IN_PROGRESS:"border-t-status-in-progress",IN_REVIEW:"border-t-status-in-review",DONE:"border-t-status-done",CANCELED:"border-t-status-canceled"};function HH({status:e,tasks:t,isMobile:n}){const{t:r}=rn("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>u.position-l.position);return k.useEffect(()=>{const l=i.current;if(l)return yw({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),b.jsxs("div",{ref:i,className:Be("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",LIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&b.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[b.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),b.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),b.jsx(n0,{className:"min-h-0 flex-1",children:b.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>b.jsx(fae,{task:l},l.id))})})]})}function PIe(){const{selectedIds:e,clearSelection:t}=c3(),n=Vxe(),[r,i]=k.useState(!0),a=e.size,s=()=>{n.mutate({ids:Array.from(e),deleteLinkedWorktrees:r},{onSuccess:()=>{t()}})};return a===0?null:b.jsx("div",{className:Be("fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 backdrop-blur-sm","animate-in slide-in-from-bottom-2 duration-200"),children:b.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-4 px-4 py-3",children:[b.jsxs("span",{className:"text-sm text-muted-foreground",children:[a," task",a!==1?"s":""," selected"]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(qe,{variant:"ghost",size:"sm",onClick:t,children:"Clear"}),b.jsxs(go,{children:[b.jsx(wu,{render:b.jsx(qe,{variant:"destructive",size:"sm",disabled:n.isPending}),children:n.isPending?"Deleting...":"Delete"}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsxs(_o,{children:["Delete ",a," Task",a!==1?"s":""]}),b.jsxs(Eo,{children:["This will permanently delete ",a," task",a!==1?"s":"",". This action cannot be undone."]})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(hi,{id:"bulk-delete-worktrees",checked:r,onCheckedChange:o=>i(o===!0)}),b.jsx("label",{htmlFor:"bulk-delete-worktrees",className:"cursor-pointer text-sm",children:"Also delete linked worktrees"})]}),b.jsxs(yo,{children:[b.jsx(So,{children:"Cancel"}),b.jsx(qp,{onClick:s,variant:"destructive",disabled:n.isPending,children:n.isPending?"Deleting...":"Delete"})]})]})]})]})]})})}const Uk=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function MIe({status:e}){const{t}=rn("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return yw({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),b.jsx("div",{ref:n,className:Be("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function jIe({repoFilter:e,searchQuery:t}){const{t:n}=rn("common"),{data:r=[],isLoading:i}=DM(),a=Wxe(),{activeTask:s}=uae(),{clearSelection:o,selectedIds:l}=c3(),[u,f]=k.useState("IN_PROGRESS");k.useEffect(()=>{const m=E=>{E.key==="Escape"&&l.size>0&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[o,l.size]);const d=k.useMemo(()=>{let m=r;return e&&(m=m.filter(E=>E.repoName===e)),t?.trim()?m=m.map(E=>({task:E,score:Math.max(no(E.title,t),no(E.description||"",t),no(E.branch||"",t),no(E.linearTicketId||"",t),no(E.prUrl||"",t))})).filter(({score:E})=>E>0).sort((E,S)=>S.score-E.score).map(({task:E})=>E):m=[...m].sort((E,S)=>new Date(S.createdAt).getTime()-new Date(E.createdAt).getTime()),m},[r,e,t]),p=k.useMemo(()=>{const m={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const E of d)m[E.status]++;return m},[d]);return k.useEffect(()=>iae({canMonitor:({source:m})=>m.data.type==="task",onDrop:({source:m,location:E})=>{const S=E.current.dropTargets;if(S.length===0)return;const g=m.data.taskId,y=d.find(T=>T.id===g);if(!y)return;const v=S[0],x=v.data;if(x.type==="column"){const T=x.status;if(T!==y.status){const w=d.filter(C=>C.status===T);a.mutate({taskId:g,status:T,position:w.length})}}else if(x.type==="task"){const T=wp(v.data),w=x.status,C=d.filter(N=>N.status===w).sort((N,D)=>N.position-D.position),R=C.findIndex(N=>N.id===x.taskId);let O=R;T==="bottom"&&(O=R+1),y.status===w&&C.findIndex(D=>D.id===g)<R&&(O=Math.max(0,O-1)),(y.status!==w||O!==y.position)&&a.mutate({taskId:g,status:w,position:O})}}}),[d,a]),i?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"border-b bg-background lg:hidden",children:b.jsx(Zo,{value:u,onValueChange:m=>f(m),children:b.jsx(Qo,{variant:"line",className:"w-full justify-start px-4",children:Uk.map(m=>b.jsxs(Wr,{value:m,className:"gap-1.5",children:[b.jsx("span",{className:"truncate",children:n(`statuses.${m}`)}),b.jsx("span",{className:"text-muted-foreground",children:p[m]})]},m))})})}),b.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:Uk.map(m=>b.jsx(HH,{status:m,tasks:d.filter(E=>E.status===m)},m))}),b.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:b.jsx(HH,{status:u,tasks:d.filter(m=>m.status===u),isMobile:!0})}),s&&b.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:Uk.filter(m=>m!==u).map(m=>b.jsx(MIe,{status:m},m))}),b.jsx(PIe,{})]})}function FIe(e){return b.jsx(IIe,{children:b.jsx(NIe,{children:b.jsx(jIe,{...e})})})}const hae=js("/tasks/")({component:BIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function BIe(){const{t:e}=rn("tasks"),{data:t=[]}=DM(),{repo:n}=hae.useSearch(),r=Ri(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsxs(Bi,{value:n??"",onValueChange:l=>s(l||null),children:[b.jsxs($i,{size:"sm",className:"shrink-0 gap-1.5",children:[b.jsx(fe,{icon:pte,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Ui,{children:n??e("allRepos")})]}),b.jsxs(zi,{className:"min-w-[160px]",children:[b.jsx(Cn,{value:"",children:e("allRepos")}),o.map(l=>b.jsx(Cn,{value:l,children:l},l))]})]})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx(FIe,{repoFilter:n??null,searchQuery:i})})]})}function $o({className:e,size:t="default",...n}){return b.jsx(oxe,{"data-slot":"switch","data-size":t,className:Be("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:b.jsx(lxe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const UIe=js("/settings/")({component:$Ie});function fc({title:e,children:t}){return b.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[b.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function $Ie(){const{t:e}=rn("settings"),{t}=rn("common"),{data:n,isLoading:r}=jne(),{data:i,isLoading:a}=iw(),{data:s,isLoading:o}=LM(),{data:l,isLoading:u}=PM(),{data:f,isLoading:d}=MM(),{data:p,isLoading:m}=Jxe(),{data:E,isLoading:S}=ewe(),{data:g,isLoading:y}=swe(),{data:v,isLoading:x}=uwe(),{data:T}=Bne(),w=dwe(),{savedLanguage:C,changeLanguage:R}=zne(),{theme:O,syncClaudeCode:N,changeTheme:D}=Eie(),{data:L}=rwe(),{data:z}=iwe(),M=Fne(),V=awe(),H=owe(),B=cwe(),q=lwe(),[K,U]=k.useState(""),[j,$]=k.useState(""),[Y,W]=k.useState("vscode"),[J,ae]=k.useState(""),[se,Q]=k.useState(""),[G,Z]=k.useState(""),[ee,ne]=k.useState(""),[te,ye]=k.useState(!1),[Ee,pe]=k.useState(!1),[_e,Se]=k.useState(!1),[Te,de]=k.useState(!1),[Ce,ge]=k.useState(!1),[he,ce]=k.useState(""),[Ne,Pe]=k.useState(!1),[ve,Le]=k.useState(""),[Ae,Ve]=k.useState(!1),[Ze,gt]=k.useState(""),[st,ot]=k.useState(""),[Fe,ht]=k.useState(!1),[Ie,ze]=k.useState(""),[et,lt]=k.useState("glm-4.5-air"),[pt,bn]=k.useState("glm-4.7"),[Bt,It]=k.useState("glm-4.7"),[ct,nn]=k.useState(!1),[Pt,yt]=k.useState("light-ansi"),[Ut,$t]=k.useState("dark-ansi"),[Ht,ft]=k.useState(!1),[yn,mr]=k.useState(!1),[qr,Pr]=k.useState(!1),Yi=k.useRef(null);k.useEffect(()=>{n!==void 0&&U(String(n)),i!==void 0&&$(i),s!==void 0&&W(s),l!==void 0&&ae(l),f!==void 0&&Q(String(f)),p!==void 0&&Z(p),E!==void 0&&ne(E)},[n,i,s,l,f,p,E]),k.useEffect(()=>{g&&(Se(g.enabled),de(g.sound?.enabled??!1),mr(!!g.sound?.customSoundFile),ge(g.slack?.enabled??!1),ce(g.slack?.webhookUrl??""),Pe(g.discord?.enabled??!1),Le(g.discord?.webhookUrl??""),Ve(g.pushover?.enabled??!1),gt(g.pushover?.appToken??""),ot(g.pushover?.userKey??""))},[g]),k.useEffect(()=>{v&&(ht(v.enabled),ze(v.apiKey??""),lt(v.haikuModel),bn(v.sonnetModel),It(v.opusModel))},[v]),k.useEffect(()=>{N!==void 0&&nn(N),L!==void 0&&yt(L),z!==void 0&&$t(z)},[N,L,z]);const Yt=r||a||o||u||d||m||S||y||x,Di=v&&(Fe!==v.enabled||Ie!==(v.apiKey??"")||et!==v.haikuModel||pt!==v.sonnetModel||Bt!==v.opusModel),gr=ct!==(N??!1)||Pt!==L||Ut!==z,br=g&&(_e!==g.enabled||Te!==(g.sound?.enabled??!1)||Ce!==(g.slack?.enabled??!1)||he!==(g.slack?.webhookUrl??"")||Ne!==(g.discord?.enabled??!1)||ve!==(g.discord?.webhookUrl??"")||Ae!==(g.pushover?.enabled??!1)||Ze!==(g.pushover?.appToken??"")||st!==(g.pushover?.userKey??"")),ls=Y!==s||J!==l||se!==String(f),Xi=K!==String(n)||j!==i||G!==p||ee!==E||ls||br||Di||gr,Vs=async()=>{const Ge=[];if(K!==String(n)){const Nt=parseInt(K,10);!isNaN(Nt)&&Nt>=1&&Nt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.PORT,value:Nt},{onSettled:Cr})}))}if(j!==i&&Ge.push(new Promise(Nt=>{M.mutate({key:In.DEFAULT_GIT_REPOS_DIR,value:j},{onSettled:Nt})})),Y!==s&&Ge.push(new Promise(Nt=>{M.mutate({key:In.EDITOR_APP,value:Y},{onSettled:Nt})})),J!==l&&Ge.push(new Promise(Nt=>{M.mutate({key:In.EDITOR_HOST,value:J},{onSettled:Nt})})),se!==String(f)){const Nt=parseInt(se,10);!isNaN(Nt)&&Nt>=1&&Nt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.EDITOR_SSH_PORT,value:Nt},{onSettled:Cr})}))}G!==p&&Ge.push(new Promise(Nt=>{M.mutate({key:In.LINEAR_API_KEY,value:G},{onSettled:Nt})})),ee!==E&&Ge.push(new Promise(Nt=>{M.mutate({key:In.GITHUB_PAT,value:ee},{onSettled:Nt})})),br&&Ge.push(new Promise(Nt=>{H.mutate({enabled:_e,sound:{enabled:Te},slack:{enabled:Ce,webhookUrl:he},discord:{enabled:Ne,webhookUrl:ve},pushover:{enabled:Ae,appToken:Ze,userKey:st}},{onSettled:Nt})})),Di&&Ge.push(new Promise(Nt=>{B.mutate({enabled:Fe,apiKey:Ie||null,haikuModel:et,sonnetModel:pt,opusModel:Bt},{onSettled:Nt})})),gr&&(ct!==(N??!1)&&Ge.push(new Promise(Nt=>{M.mutate({key:In.SYNC_CLAUDE_CODE_THEME,value:ct},{onSettled:Nt})})),Pt!==L&&Ge.push(new Promise(Nt=>{M.mutate({key:In.CLAUDE_CODE_LIGHT_THEME,value:Pt},{onSettled:Nt})})),Ut!==z&&Ge.push(new Promise(Nt=>{M.mutate({key:In.CLAUDE_CODE_DARK_THEME,value:Ut},{onSettled:Nt})}))),await Promise.all(Ge),pe(!0),setTimeout(()=>pe(!1),2e3)},lg=()=>{V.mutate(In.PORT,{onSuccess:Ge=>{Ge.value!==null&&U(String(Ge.value))}})},hd=()=>{V.mutate(In.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ge=>{Ge.value&&$(String(Ge.value))}})},wl=()=>{V.mutate(In.EDITOR_APP,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&W(Ge.value)}})},Tl=()=>{V.mutate(In.EDITOR_HOST,{onSuccess:Ge=>{ae(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Gs=()=>{V.mutate(In.EDITOR_SSH_PORT,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&Q(String(Ge.value))}})},us=()=>{V.mutate(In.LINEAR_API_KEY,{onSuccess:Ge=>{Z(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Cl=()=>{V.mutate(In.GITHUB_PAT,{onSuccess:Ge=>{ne(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Li=async Ge=>{q.mutate(Ge,{onSuccess:Nt=>{Nt.success?kt.success(e("notifications.testSuccess",{channel:Ge})):kt.error(e("notifications.testFailed",{channel:Ge,error:Nt.error}))},onError:Nt=>{kt.error(e("notifications.testFailed",{channel:Ge,error:Nt.message}))}})},Tr=async Ge=>{const Nt=Ge.target.files?.[0];if(Nt){Pr(!0);try{const Cr=new FormData;Cr.append("file",Nt);const Al=await fetch("/api/uploads/sound",{method:"POST",body:Cr});if(!Al.ok){const Da=await Al.json();throw new Error(Da.error||"Upload failed")}mr(!0),kt.success(e("notifications.soundUploaded"))}catch(Cr){kt.error(e("notifications.soundUploadFailed",{error:Cr instanceof Error?Cr.message:"Unknown error"}))}finally{Pr(!1),Yi.current&&(Yi.current.value="")}}},vi=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");mr(!1),kt.success(e("notifications.soundDeleted"))}catch{kt.error(e("notifications.soundDeleteFailed"))}};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:b.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),b.jsx("div",{className:"flex-1 overflow-auto p-6",children:b.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[b.jsx(fc,{title:e("sections.server"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(dn,{type:"number",min:1,max:65535,value:K,onChange:Ge=>U(Ge.target.value),placeholder:"7777",disabled:Yt,className:"w-24 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:lg,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),b.jsx(fc,{title:e("sections.paths"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{value:j,onChange:Ge=>$(Ge.target.value),placeholder:"~/projects",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ye(!0),disabled:Yt,title:t("buttons.browse"),children:b.jsx(fe,{icon:Vi,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hd,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),b.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[b.jsx(fc,{title:e("sections.editor"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(Bi,{value:Y,onValueChange:Ge=>W(Ge),children:[b.jsx($i,{className:"w-32",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"vscode",children:"VS Code"}),b.jsx(Cn,{value:"cursor",children:"Cursor"}),b.jsx(Cn,{value:"windsurf",children:"Windsurf"}),b.jsx(Cn,{value:"zed",children:"Zed"})]})]}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:wl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{value:J,onChange:Ge=>ae(Ge.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Tl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(dn,{type:"number",min:1,max:65535,value:se,onChange:Ge=>Q(Ge.target.value),placeholder:"22",disabled:Yt,className:"w-20 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Gs,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),b.jsx(fc,{title:e("sections.integrations"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{type:"password",value:G,onChange:Ge=>Z(Ge.target.value),placeholder:"lin_api_...",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:us,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{type:"password",value:ee,onChange:Ge=>ne(Ge.target.value),placeholder:"ghp_...",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Cl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),b.jsx(fc,{title:e("sections.zai"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),b.jsx($o,{checked:Fe,onCheckedChange:ht,disabled:Yt})]}),Fe&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),b.jsx(dn,{type:"password",value:Ie,onChange:Ge=>ze(Ge.target.value),placeholder:"zai_...",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),b.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[b.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),b.jsx(dn,{value:et,onChange:Ge=>lt(Ge.target.value),placeholder:"glm-4.5-air",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),b.jsx(dn,{value:pt,onChange:Ge=>bn(Ge.target.value),placeholder:"glm-4.7",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),b.jsx(dn,{value:Bt,onChange:Ge=>It(Ge.target.value),placeholder:"glm-4.7",disabled:Yt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),b.jsx(fc,{title:e("sections.notifications"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),b.jsx($o,{checked:_e,onCheckedChange:Se,disabled:Yt})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Te,onCheckedChange:de,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx("input",{ref:Yi,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Tr}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Yi.current?.click(),disabled:Yt||!_e||!Te||qr,title:e("notifications.uploadSound"),children:qr?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:q1e,size:14,strokeWidth:2})}),yn&&b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:vi,disabled:Yt||!_e||!Te,title:e("notifications.deleteSound"),children:b.jsx(fe,{icon:bu,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("sound"),disabled:Yt||!_e||!Te||q.isPending,title:e("notifications.testSound"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]})]}),yn&&b.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ce,onCheckedChange:ge,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("slack"),disabled:Yt||!_e||!Ce||!he||q.isPending,title:e("notifications.slack"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ce&&b.jsx(dn,{type:"password",value:he,onChange:Ge=>ce(Ge.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Yt||!_e,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ne,onCheckedChange:Pe,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("discord"),disabled:Yt||!_e||!Ne||!ve||q.isPending,title:e("notifications.discord"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ne&&b.jsx(dn,{type:"password",value:ve,onChange:Ge=>Le(Ge.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Yt||!_e,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ae,onCheckedChange:Ve,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("pushover"),disabled:Yt||!_e||!Ae||!Ze||!st||q.isPending,title:e("notifications.pushover"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ae&&b.jsxs("div",{className:"ml-6 space-y-2",children:[b.jsx(dn,{type:"password",value:Ze,onChange:Ge=>gt(Ge.target.value),placeholder:e("notifications.appToken"),disabled:Yt||!_e,className:"flex-1 font-mono text-sm"}),b.jsx(dn,{type:"password",value:st,onChange:Ge=>ot(Ge.target.value),placeholder:e("notifications.userKey"),disabled:Yt||!_e,className:"flex-1 font-mono text-sm"})]})]})]})}),b.jsx(fc,{title:e("sections.appearance"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),b.jsxs(Bi,{value:C??"auto",onValueChange:Ge=>R(Ge==="auto"?null:Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"auto",children:e("fields.language.options.auto")}),b.jsx(Cn,{value:"en",children:e("fields.language.options.en")}),b.jsx(Cn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),b.jsxs(Bi,{value:O??"system",onValueChange:Ge=>D(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"system",children:e("fields.theme.options.system")}),b.jsx(Cn,{value:"light",children:e("fields.theme.options.light")}),b.jsx(Cn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),b.jsx($o,{checked:ct,onCheckedChange:nn})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ct&&b.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),b.jsxs(Bi,{value:Pt,onValueChange:Ge=>yt(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsx(zi,{children:xz.filter(Ge=>Ge.startsWith("light")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),b.jsxs(Bi,{value:Ut,onValueChange:Ge=>$t(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsx(zi,{children:xz.filter(Ge=>Ge.startsWith("dark")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]})]})]})}),T?.enabled&&b.jsx(fc,{title:e("sections.developer"),children:b.jsx("div",{className:"space-y-1",children:b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[b.jsx("div",{className:"flex-1",children:b.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:()=>{const Ge=T?.startedAt;ft(!0),w.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Al=0;Al<120;Al++){await new Promise(Da=>setTimeout(Da,500));try{const Da=await fetch("/api/config/developer-mode");if(Da.ok&&(await Da.json()).startedAt!==Ge){window.location.reload();return}}catch{}}ft(!1),kt.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Nt=>{ft(!1),kt.error(e("developer.restartFailed"),{description:Nt.message})}})},disabled:w.isPending||Ht,className:"shrink-0 gap-2",children:[(w.isPending||Ht)&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),e(Ht?"developer.restarting":"developer.restartButton")]})]})})})]})}),b.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:b.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[Ee&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[b.jsx(fe,{icon:pl,size:12,strokeWidth:2}),t("status.saved")]}),b.jsx(qe,{size:"sm",onClick:Vs,disabled:!Xi||Yt||M.isPending,children:t("buttons.save")})]})}),b.jsx(gf,{open:te,onOpenChange:ye,onSelect:Ge=>$(Ge),initialPath:j||void 0})]})}const _w="";function zIe(){return qn({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${_w}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function HIe(){return qn({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${_w}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function WIe(e,t,n){return qn({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${_w}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function VIe(e,t,n){return qn({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${_w}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function GIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=rn("review"),{t:i}=rn("common"),{data:a,isLoading:s,error:o}=WIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:tn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:rs,size:24}),b.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(qIe,{issue:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:pl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function qIe({issue:e}){return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsx(Mf,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function KIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=rn("review"),{t:i}=rn("common"),{data:a,isLoading:s,error:o}=VIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:tn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:rs,size:24}),b.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(YIe,{pr:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:pl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function YIe({pr:e}){const{t}=rn("review");return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsx(Mf,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&b.jsx(co,{variant:"secondary",className:Be("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&b.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),b.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const XIe=js("/review/")({component:ZIe});function ZIe(){const{t:e}=rn("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=zIe(),{data:m=[]}=HIe();return!p&&!d?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),b.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:b.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[b.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:b.jsx(fe,{icon:U1e,size:24,className:"text-muted-foreground"})}),b.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),b.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),b.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[b.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),b.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:b.jsxs(qe,{variant:"outline",size:"sm",className:"w-full",children:[b.jsx(fe,{icon:$1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),b.jsx(Ai,{to:"/settings",children:b.jsx(qe,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):b.jsx("div",{className:"flex h-full flex-col",children:b.jsxs(Zo,{value:t,onValueChange:E=>n(E),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 flex-col border-b border-border bg-background sm:flex-row sm:items-center sm:justify-between",children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-1 max-sm:px-2",children:[b.jsxs(Qo,{variant:"line",children:[b.jsx(Wr,{value:"prs",children:e("tabs.pullRequests")}),b.jsx(Wr,{value:"issues",children:e("tabs.issues")})]}),b.jsx("label",{className:"flex cursor-pointer items-center gap-2 text-xs sm:hidden",title:e("filters.viboraReposOnly"),children:b.jsx($o,{checked:o,onCheckedChange:l,disabled:!!u})})]}),b.jsxs("div",{className:"flex items-center gap-2 border-t border-border px-4 py-1.5 sm:gap-4 sm:border-t-0 sm:px-4 sm:py-1",children:[t==="prs"?b.jsxs(Bi,{value:r,onValueChange:E=>i(E),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"created",children:e("filters.pr.created")}),b.jsx(Cn,{value:"assigned",children:e("filters.pr.assigned")}),b.jsx(Cn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),b.jsx(Cn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):b.jsxs(Bi,{value:a,onValueChange:E=>s(E),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"assigned",children:e("filters.issue.assigned")}),b.jsx(Cn,{value:"created",children:e("filters.issue.created")}),b.jsx(Cn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),b.jsxs(Bi,{value:u,onValueChange:E=>f(E||""),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{children:u||e("filters.allOrgs")})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"",children:e("filters.allOrganizations")}),m.map(E=>b.jsx(Cn,{value:E.login,children:E.login},E.login))]})]}),b.jsxs("label",{className:"hidden cursor-pointer items-center gap-2 text-xs sm:flex",title:e("filters.viboraReposOnly"),children:[b.jsx($o,{checked:o,onCheckedChange:l,disabled:!!u}),b.jsx("span",{className:"text-muted-foreground",children:e("filters.viboraReposOnly")})]})]})]}),b.jsx(ci,{value:"prs",className:"flex-1 overflow-auto p-4",children:b.jsx(KIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),b.jsx(ci,{value:"issues",className:"flex-1 overflow-auto p-4",children:b.jsx(GIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function pae(){const e=Ri(),t=Um();return{openInTerminal:k.useCallback((r,i)=>{if(At.ws.info("useOpenInTerminal: openInTerminal called",{directory:r,name:i,connected:t.connected,tabCount:t.tabs.items.length,terminalCount:t.terminals.items.length}),!t.connected){At.ws.warn("useOpenInTerminal: not connected, aborting"),kt.error("Terminal not connected",{description:"Please wait for the connection to establish"});return}const a=t.terminals.items.find(o=>o.cwd===r);if(a){if(a.tabId){At.ws.info("useOpenInTerminal: navigating to terminal tab",{terminalId:a.id,tabId:a.tabId}),e({to:"/terminals",search:{tab:a.tabId}});return}At.ws.info("useOpenInTerminal: adopting orphan terminal into new tab",{terminalId:a.id,name:i,directory:r}),t.createTab(i,void 0,r,a.id),e({to:"/terminals",search:{tab:t.pendingTabCreation}});return}const s=t.tabs.items.find(o=>o.directory===r);if(s){At.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:s.id}),e({to:"/terminals",search:{tab:s.id}});return}At.ws.info("useOpenInTerminal: creating new tab",{name:i,directory:r}),t.createTab(i,void 0,r),e({to:"/terminals",search:{tab:t.pendingTabCreation}})},[t,e]),connected:t.connected}}function QIe({delay:e=0,...t}){return b.jsx(Cxe,{"data-slot":"tooltip-provider",delay:e,...t})}function JIe({...e}){return b.jsx(QIe,{children:b.jsx(mxe,{"data-slot":"tooltip",...e})})}function eDe({...e}){return b.jsx(yxe,{"data-slot":"tooltip-trigger",...e})}function tDe({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...s}){return b.jsx(Exe,{children:b.jsx(Sxe,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:b.jsxs(wxe,{"data-slot":"tooltip-content",className:Be("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs **:data-[slot=kbd]:rounded-md bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",e),...s,children:[a,b.jsx(Txe,{className:"size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const mae="";function nDe(e){return qn({queryKey:["copier-questions",e],queryFn:()=>zt(`${mae}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function rDe(){const{data:e,...t}=t0();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function iDe(){const e=wr();return Fn({mutationFn:t=>zt(`${mae}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function aDe(){const{t:e}=rn("repositories"),t=Ri(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,E]=k.useState(""),[S,g]=k.useState({}),[y,v]=k.useState(""),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(!1),[N,D]=k.useState(!1),{data:L}=rDe(),{data:z}=iw(),M=d||m,{data:V,isLoading:H,error:B}=nDe(i==="questions"||i==="output"?M:null),q=iDe();k.useEffect(()=>{n&&(a("template"),p(""),E(""),g({}),v(z||""),T(""),C(null),O(!1),D(!1))},[n,z]),k.useEffect(()=>{V?.questions&&g(G=>{const Z={...G};for(const ee of V.questions)Z[ee.name]===void 0&&ee.default!==void 0&&(Z[ee.name]=ee.default);return Z})},[V]);const K=k.useCallback(()=>{const G=f.current;if(!G)return;const Z=G.scrollHeight>G.clientHeight&&G.scrollTop+G.clientHeight<G.scrollHeight-10;u(Z)},[]);k.useEffect(()=>{const G=setTimeout(K,100);return()=>clearTimeout(G)},[i,V,K]);const U=k.useCallback(()=>{K()},[K]),j=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},$=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},Y=()=>{a("creating"),C(null),q.mutate({templateSource:M,outputPath:y,answers:S,projectName:x,trust:R},{onSuccess:G=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:G.repositoryId}})},onError:G=>{C(G.message),(G.message.includes("unsafe")||G.message.includes("--trust"))&&D(!0),a("output")}})},W=G=>{const Z=S[G.name],ee=ye=>g(Ee=>({...Ee,[G.name]:ye})),te=G.default===void 0||typeof G.default=="string"&&G.default.includes("{{")?`${G.name} *`:G.name;switch(G.type){case"bool":return b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(hi,{checked:Z,onCheckedChange:ee}),b.jsx(ar,{className:"cursor-pointer",children:te})]}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);case"int":case"float":return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsx(dn,{type:"number",value:Z,onChange:ye=>ee(G.type==="int"?parseInt(ye.target.value):parseFloat(ye.target.value)),step:G.type==="float"?"any":1}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);default:{if(G.choices&&G.choices.length>0)return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsxs(Bi,{value:String(Z??""),onValueChange:ee,children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{})}),b.jsx(zi,{children:G.choices.map(Ee=>b.jsx(Cn,{value:String(Ee.value),children:Ee.label},String(Ee.value)))})]}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);const ye=G.type==="yaml"||G.type==="json";return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),ye?b.jsx(_M,{value:String(Z??""),onChange:Ee=>ee(Ee.target.value),rows:4}):b.jsx(dn,{value:String(Z??""),onChange:Ee=>ee(Ee.target.value)}),G.help&&b.jsx(Ya,{children:G.help})]},G.name)}}},J=!!M,ae=V?.questions.filter(G=>{if(G.default!==void 0&&!(typeof G.default=="string"&&G.default.includes("{{")))return!1;const ee=S[G.name];return ee==null||ee===""})??[],se=V&&!H&&ae.length===0,Q=x.trim()&&y.trim();return b.jsxs(b.Fragment,{children:[b.jsxs(ed,{open:n,onOpenChange:r,children:[b.jsxs(Mte,{render:b.jsx(qe,{variant:"outline",size:"sm"}),children:[b.jsx(fe,{icon:P1e,size:16,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),b.jsxs(td,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[b.jsxs(Gf,{className:"shrink-0",children:[b.jsxs(qf,{className:"flex items-center gap-2",children:[e("newProject.title"),b.jsxs(JIe,{children:[b.jsx(eDe,{className:"text-muted-foreground hover:text-foreground transition-colors",children:b.jsx(fe,{icon:gte,size:16,strokeWidth:2})}),b.jsx(tDe,{side:"bottom",align:"start",className:"max-w-xs",children:b.jsxs("p",{children:[e("newProject.steps.template.help")," ",b.jsx("a",{href:"https://copier.readthedocs.io/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:opacity-80",children:e("newProject.steps.template.learnMore")})]})})]})]}),b.jsxs(Zx,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),b.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((G,Z)=>b.jsx("div",{className:Be("flex-1 h-1 rounded",i===G||["template","questions","output"].indexOf(i)>Z||i==="creating"?"bg-primary":"bg-muted")},G))}),b.jsxs("div",{ref:f,onScroll:U,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&b.jsxs(mf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.savedTemplates")}),b.jsxs(Bi,{value:d,onValueChange:G=>{p(G??""),E("")},children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{children:d?L?.find(G=>G.id===d)?.displayName:b.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),b.jsx(zi,{children:L?.map(G=>b.jsx(Cn,{value:G.id,children:G.displayName},G.id))})]})]}),b.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.customUrl")}),b.jsx(dn,{value:m,onChange:G=>{E(G.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),b.jsx(Ya,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&b.jsxs(mf,{children:[H&&b.jsx("div",{className:"flex items-center justify-center py-8",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),B&&b.jsx("div",{className:"text-destructive text-sm py-4",children:B.message}),V?.questions.map(W),V&&V.questions.length===0&&b.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&b.jsxs(mf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.projectName")}),b.jsx(dn,{value:x,onChange:G=>T(G.target.value),placeholder:"my-new-project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.outputDirectory")}),b.jsxs(qe,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2"}),y||e("newProject.steps.output.selectDirectory")]})]}),x&&y&&b.jsxs(Ya,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",y,"/",x]}),w&&b.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w}),N&&b.jsx(ir,{children:b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx(hi,{checked:R,onCheckedChange:G=>O(G===!0),className:"mt-0.5"}),b.jsxs("div",{children:[b.jsx(ar,{className:"cursor-pointer",children:e("newProject.steps.output.trustTemplate")}),b.jsx(Ya,{children:e("newProject.steps.output.trustWarning")})]})]})})]}),i==="creating"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[b.jsx(fe,{icon:tn,size:32,strokeWidth:2,className:"animate-spin text-primary"}),b.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&b.jsx("div",{className:"flex justify-center py-1",children:b.jsx(fe,{icon:pM,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),b.jsxs(Df,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&b.jsxs(qe,{variant:"outline",onClick:$,children:[b.jsx(fe,{icon:ute,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&b.jsx(Fp,{render:b.jsx(qe,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&b.jsxs(qe,{onClick:j,disabled:!J,children:[e("newProject.next"),b.jsx(fe,{icon:iz,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&b.jsxs(qe,{onClick:j,disabled:!se,children:[e("newProject.next"),b.jsx(fe,{icon:iz,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&b.jsx(qe,{onClick:Y,disabled:!Q||q.isPending,children:e("newProject.create")})]})]})]}),b.jsx(gf,{open:s,onOpenChange:o,onSelect:G=>v(G),initialPath:z||void 0})]})}function WH(e){return e.startsWith("git@")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("gh:")||e.startsWith("gl:")||e.startsWith("bb:")}function sDe(e){const t=e.replace(/\.git$/,"");if(t.startsWith("git@")){const n=t.match(/:([^/]+\/)?([^/]+)$/);if(n)return n[2]}else if(t.startsWith("gh:")||t.startsWith("gl:")||t.startsWith("bb:")){const n=t.split("/");if(n.length>0)return n[n.length-1]}else{const n=t.split("/");if(n.length>0)return n[n.length-1]}return t}function oDe({open:e,onOpenChange:t,onSuccess:n,initialTab:r="add"}){const{t:i}=rn("repositories"),[a,s]=k.useState(r),[o,l]=k.useState(""),[u,f]=k.useState(""),[d,p]=k.useState(""),[m,E]=k.useState(null),[S,g]=k.useState(!1),[y,v]=k.useState(!1),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(new Set),[N,D]=k.useState(null),[L,z]=k.useState(!1),{data:M}=iw(),V=Une(),H=hwe(),B=mwe(),q=gwe(),K=k.useMemo(()=>WH(o.trim()),[o]),U=k.useMemo(()=>K?sDe(o.trim()):null,[o,K]);k.useEffect(()=>{U&&!d&&p(U)},[U,d]);const j=u.trim()||M||"",$=k.useMemo(()=>{if(!K||!j)return null;const Te=d.trim()||U||"";return Te?`${j}/${Te}`:null},[K,j,d,U]),Y=x.trim()||M||"",W=k.useMemo(()=>w?.filter(Te=>!Te.exists)??[],[w]),J=V.isPending||H.isPending,ae=B.isPending||q.isPending,se=async Te=>{Te.preventDefault(),E(null);const de=o.trim();if(de)if(K){const Ce=d.trim()||void 0,ge=u.trim()||void 0;H.mutate({url:de,targetDir:ge,folderName:Ce},{onSuccess:he=>{pe(),t(!1),n?.(he.id)},onError:he=>{E(he instanceof Error?he.message:i("addModal.cloneFailed"))}})}else{const Ce=de.split("/").pop()||"repo";V.mutate({path:de,displayName:Ce},{onSuccess:ge=>{pe(),t(!1),n?.(ge.id)},onError:ge=>{E(ge instanceof Error?ge.message:i("addModal.createFailed"))}})}},Q=Te=>{l(Te),g(!1)},G=Te=>{f(Te),v(!1)},Z=()=>{D(null),C(null),O(new Set),B.mutate(Y||void 0,{onSuccess:Te=>{C(Te.repositories);const de=Te.repositories.filter(Ce=>!Ce.exists);O(new Set(de.map(Ce=>Ce.path)))},onError:Te=>{D(Te instanceof Error?Te.message:i("bulkAdd.scanFailed"))}})},ee=Te=>{T(Te),z(!1),C(null),O(new Set)},ne=Te=>{O(de=>{const Ce=new Set(de);return Ce.has(Te)?Ce.delete(Te):Ce.add(Te),Ce})},te=()=>{O(new Set(W.map(Te=>Te.path)))},ye=()=>{O(new Set)},Ee=()=>{if(R.size===0)return;const Te=Array.from(R).map(de=>{const Ce=w?.find(ge=>ge.path===de);return{path:de,displayName:Ce?.name}});q.mutate(Te,{onSuccess:()=>{_e(),t(!1),n?.("")},onError:de=>{D(de instanceof Error?de.message:i("bulkAdd.addFailed"))}})},pe=()=>{l(""),f(""),p(""),E(null)},_e=()=>{T(""),C(null),O(new Set),D(null)},Se=Te=>{Te||(pe(),_e(),s(r)),t(Te)};return b.jsxs(b.Fragment,{children:[b.jsx(ed,{open:e,onOpenChange:Se,children:b.jsxs(td,{className:"sm:max-w-lg",children:[b.jsxs(Gf,{children:[b.jsx(qf,{children:i("addModal.title")}),b.jsx(Zx,{children:i("addModal.description")})]}),b.jsxs(Zo,{value:a,onValueChange:s,children:[b.jsxs(Qo,{className:"w-full",children:[b.jsx(Wr,{value:"add",className:"flex-1",children:i("addModal.tabs.add")}),b.jsx(Wr,{value:"scan",className:"flex-1",children:i("addModal.tabs.scan")})]}),b.jsx(ci,{value:"add",children:b.jsxs("form",{onSubmit:se,className:"space-y-4 pt-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("addModal.inputLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx(dn,{value:o,onChange:Te=>{l(Te.target.value),E(null),WH(Te.target.value.trim())||p("")},placeholder:i("addModal.inputPlaceholder"),disabled:J,className:"pr-8"}),o&&b.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:b.jsx(fe,{icon:K?bte:Vi,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>g(!0),disabled:J,children:i("addModal.browse")})]})]}),K&&b.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-muted/30 p-3",children:[b.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:i("addModal.cloneOptions")}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs text-muted-foreground",children:i("addModal.targetDirectory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:u,onChange:Te=>f(Te.target.value),placeholder:M||"~/",disabled:J,className:"flex-1 text-xs"}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>v(!0),disabled:J,children:i("addModal.browse")})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs text-muted-foreground",children:i("addModal.folderName")}),b.jsx(dn,{value:d,onChange:Te=>p(Te.target.value),placeholder:U||"",disabled:J,className:"text-xs"})]}),$&&b.jsxs("div",{className:"rounded-md bg-background px-3 py-2 text-xs text-muted-foreground",children:[i("addModal.willCloneTo"),":"," ",b.jsx("span",{className:"font-mono",children:$})]})]}),J&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),i(K?"addModal.cloning":"addModal.adding")]}),m&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:rs,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:m})]}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",disabled:J}),children:i("addModal.cancel")}),b.jsx(qe,{type:"submit",disabled:!o.trim()||J,children:i(m?"addModal.retry":"addModal.add")})]})]})}),b.jsx(ci,{value:"scan",children:b.jsxs("div",{className:"space-y-4 pt-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("bulkAdd.directoryLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:x,onChange:Te=>{T(Te.target.value),D(null),C(null)},placeholder:M||i("bulkAdd.directoryPlaceholder"),disabled:ae,className:"flex-1"}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>z(!0),disabled:ae,children:i("bulkAdd.browse")}),b.jsxs(qe,{type:"button",size:"sm",onClick:Z,disabled:ae||!Y,children:[B.isPending?b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:Gx,size:16,strokeWidth:2}),i("bulkAdd.scan")]})]})]}),w!==null&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("bulkAdd.foundRepos",{count:w.length})}),W.length>0&&b.jsxs("div",{className:"flex gap-2 text-xs",children:[b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:te,disabled:ae,children:i("bulkAdd.selectAll")}),b.jsx("span",{className:"text-muted-foreground",children:"/"}),b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:ye,disabled:ae,children:i("bulkAdd.selectNone")})]})]}),w.length===0?b.jsx("div",{className:"rounded-md bg-muted/50 px-3 py-4 text-center text-sm text-muted-foreground",children:i("bulkAdd.noReposFound")}):b.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:w.map(Te=>b.jsxs("div",{className:`flex items-center gap-3 border-b px-3 py-2 last:border-b-0 ${Te.exists?"bg-muted/30 opacity-60":""}`,children:[b.jsx(hi,{checked:R.has(Te.path),onCheckedChange:()=>ne(Te.path),disabled:Te.exists||ae}),b.jsx(fe,{icon:Te.exists?fte:Vi,size:16,strokeWidth:2,className:Te.exists?"text-green-500":"text-muted-foreground"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("div",{className:"truncate text-sm font-medium",children:Te.name}),b.jsx("div",{className:"truncate text-xs text-muted-foreground",children:Te.path})]}),Te.exists&&b.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:i("bulkAdd.alreadyAdded")})]},Te.path))})]}),q.isPending&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),i("bulkAdd.adding")]}),N&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:rs,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:N})]}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",disabled:ae}),children:i("bulkAdd.cancel")}),b.jsx(qe,{onClick:Ee,disabled:R.size===0||ae,children:i("bulkAdd.addSelected",{count:R.size})})]})]})})]})]})}),b.jsx(gf,{open:S,onOpenChange:g,onSelect:Q,initialPath:M||void 0}),b.jsx(gf,{open:y,onOpenChange:v,onSelect:G,initialPath:j||void 0}),b.jsx(gf,{open:L,onOpenChange:z,onSelect:ee,initialPath:Y||void 0})]})}function gae({repository:e,open:t,onOpenChange:n,onDelete:r}){const{t:i}=rn("repositories"),[a,s]=k.useState(!1),[o,l]=k.useState(!1),u=async()=>{s(!0);try{await r(o),n(!1)}catch{}finally{s(!1)}},f=d=>{n(d),d||l(!1)};return e?b.jsx(go,{open:t,onOpenChange:f,children:b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:i("delete.title")}),b.jsx(Eo,{children:i("delete.description",{name:e.displayName})})]}),b.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-destructive/50 bg-destructive/10 p-3",children:[b.jsx(hi,{id:`delete-dir-${e.id}`,checked:o,onCheckedChange:d=>l(d===!0),disabled:a,className:"border-destructive/50 data-[state=checked]:bg-destructive data-[state=checked]:border-destructive mt-0.5"}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{htmlFor:`delete-dir-${e.id}`,className:"text-sm font-medium leading-none cursor-pointer",children:i("delete.alsoDeleteDirectory")}),b.jsx("p",{className:"text-xs text-muted-foreground",children:i("delete.deleteDirectoryWarning")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:a,children:i("addModal.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:u,disabled:a,className:"gap-2",children:[a&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),i(a?"delete.deleting":"delete.button")]})]})]})}):null}const lDe=js("/repositories/")({component:dDe});function uDe({repository:e,onStartTask:t,onOpenInTerminal:n,onViewTasks:r,onDeleteClick:i}){const{t:a}=rn("repositories"),{data:s}=LM(),{data:o}=PM(),{data:l}=MM(),u=()=>{const f=Gie(e.path,s,o,l);Bc(f)};return b.jsxs(wa,{className:"h-full group transition-colors hover:border-foreground/20",children:[b.jsx(Ai,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:b.jsx(Mf,{className:"flex flex-col gap-3 py-4",children:b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),b.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),b.jsx(Mf,{className:"pt-0 pb-4 px-6",children:b.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[b.jsxs(qe,{variant:"outline",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:bM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:jp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[b.jsx(fe,{icon:Wx,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:u,className:"text-muted-foreground hover:text-foreground max-sm:hidden",title:a("openInEditor",{editor:_Ne(s)}),children:[b.jsx(fe,{icon:xte,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{children:a("editor")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-destructive",title:a("delete.button"),children:[b.jsx(fe,{icon:bu,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]})]})})]})}function cDe(){const{t:e}=rn("repositories"),t=Ri(),[n,r]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(qe,{size:"sm",onClick:()=>r(!0),children:[b.jsx(fe,{icon:Nv,size:16,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),b.jsx(oDe,{open:n,onOpenChange:r,onSuccess:i=>{t({to:"/repositories/$repoId",params:{repoId:i}})}})]})}function dDe(){const{t:e}=rn("repositories"),t=Ri(),{data:n,isLoading:r,error:i}=t0(),a=$ne(),[s,o]=k.useState(null),[l,u]=k.useState(null),{openInTerminal:f}=pae(),[d,p]=k.useState(""),m=k.useMemo(()=>n?d?.trim()?n.map(g=>({repo:g,score:Math.max(no(g.displayName,d),no(g.path,d))})).filter(({score:g})=>g>0).sort((g,y)=>y.score-g.score).map(({repo:g})=>g):n:[],[n,d]),E=async g=>{l&&await a.mutateAsync({id:l.id,deleteDirectory:g})},S=g=>{t({to:"/tasks",search:{repo:g}})};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:d,onChange:g=>p(g.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsx("div",{className:"hidden sm:block flex-1"}),b.jsx(cDe,{}),b.jsx(aDe,{})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:rs,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),!r&&!i&&n&&n.length>0&&m.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noMatches")})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map(g=>b.jsx(uDe,{repository:g,onStartTask:()=>o(g),onOpenInTerminal:()=>f(g.path,g.displayName),onViewTasks:()=>S(g.displayName),onDeleteClick:()=>u(g)},g.id))})]}),b.jsx(jM,{open:s!==null,onOpenChange:g=>!g&&o(null),defaultRepository:s??void 0,showTrigger:!1}),b.jsx(gae,{repository:l,open:l!==null,onOpenChange:g=>!g&&u(null),onDelete:E})]})}var $k,VH;function Na(){if(VH)return $k;VH=1;var e=Array.isArray;return $k=e,$k}var zk,GH;function bae(){if(GH)return zk;GH=1;var e=typeof J1=="object"&&J1&&J1.Object===Object&&J1;return zk=e,zk}var Hk,qH;function yl(){if(qH)return Hk;qH=1;var e=bae(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Hk=n,Hk}var Wk,KH;function h0(){if(KH)return Wk;KH=1;var e=yl(),t=e.Symbol;return Wk=t,Wk}var Vk,YH;function fDe(){if(YH)return Vk;YH=1;var e=h0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return Vk=a,Vk}var Gk,XH;function hDe(){if(XH)return Gk;XH=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Gk=n,Gk}var qk,ZH;function Du(){if(ZH)return qk;ZH=1;var e=h0(),t=fDe(),n=hDe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return qk=s,qk}var Kk,QH;function Lu(){if(QH)return Kk;QH=1;function e(t){return t!=null&&typeof t=="object"}return Kk=e,Kk}var Yk,JH;function zm(){if(JH)return Yk;JH=1;var e=Du(),t=Lu(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Yk=r,Yk}var Xk,eW;function d3(){if(eW)return Xk;eW=1;var e=Na(),t=zm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Xk=i,Xk}var Zk,tW;function od(){if(tW)return Zk;tW=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Zk=e,Zk}var Qk,nW;function f3(){if(nW)return Qk;nW=1;var e=Du(),t=od(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Qk=s,Qk}var Jk,rW;function pDe(){if(rW)return Jk;rW=1;var e=yl(),t=e["__core-js_shared__"];return Jk=t,Jk}var eO,iW;function mDe(){if(iW)return eO;iW=1;var e=pDe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return eO=n,eO}var tO,aW;function vae(){if(aW)return tO;aW=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return tO=n,tO}var nO,sW;function gDe(){if(sW)return nO;sW=1;var e=f3(),t=mDe(),n=od(),r=vae(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return nO=d,nO}var rO,oW;function bDe(){if(oW)return rO;oW=1;function e(t,n){return t?.[n]}return rO=e,rO}var iO,lW;function th(){if(lW)return iO;lW=1;var e=gDe(),t=bDe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return iO=n,iO}var aO,uW;function Ew(){if(uW)return aO;uW=1;var e=th(),t=e(Object,"create");return aO=t,aO}var sO,cW;function vDe(){if(cW)return sO;cW=1;var e=Ew();function t(){this.__data__=e?e(null):{},this.size=0}return sO=t,sO}var oO,dW;function yDe(){if(dW)return oO;dW=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return oO=e,oO}var lO,fW;function _De(){if(fW)return lO;fW=1;var e=Ew(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return lO=i,lO}var uO,hW;function EDe(){if(hW)return uO;hW=1;var e=Ew(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return uO=r,uO}var cO,pW;function SDe(){if(pW)return cO;pW=1;var e=Ew(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return cO=n,cO}var dO,mW;function xDe(){if(mW)return dO;mW=1;var e=vDe(),t=yDe(),n=_De(),r=EDe(),i=SDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,dO=a,dO}var fO,gW;function wDe(){if(gW)return fO;gW=1;function e(){this.__data__=[],this.size=0}return fO=e,fO}var hO,bW;function h3(){if(bW)return hO;bW=1;function e(t,n){return t===n||t!==t&&n!==n}return hO=e,hO}var pO,vW;function Sw(){if(vW)return pO;vW=1;var e=h3();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return pO=t,pO}var mO,yW;function TDe(){if(yW)return mO;yW=1;var e=Sw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return mO=r,mO}var gO,_W;function CDe(){if(_W)return gO;_W=1;var e=Sw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return gO=t,gO}var bO,EW;function ADe(){if(EW)return bO;EW=1;var e=Sw();function t(n){return e(this.__data__,n)>-1}return bO=t,bO}var vO,SW;function kDe(){if(SW)return vO;SW=1;var e=Sw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return vO=t,vO}var yO,xW;function xw(){if(xW)return yO;xW=1;var e=wDe(),t=TDe(),n=CDe(),r=ADe(),i=kDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,yO=a,yO}var _O,wW;function p3(){if(wW)return _O;wW=1;var e=th(),t=yl(),n=e(t,"Map");return _O=n,_O}var EO,TW;function ODe(){if(TW)return EO;TW=1;var e=xDe(),t=xw(),n=p3();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return EO=r,EO}var SO,CW;function RDe(){if(CW)return SO;CW=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return SO=e,SO}var xO,AW;function ww(){if(AW)return xO;AW=1;var e=RDe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return xO=t,xO}var wO,kW;function NDe(){if(kW)return wO;kW=1;var e=ww();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return wO=t,wO}var TO,OW;function IDe(){if(OW)return TO;OW=1;var e=ww();function t(n){return e(this,n).get(n)}return TO=t,TO}var CO,RW;function DDe(){if(RW)return CO;RW=1;var e=ww();function t(n){return e(this,n).has(n)}return CO=t,CO}var AO,NW;function LDe(){if(NW)return AO;NW=1;var e=ww();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return AO=t,AO}var kO,IW;function m3(){if(IW)return kO;IW=1;var e=ODe(),t=NDe(),n=IDe(),r=DDe(),i=LDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,kO=a,kO}var OO,DW;function yae(){if(DW)return OO;DW=1;var e=m3(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,OO=n,OO}var RO,LW;function PDe(){if(LW)return RO;LW=1;var e=yae(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return RO=n,RO}var NO,PW;function MDe(){if(PW)return NO;PW=1;var e=PDe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return NO=r,NO}var IO,MW;function g3(){if(MW)return IO;MW=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return IO=e,IO}var DO,jW;function jDe(){if(jW)return DO;jW=1;var e=h0(),t=g3(),n=Na(),r=zm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return DO=s,DO}var LO,FW;function _ae(){if(FW)return LO;FW=1;var e=jDe();function t(n){return n==null?"":e(n)}return LO=t,LO}var PO,BW;function Eae(){if(BW)return PO;BW=1;var e=Na(),t=d3(),n=MDe(),r=_ae();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return PO=i,PO}var MO,UW;function Tw(){if(UW)return MO;UW=1;var e=zm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return MO=t,MO}var jO,$W;function b3(){if($W)return jO;$W=1;var e=Eae(),t=Tw();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return jO=n,jO}var FO,zW;function Sae(){if(zW)return FO;zW=1;var e=b3();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return FO=t,FO}var FDe=Sae();const Ps=Sn(FDe);var BO,HW;function BDe(){if(HW)return BO;HW=1;function e(t){return t==null}return BO=e,BO}var UDe=BDe();const hn=Sn(UDe);var UO,WW;function $De(){if(WW)return UO;WW=1;var e=Du(),t=Na(),n=Lu(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return UO=i,UO}var zDe=$De();const Ff=Sn(zDe);var HDe=f3();const Gt=Sn(HDe);var WDe=od();const Hm=Sn(WDe);var $O={exports:{}},Dn={};var VW;function VDe(){if(VW)return Dn;VW=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),E;E=Symbol.for("react.module.reference");function S(g){if(typeof g=="object"&&g!==null){var y=g.$$typeof;switch(y){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return y}}case t:return y}}}return Dn.ContextConsumer=s,Dn.ContextProvider=a,Dn.Element=e,Dn.ForwardRef=l,Dn.Fragment=n,Dn.Lazy=p,Dn.Memo=d,Dn.Portal=t,Dn.Profiler=i,Dn.StrictMode=r,Dn.Suspense=u,Dn.SuspenseList=f,Dn.isAsyncMode=function(){return!1},Dn.isConcurrentMode=function(){return!1},Dn.isContextConsumer=function(g){return S(g)===s},Dn.isContextProvider=function(g){return S(g)===a},Dn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Dn.isForwardRef=function(g){return S(g)===l},Dn.isFragment=function(g){return S(g)===n},Dn.isLazy=function(g){return S(g)===p},Dn.isMemo=function(g){return S(g)===d},Dn.isPortal=function(g){return S(g)===t},Dn.isProfiler=function(g){return S(g)===i},Dn.isStrictMode=function(g){return S(g)===r},Dn.isSuspense=function(g){return S(g)===u},Dn.isSuspenseList=function(g){return S(g)===f},Dn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===E||g.getModuleId!==void 0)},Dn.typeOf=S,Dn}var GW;function GDe(){return GW||(GW=1,$O.exports=VDe()),$O.exports}var qDe=GDe(),zO,qW;function xae(){if(qW)return zO;qW=1;var e=Du(),t=Lu(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return zO=r,zO}var HO,KW;function KDe(){if(KW)return HO;KW=1;var e=xae();function t(n){return e(n)&&n!=+n}return HO=t,HO}var YDe=KDe();const Wm=Sn(YDe);var XDe=xae();const ZDe=Sn(XDe);var Ea=function(t){return t===0?0:t>0?1:-1},tf=function(t){return Ff(t)&&t.indexOf("%")===t.length-1},at=function(t){return ZDe(t)&&!Wm(t)},QDe=function(t){return hn(t)},ni=function(t){return at(t)||Ff(t)},JDe=0,p0=function(t){var n=++JDe;return"".concat(t||"").concat(n)},so=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Ff(t))return r;var a;if(tf(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return Wm(a)&&(a=r),i&&a>n&&(a=n),a},Ec=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},eLe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},ea=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function uS(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Ps(r,t))===n})}var tLe=function(t,n){return at(t)&&at(n)?t-n:Ff(t)&&Ff(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Tp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function AD(e){"@babel/helpers - typeof";return AD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},AD(e)}var nLe=["viewBox","children"],rLe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],YW=["points","pathLength"],WO={svg:nLe,polygon:YW,polyline:YW},v3=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],cS=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Hm(r))return null;var i={};return Object.keys(r).forEach(function(a){v3.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},iLe=function(t,n,r){return function(i){return t(n,r,i),null}},qc=function(t,n,r){if(!Hm(t)||AD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];v3.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=iLe(s,n,r))}),i},aLe=["children"],sLe=["children"];function XW(e,t){if(e==null)return{};var n=oLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kD(e){"@babel/helpers - typeof";return kD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kD(e)}var ZW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},du=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},QW=null,VO=null,y3=function e(t){if(t===QW&&Array.isArray(VO))return VO;var n=[];return k.Children.forEach(t,function(r){hn(r)||(qDe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),VO=n,QW=t,n};function Ms(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return du(i)}):r=[du(t)],y3(e).forEach(function(i){var a=Ps(i,"type.displayName")||Ps(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function qa(e,t){var n=Ms(e,t);return n&&n[0]}var JW=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},lLe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],uLe=function(t){return t&&t.type&&Ff(t.type)&&lLe.indexOf(t.type)>=0},cLe=function(t){return t&&kD(t)==="object"&&"clipDot"in t},dLe=function(t,n,r,i){var a,s=(a=WO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Gt(t)&&(i&&s.includes(n)||rLe.includes(n))||r&&v3.includes(n)},Lt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Hm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;dLe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},OD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return eV(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!eV(a,s))return!1}return!0},eV=function(t,n){if(hn(t)&&hn(n))return!0;if(!hn(t)&&!hn(n)){var r=t.props||{},i=r.children,a=XW(r,aLe),s=n.props||{},o=s.children,l=XW(s,sLe);return i&&o?Tp(a,l)&&OD(i,o):!i&&!o?Tp(a,l):!1}return!1},tV=function(t,n){var r=[],i={};return y3(t).forEach(function(a,s){if(uLe(a))r.push(a);else if(a){var o=du(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},fLe=function(t){var n=t&&t.type;return n&&ZW[n]?ZW[n]:null},hLe=function(t,n){return y3(n).indexOf(t)},pLe=["children","width","height","viewBox","className","style","title","desc"];function RD(){return RD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RD.apply(this,arguments)}function mLe(e,t){if(e==null)return{};var n=gLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ND(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=mLe(e,pLe),f=i||{width:n,height:r,x:0,y:0},d=Qt("recharts-surface",a);return oe.createElement("svg",RD({},Lt(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var bLe=["children","className"];function ID(){return ID=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ID.apply(this,arguments)}function vLe(e,t){if(e==null)return{};var n=yLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var xn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=vLe(e,bLe),a=Qt("recharts-layer",r);return oe.createElement("g",ID({className:a},Lt(i,!0),{ref:t}),n)}),fu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},GO,nV;function _Le(){if(nV)return GO;nV=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return GO=e,GO}var qO,rV;function ELe(){if(rV)return qO;rV=1;var e=_Le();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return qO=t,qO}var KO,iV;function wae(){if(iV)return KO;iV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return KO=l,KO}var YO,aV;function SLe(){if(aV)return YO;aV=1;function e(t){return t.split("")}return YO=e,YO}var XO,sV;function xLe(){if(sV)return XO;sV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",E=u+"?",S="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+S+E+")*",y=S+E+g,v="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+v+y,"g");function T(w){return w.match(x)||[]}return XO=T,XO}var ZO,oV;function wLe(){if(oV)return ZO;oV=1;var e=SLe(),t=wae(),n=xLe();function r(i){return t(i)?n(i):e(i)}return ZO=r,ZO}var QO,lV;function TLe(){if(lV)return QO;lV=1;var e=ELe(),t=wae(),n=wLe(),r=_ae();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return QO=i,QO}var JO,uV;function CLe(){if(uV)return JO;uV=1;var e=TLe(),t=e("toUpperCase");return JO=t,JO}var ALe=CLe();const Cw=Sn(ALe);function Zn(e){return function(){return e}}const Tae=Math.cos,dS=Math.sin,Oo=Math.sqrt,fS=Math.PI,Aw=2*fS,DD=Math.PI,LD=2*DD,zd=1e-6,kLe=LD-zd;function Cae(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function OLe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Cae;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class RLe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Cae:OLe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>zd)if(!(Math.abs(d*l-u*f)>zd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,E=i-o,S=l*l+u*u,g=m*m+E*E,y=Math.sqrt(S),v=Math.sqrt(p),x=a*Math.tan((DD-Math.acos((S+p-g)/(2*y*v)))/2),T=x/v,w=x/y;Math.abs(T-1)>zd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*E)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>zd||Math.abs(this._y1-f)>zd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%LD+LD),p>kLe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>zd&&this._append`A${r},${r},0,${+(p>=DD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function _3(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new RLe(t)}function E3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Aae(e){this._context=e}Aae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function kw(e){return new Aae(e)}function kae(e){return e[0]}function Oae(e){return e[1]}function Rae(e,t){var n=Zn(!0),r=null,i=kw,a=null,s=_3(o);e=typeof e=="function"?e:e===void 0?kae:Zn(e),t=typeof t=="function"?t:t===void 0?Oae:Zn(t);function o(l){var u,f=(l=E3(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function N_(e,t,n){var r=null,i=Zn(!0),a=null,s=kw,o=null,l=_3(u);e=typeof e=="function"?e:e===void 0?kae:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Oae:Zn(+n);function u(d){var p,m,E,S=(d=E3(d)).length,g,y=!1,v,x=new Array(S),T=new Array(S);for(a==null&&(o=s(v=l())),p=0;p<=S;++p){if(!(p<S&&i(g=d[p],p,d))===y)if(y=!y)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),E=p-1;E>=m;--E)o.point(x[E],T[E]);o.lineEnd(),o.areaEnd()}y&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(v)return o=null,v+""||null}function f(){return Rae().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class Nae{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function NLe(e){return new Nae(e,!0)}function ILe(e){return new Nae(e,!1)}const S3={draw(e,t){const n=Oo(t/fS);e.moveTo(n,0),e.arc(0,0,n,0,Aw)}},DLe={draw(e,t){const n=Oo(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Iae=Oo(1/3),LLe=Iae*2,PLe={draw(e,t){const n=Oo(t/LLe),r=n*Iae;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},MLe={draw(e,t){const n=Oo(t),r=-n/2;e.rect(r,r,n,n)}},jLe=.8908130915292852,Dae=dS(fS/10)/dS(7*fS/10),FLe=dS(Aw/10)*Dae,BLe=-Tae(Aw/10)*Dae,ULe={draw(e,t){const n=Oo(t*jLe),r=FLe*n,i=BLe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=Aw*a/5,o=Tae(s),l=dS(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},eR=Oo(3),$Le={draw(e,t){const n=-Oo(t/(eR*3));e.moveTo(0,n*2),e.lineTo(-eR*n,-n),e.lineTo(eR*n,-n),e.closePath()}},vs=-.5,ys=Oo(3)/2,PD=1/Oo(12),zLe=(PD/2+1)*3,HLe={draw(e,t){const n=Oo(t/zLe),r=n/2,i=n*PD,a=r,s=n*PD+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(vs*r-ys*i,ys*r+vs*i),e.lineTo(vs*a-ys*s,ys*a+vs*s),e.lineTo(vs*o-ys*l,ys*o+vs*l),e.lineTo(vs*r+ys*i,vs*i-ys*r),e.lineTo(vs*a+ys*s,vs*s-ys*a),e.lineTo(vs*o+ys*l,vs*l-ys*o),e.closePath()}};function WLe(e,t){let n=null,r=_3(i);e=typeof e=="function"?e:Zn(e||S3),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function hS(){}function pS(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Lae(e){this._context=e}Lae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:pS(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VLe(e){return new Lae(e)}function Pae(e){this._context=e}Pae.prototype={areaStart:hS,areaEnd:hS,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GLe(e){return new Pae(e)}function Mae(e){this._context=e}Mae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qLe(e){return new Mae(e)}function jae(e){this._context=e}jae.prototype={areaStart:hS,areaEnd:hS,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function KLe(e){return new jae(e)}function cV(e){return e<0?-1:1}function dV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(cV(a)+cV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function fV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function tR(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function mS(e){this._context=e}mS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:tR(this,this._t0,fV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,tR(this,fV(this,n=dV(this,e,t)),n);break;default:tR(this,this._t0,n=dV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Fae(e){this._context=new Bae(e)}(Fae.prototype=Object.create(mS.prototype)).point=function(e,t){mS.prototype.point.call(this,t,e)};function Bae(e){this._context=e}Bae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function YLe(e){return new mS(e)}function XLe(e){return new Fae(e)}function Uae(e){this._context=e}Uae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=hV(e),i=hV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function hV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ZLe(e){return new Uae(e)}function Ow(e,t){this._context=e,this._t=t}Ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function QLe(e){return new Ow(e,.5)}function JLe(e){return new Ow(e,0)}function ePe(e){return new Ow(e,1)}function Xp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function MD(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function tPe(e,t){return e[t]}function nPe(e){const t=[];return t.key=e,t}function rPe(){var e=Zn([]),t=MD,n=Xp,r=tPe;function i(a){var s=Array.from(e.apply(this,arguments),nPe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=E3(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?MD:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Xp,i):n},i}function iPe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Xp(e,t)}}function aPe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Xp(e,t)}}function sPe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,E=0;E<o;++E){var S=e[t[E]],g=S[r][1]||0,y=S[r-1][1]||0;m+=g-y}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Xp(e,t)}}function Wv(e){"@babel/helpers - typeof";return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wv(e)}var oPe=["type","size","sizeType"];function jD(){return jD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jD.apply(this,arguments)}function pV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pV(Object(n),!0).forEach(function(r){lPe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lPe(e,t,n){return t=uPe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uPe(e){var t=cPe(e,"string");return Wv(t)=="symbol"?t:t+""}function cPe(e,t){if(Wv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dPe(e,t){if(e==null)return{};var n=fPe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $ae={symbolCircle:S3,symbolCross:DLe,symbolDiamond:PLe,symbolSquare:MLe,symbolStar:ULe,symbolTriangle:$Le,symbolWye:HLe},hPe=Math.PI/180,pPe=function(t){var n="symbol".concat(Cw(t));return $ae[n]||S3},mPe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*hPe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},gPe=function(t,n){$ae["symbol".concat(Cw(t))]=n},x3=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=dPe(t,oPe),u=mV(mV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=pPe(r),y=WLe().type(g).size(mPe(a,o,r));return y()},d=u.className,p=u.cx,m=u.cy,E=Lt(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",jD({},E,{className:Qt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};x3.registerSymbol=gPe;function Zp(e){"@babel/helpers - typeof";return Zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zp(e)}function FD(){return FD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},FD.apply(this,arguments)}function gV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bPe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gV(Object(n),!0).forEach(function(r){Vv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yPe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Hae(r.key),r)}}function _Pe(e,t,n){return t&&yPe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function EPe(e,t,n){return t=gS(t),SPe(e,zae()?Reflect.construct(t,n||[],gS(e).constructor):t.apply(e,n))}function SPe(e,t){if(t&&(Zp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xPe(e)}function xPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zae=function(){return!!e})()}function gS(e){return gS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gS(e)}function wPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BD(e,t)}function BD(e,t){return BD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},BD(e,t)}function Vv(e,t,n){return t=Hae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hae(e){var t=TPe(e,"string");return Zp(t)=="symbol"?t:t+""}function TPe(e,t){if(Zp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _s=32,w3=(function(e){function t(){return vPe(this,t),EPe(this,t,arguments)}return wPe(t,e),_Pe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=_s/2,s=_s/6,o=_s/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:_s,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
|
|
46
|
+
${e.directory}`:e.name,children:[f&&b.jsx("div",{className:Be("absolute top-0 bottom-0 w-0.5 bg-primary z-10",f==="left"&&"-left-1",f==="right"&&"-right-1")}),e.directory&&b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0 opacity-60"}),e.name,n&&b.jsx("button",{onClick:S=>{S.stopPropagation(),i()},onPointerDown:S=>S.stopPropagation(),className:"ml-1 rounded opacity-0 hover:bg-muted group-hover:opacity-100",children:b.jsx(fe,{icon:fi,size:12,strokeWidth:2})})]})}function EIe({tabs:e,activeTabId:t,onTabSelect:n,onTabClose:r,onTabCreate:i,onTabEdit:a,onTabReorder:s}){const o=k.useRef(null),l=k.useRef(null),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,E]=k.useState(!0),S=k.useCallback(()=>{const v=o.current;if(!v)return;const{scrollLeft:x,scrollWidth:T,clientWidth:w}=v;f(x>0),p(x+w<T-1)},[]);k.useEffect(()=>{const v=l.current,x=o.current;if(!v||!x)return;const T=new IntersectionObserver(([w])=>{E(w.isIntersecting)},{root:x,threshold:.9});return T.observe(v),()=>T.disconnect()},[]),k.useEffect(()=>{const v=o.current;if(!v)return;S(),v.addEventListener("scroll",S);const x=new ResizeObserver(S);return x.observe(v),()=>{v.removeEventListener("scroll",S),x.disconnect()}},[S]),k.useEffect(()=>{S()},[e,S]);const g=k.useCallback(()=>{o.current?.scrollTo({left:0,behavior:"smooth"})},[]),y=k.useCallback(()=>{const v=o.current;v&&v.scrollTo({left:v.scrollWidth,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex items-center",children:[u&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:g,className:"shrink-0",children:b.jsx(fe,{icon:lte,size:14,strokeWidth:2})}),b.jsxs("div",{ref:o,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-none",children:[e.map(v=>b.jsx(_Ie,{tab:v,isActive:v.id===t,canClose:e.length>1,onSelect:()=>n(v.id),onClose:()=>r(v.id),onEdit:()=>a(v),onReorder:s},v.id)),b.jsx("span",{ref:l,children:b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Nv,size:14,strokeWidth:2})})})]}),d&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:y,className:"shrink-0",children:b.jsx(fe,{icon:Xy,size:14,strokeWidth:2})}),!m&&b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Nv,size:14,strokeWidth:2})})]})}function SIe({tab:e,open:t,onOpenChange:n,onSave:r,onCreate:i,defaultName:a=""}){const{t:s}=rn("terminals"),[o,l]=k.useState(""),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=!e&&i;k.useEffect(()=>{t&&(e?(l(e.name),f(e.directory??null)):(l(a),f(null)))},[t,e,a]);const E=()=>{if(m){i(o.trim(),u??void 0),n(!1);return}if(!e)return;const x={};o.trim()&&o.trim()!==e.name&&(x.name=o.trim()),u!==(e.directory??null)&&(x.directory=u),Object.keys(x).length>0&&r(e.id,x),n(!1)},S=x=>{x.key==="Enter"&&(x.preventDefault(),E())},g=()=>{f(null)},y=x=>{f(x)},v=u?u.split("/").pop():null;return b.jsxs(b.Fragment,{children:[b.jsx(ed,{open:t,onOpenChange:n,children:b.jsxs(td,{className:"sm:max-w-md",children:[b.jsx(Gf,{children:b.jsx(qf,{children:s(m?"newTab.title":"editTab.title")})}),b.jsxs(mf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"tabName",children:s("editTab.name")}),b.jsx(dn,{id:"tabName",value:o,onChange:x=>l(x.target.value),onKeyDown:S,placeholder:s("editTab.namePlaceholder"),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:s("editTab.directory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(qe,{type:"button",variant:"outline",className:"flex-1 justify-start font-normal",onClick:()=>p(!0),children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2 shrink-0"}),v?b.jsx("span",{className:"truncate font-mono text-xs",children:u}):b.jsx("span",{className:"text-muted-foreground",children:s("editTab.directoryPlaceholder")})]}),u&&b.jsx(qe,{type:"button",variant:"ghost",size:"icon",onClick:g,title:s("editTab.clearDirectory"),children:b.jsx(fe,{icon:fi,size:14,strokeWidth:2})})]})]})]}),b.jsxs(Df,{className:"mt-4",children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",type:"button"}),children:s("editTab.cancel")}),b.jsx(qe,{onClick:E,disabled:!o.trim(),children:s(m?"newTab.create":"editTab.save")})]})]})}),b.jsx(gf,{open:d,onOpenChange:p,onSelect:y,initialPath:u??void 0})]})}function UH(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function xIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Mi="all-tasks",$H=["IN_PROGRESS","IN_REVIEW"],zH="vibora:lastTerminalTab",wIe=u0(function(){const{t}=rn("terminals"),n=Ri(),{tab:r,repo:i}=Tx({from:"/terminals/"}),{terminals:a,tabs:s,connected:o,createTerminal:l,destroyTerminal:u,renameTerminal:f,assignTerminalToTab:d,createTab:p,updateTab:m,deleteTab:E,reorderTab:S,attachXterm:g,resizeTerminal:y,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,newTerminalIds:w,pendingTabCreation:C,lastCreatedTabId:R}=bie(),[O,N]=k.useState(null),{getFocusedTerminal:D}=Sie(),L=k.useMemo(()=>s.map(he=>he.id),[s]),z=r&&(L.includes(r)||r===Mi),M=z?r:s[0]?.id??null,V=k.useCallback(he=>{n({to:"/terminals",search:{tab:he,repo:he===Mi?i:void 0},replace:!0})},[n,i]),H=k.useCallback(he=>{n({to:"/terminals",search:ce=>({...ce,repo:he||void 0}),replace:!0})},[n]),B=Um();k.useEffect(()=>zM(()=>({lastCreatedTabId:B.lastCreatedTabId,pendingTabCreation:B.pendingTabCreation}),({lastCreatedTabId:ce})=>{ce&&(At.terminal.info("MobX reaction: lastCreatedTabId changed",{tabId:ce}),V(ce),setTimeout(()=>{B.clearLastCreatedTabId(),se.current++;const Ne=`Terminal ${se.current}`;At.terminal.debug("Creating terminal in new tab",{tabId:ce,name:Ne}),l({name:Ne,cols:80,rows:24,tabId:ce,positionInTab:0})},150))},{fireImmediately:!0}),[B,V,l]),k.useEffect(()=>{if(At.terminal.debug("Redirect effect running",{tabsLength:s.length,isValidTab:z,pendingTabCreation:C,lastCreatedTabId:R}),s.length!==0&&!(C||R)&&!z){const he=localStorage.getItem(zH),ce=he&&(s.some(Ne=>Ne.id===he)||he===Mi)?he:s[0].id;At.terminal.debug("Redirecting to tab",{targetTab:ce}),n({to:"/terminals",search:{tab:ce},replace:!0})}},[s,z,R,C,n]),k.useEffect(()=>{M&&localStorage.setItem(zH,M)},[M]);const{data:q=[],status:K}=DM(),{data:U=[]}=t0(),j=k.useMemo(()=>{const he=new Map;for(const ce of U)he.set(ce.path,ce.id);return he},[U]),$=k.useMemo(()=>new Set(q.filter(he=>$H.includes(he.status)&&he.worktreePath).map(he=>he.worktreePath)),[q]),Y=k.useMemo(()=>new Set(q.filter(he=>he.worktreePath).map(he=>he.worktreePath)),[q]),W=k.useMemo(()=>{const he=new Map;for(const ce of q)ce.worktreePath&&he.set(ce.worktreePath,{taskId:ce.id,repoId:j.get(ce.repoPath),repoName:ce.repoName,title:ce.title,repoPath:ce.repoPath,worktreePath:ce.worktreePath,baseBranch:ce.baseBranch,branch:ce.branch,prUrl:ce.prUrl});return he},[q,j]),J=k.useMemo(()=>{const he=new Set(q.filter(ce=>$H.includes(ce.status)).map(ce=>ce.repoName));return Array.from(he).sort()},[q]),ae=k.useRef(new Map),se=k.useRef(0),Q=k.useRef(!1),G=k.useRef(!1),Z=k.useMemo(()=>M===Mi?a.filter(he=>he.cwd&&$.has(he.cwd)).filter(he=>i?q.find(Ne=>Ne.worktreePath===he.cwd)?.repoName===i:!0).sort((he,ce)=>{const Ne=q.find(ve=>ve.worktreePath===he.cwd),Pe=q.find(ve=>ve.worktreePath===ce.cwd);return!Ne||!Pe?0:new Date(Pe.createdAt).getTime()-new Date(Ne.createdAt).getTime()}).map(UH):a.filter(he=>he.tabId===M).sort((he,ce)=>he.positionInTab-ce.positionInTab).map(UH),[M,a,$,i,q]),ee=k.useCallback(()=>{if(At.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:o,pendingTerminalCreate:Q.current,terminalCount:a.length}),Q.current){At.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,se.current++;const he=`Terminal ${se.current}`,ce=a.filter(Pe=>Pe.tabId===M),Ne=ce.length;At.terminal.info("Creating terminal",{name:he,tabId:M,positionInTab:Ne,terminalsInTabCount:ce.length}),l({name:he,cols:80,rows:24,tabId:M??void 0,positionInTab:Ne}),setTimeout(()=>{Q.current=!1},500)},[l,M,a,o]);k.useEffect(()=>{if(K!=="success"){At.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:K});return}for(const he of a)he.cwd&&Y.has(he.cwd)&&he.tabId&&(At.terminalsView.debug("Removing task terminal from regular tab",{terminalId:he.id,name:he.name,cwd:he.cwd,tabId:he.tabId}),d(he.id,null))},[a,Y,d,K]);const ne=k.useCallback(he=>{const ce=ae.current.get(he);ce&&(ce(),ae.current.delete(he)),u(he,{force:!0,reason:"user_closed"})},[u]),te=k.useCallback((he,ce)=>{const Ne=g(he,ce);ae.current.set(he,Ne),w.has(he)&&setTimeout(()=>{ce.focus()},50)},[g,w]),ye=k.useCallback((he,ce,Ne)=>{y(he,ce,Ne)},[y]),Ee=k.useCallback((he,ce)=>{f(he,ce)},[f]),pe=k.useCallback(()=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0;const he=`Tab ${s.length+1}`;At.terminal.debug("Quick creating tab",{name:he}),p(he,void 0,void 0),setTimeout(()=>{G.current=!1},500)},[p,s.length]),_e=k.useCallback((he,ce)=>{At.terminal.debug("Reordering tab",{tabId:he,newPosition:ce}),S(he,ce)},[S]),Se=k.useCallback((he,ce)=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0,At.terminal.debug("Creating tab",{name:he,directory:ce}),p(he,void 0,ce),setTimeout(()=>{G.current=!1},500)},[p]),Te=k.useCallback(he=>{const ce=a.filter(Ne=>Ne.tabId===he);for(const Ne of ce){const Pe=ae.current.get(Ne.id);Pe&&(Pe(),ae.current.delete(Ne.id))}E(he)},[a,E]),de=s.map(xIe),Ce=k.useCallback(he=>{N(he)},[]),ge=k.useCallback((he,ce)=>{m(he,ce)},[m]);return Va("meta+d",ee,{enabled:M!==Mi&&o,allowInTerminal:!0,deps:[ee,M,o]}),Va("meta+w",()=>{if(M&&M!==Mi){const he=D(M);he&&ne(he)}},{enabled:M!==Mi,allowInTerminal:!0,deps:[M,D,ne]}),b.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[b.jsxs("button",{onClick:()=>V(Mi),className:Be("relative flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===Mi?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===Mi?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:jp,size:12,strokeWidth:2}),b.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),b.jsx("div",{className:"mx-2 h-4 w-px shrink-0 bg-border"}),b.jsx("div",{className:"min-w-0 flex-1",children:b.jsx(EIe,{tabs:de,activeTabId:M??"",onTabSelect:V,onTabClose:Te,onTabCreate:pe,onTabEdit:Ce,onTabReorder:_e})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===Mi&&J.length>1&&b.jsxs(Bi,{value:i??"",onValueChange:he=>H(he||null),children:[b.jsxs($i,{size:"sm",className:"max-sm:w-auto",children:[b.jsx(fe,{icon:pte,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Ui,{children:i||t("allRepos")})]}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"",children:t("allRepos")}),J.map(he=>b.jsx(Cn,{value:he,children:he},he))]})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:ee,disabled:!o||M===Mi,className:"max-sm:px-2 border-transparent text-primary",children:[b.jsx(fe,{icon:Wx,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),b.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:b.jsx(RNe,{terminals:Z,onTerminalClose:M===Mi?void 0:ne,onTerminalAdd:o&&M!==Mi?ee:void 0,onTerminalReady:te,onTerminalResize:ye,onTerminalRename:M===Mi?void 0:Ee,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,taskInfoByCwd:M===Mi?W:void 0})}),b.jsx(SIe,{tab:O,open:O!==null,onOpenChange:he=>{he||N(null)},onSave:ge,onCreate:Se,defaultName:`Tab ${s.length+1}`})]})}),TIe=js("/terminals/")({component:wIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0,repo:typeof e.repo=="string"?e.repo:void 0})});function CIe(){return{x:0,y:0}}function AIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?CIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:Jie,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(d0()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=iae({onDragStart:o,onDrop:o})}var kIe=eh(function(){return d0()&&"ontouchend"in document}),OIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function RIe(e){return function(n){var r=n.container;if(kIe()||rae())return OIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const lae=k.createContext(null);function NIe({children:e}){const[t,n]=k.useState(null);return b.jsx(lae.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function uae(){const e=k.useContext(lae);if(!e)throw new Error("useDrag must be used within DragProvider");return e}const cae=k.createContext(null);function IIe({children:e}){const[t,n]=k.useState(new Set),[r,i]=k.useState(null),a=k.useCallback(u=>{n(f=>{const d=new Set(f);return d.has(u)?d.delete(u):d.add(u),d}),i(u)},[]),s=k.useCallback((u,f)=>{if(!r){n(new Set([u])),i(u);return}const d=f.indexOf(r),p=f.indexOf(u);if(d===-1||p===-1){n(new Set([u])),i(u);return}const[m,E]=d<p?[d,p]:[p,d],S=f.slice(m,E+1);n(g=>{const y=new Set(g);for(const v of S)y.add(v);return y})},[r]),o=k.useCallback(()=>{n(new Set),i(null)},[]),l=k.useCallback(u=>t.has(u),[t]);return b.jsx(cae.Provider,{value:{selectedIds:t,lastSelectedId:r,toggleSelection:a,selectRange:s,clearSelection:o,isSelected:l},children:e})}function c3(){const e=k.useContext(cae);if(!e)throw new Error("useSelection must be used within a SelectionProvider");return e}function DIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function dae({task:e,open:t,onOpenChange:n}){const r=nw(),i=rw(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,E]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),E(e.linearTicketUrl||""),l(!0))},[t,e]);const S=()=>{const v={},x=a.trim();if(!x)return;x!==e.title&&(v.title=x);const T=u.trim();T!==(e.description||"")&&(v.description=T);const w=d.trim();w!==(e.prUrl||"")&&(v.prUrl=w||null);const C=m.trim();C!==(e.linearTicketUrl||"")&&(v.linearTicketUrl=C||null,v.linearTicketId=C?DIe(C):null),Object.keys(v).length>0&&r.mutate({taskId:e.id,updates:v}),n(!1)},g=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),S())},y=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return b.jsx(ed,{open:t,onOpenChange:n,children:b.jsxs(td,{className:"sm:max-w-md",onKeyDown:g,children:[b.jsx(Gf,{children:b.jsx(qf,{children:"Task Settings"})}),b.jsxs(mf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-title",children:"Title"}),b.jsx(dn,{id:"config-title",value:a,onChange:v=>s(v.target.value),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-description",children:"Description"}),b.jsx(Bte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),b.jsx(dn,{id:"config-pr-url",value:d,onChange:v=>p(v.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),b.jsx(dn,{id:"config-linear-url",value:m,onChange:v=>E(v.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),b.jsxs(Df,{className:"mt-4 flex-row justify-between sm:justify-between",children:[b.jsxs(go,{children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:"Delete Task"}),b.jsx(Eo,{children:"This will permanently delete this task. This action cannot be undone."})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(hi,{id:"delete-worktree",checked:o,onCheckedChange:v=>l(v===!0)}),b.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),b.jsxs(yo,{children:[b.jsx(So,{children:"Cancel"}),b.jsx(qp,{onClick:y,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(qe,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),b.jsx(qe,{onClick:S,disabled:!a.trim(),children:"Save"})]})]})]})})}function fae({task:e,isDragPreview:t}){const{setActiveTask:n}=uae(),{isSelected:r,toggleSelection:i}=c3(),a=Ri(),s=r(e.id),o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),[p,m]=k.useState(null),[E,S]=k.useState(!1),g=k.useRef(!1);k.useEffect(()=>{const T=o.current;if(!(!T||t))return f0(aae({element:T,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:w})=>{AIe({nativeSetDragImage:w,getOffset:RIe({x:"16px",y:"8px"}),render:({container:C})=>{m(C)}})},onDragStart:()=>{u(!0),n(e),g.current=!0},onDrop:()=>{u(!1),n(null),m(null)}}),yw({element:T,getData:({input:w,element:C})=>{const R={type:"task",taskId:e.id,status:e.status};return oae(R,{input:w,element:C,allowedEdges:["top","bottom"]})},canDrop:({source:w})=>w.data.taskId!==e.id,onDragEnter:({self:w})=>{d(wp(w.data))},onDrag:({self:w})=>{d(wp(w.data))},onDragLeave:()=>{d(null)},onDrop:()=>{d(null)}}))},[e,t,n]);const y=()=>{g.current=!1},v=()=>{if(g.current){g.current=!1;return}a({to:"/tasks/$taskId",params:{taskId:e.id}}),g.current=!1},x=b.jsxs("div",{className:"group/card relative",children:[!t&&b.jsx("div",{className:Be("absolute left-2 top-2 z-20 transition-opacity",s?"opacity-100":"opacity-0 group-hover/card:opacity-100"),onPointerDown:T=>T.stopPropagation(),children:b.jsx(hi,{checked:s,onCheckedChange:()=>i(e.id)})}),b.jsxs(wa,{ref:t?void 0:o,onPointerDown:y,onClick:v,className:Be("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",l&&"opacity-50",s&&"ring-2 ring-primary bg-primary/5"),children:[f&&b.jsx("div",{className:Be("absolute left-0 right-0 h-0.5 bg-primary z-10",f==="top"&&"-top-1",f==="bottom"&&"-bottom-1")}),b.jsxs(E2e,{className:Be("p-3 pb-1 flex flex-row items-start justify-between gap-2",!t&&"pl-8"),children:[b.jsx(S2e,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&b.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:T=>{T.stopPropagation(),S(!0)},onPointerDown:T=>T.stopPropagation(),children:b.jsx(fe,{icon:eD,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsxs(Mf,{className:"p-3 pt-1",children:[e.description&&b.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),b.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2}),b.jsx("span",{children:e.repoName}),e.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:ou,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:gM,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]})]});return b.jsxs(b.Fragment,{children:[x,p&&xr.createPortal(b.jsx("div",{className:"w-72 max-w-[90vw]",children:b.jsx(fae,{task:e,isDragPreview:!0})}),p),b.jsx(dae,{task:e,open:E,onOpenChange:S})]})}const LIe={IN_PROGRESS:"border-t-status-in-progress",IN_REVIEW:"border-t-status-in-review",DONE:"border-t-status-done",CANCELED:"border-t-status-canceled"};function HH({status:e,tasks:t,isMobile:n}){const{t:r}=rn("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>new Date(u.updatedAt).getTime()-new Date(l.updatedAt).getTime());return k.useEffect(()=>{const l=i.current;if(l)return yw({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),b.jsxs("div",{ref:i,className:Be("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",LIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&b.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[b.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),b.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),b.jsx(n0,{className:"min-h-0 flex-1",children:b.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>b.jsx(fae,{task:l},l.id))})})]})}function PIe(){const{selectedIds:e,clearSelection:t}=c3(),n=Vxe(),[r,i]=k.useState(!0),a=e.size,s=()=>{n.mutate({ids:Array.from(e),deleteLinkedWorktrees:r},{onSuccess:()=>{t()}})};return a===0?null:b.jsx("div",{className:Be("fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 backdrop-blur-sm","animate-in slide-in-from-bottom-2 duration-200"),children:b.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-4 px-4 py-3",children:[b.jsxs("span",{className:"text-sm text-muted-foreground",children:[a," task",a!==1?"s":""," selected"]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(qe,{variant:"ghost",size:"sm",onClick:t,children:"Clear"}),b.jsxs(go,{children:[b.jsx(wu,{render:b.jsx(qe,{variant:"destructive",size:"sm",disabled:n.isPending}),children:n.isPending?"Deleting...":"Delete"}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsxs(_o,{children:["Delete ",a," Task",a!==1?"s":""]}),b.jsxs(Eo,{children:["This will permanently delete ",a," task",a!==1?"s":"",". This action cannot be undone."]})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(hi,{id:"bulk-delete-worktrees",checked:r,onCheckedChange:o=>i(o===!0)}),b.jsx("label",{htmlFor:"bulk-delete-worktrees",className:"cursor-pointer text-sm",children:"Also delete linked worktrees"})]}),b.jsxs(yo,{children:[b.jsx(So,{children:"Cancel"}),b.jsx(qp,{onClick:s,variant:"destructive",disabled:n.isPending,children:n.isPending?"Deleting...":"Delete"})]})]})]})]})]})})}const Uk=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function MIe({status:e}){const{t}=rn("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return yw({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),b.jsx("div",{ref:n,className:Be("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function jIe({repoFilter:e,searchQuery:t}){const{t:n}=rn("common"),{data:r=[],isLoading:i}=DM(),a=Wxe(),{activeTask:s}=uae(),{clearSelection:o,selectedIds:l}=c3(),[u,f]=k.useState("IN_PROGRESS");k.useEffect(()=>{const m=E=>{E.key==="Escape"&&l.size>0&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[o,l.size]);const d=k.useMemo(()=>{let m=r;return e&&(m=m.filter(E=>E.repoName===e)),t?.trim()?m=m.map(E=>({task:E,score:Math.max(no(E.title,t),no(E.description||"",t),no(E.branch||"",t),no(E.linearTicketId||"",t),no(E.prUrl||"",t))})).filter(({score:E})=>E>0).sort((E,S)=>S.score-E.score).map(({task:E})=>E):m=[...m].sort((E,S)=>new Date(S.updatedAt).getTime()-new Date(E.updatedAt).getTime()),m},[r,e,t]),p=k.useMemo(()=>{const m={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const E of d)m[E.status]++;return m},[d]);return k.useEffect(()=>iae({canMonitor:({source:m})=>m.data.type==="task",onDrop:({source:m,location:E})=>{const S=E.current.dropTargets;if(S.length===0)return;const g=m.data.taskId,y=d.find(T=>T.id===g);if(!y)return;const v=S[0],x=v.data;if(x.type==="column"){const T=x.status;if(T!==y.status){const w=d.filter(C=>C.status===T);a.mutate({taskId:g,status:T,position:w.length})}}else if(x.type==="task"){const T=wp(v.data),w=x.status,C=d.filter(N=>N.status===w).sort((N,D)=>N.position-D.position),R=C.findIndex(N=>N.id===x.taskId);let O=R;T==="bottom"&&(O=R+1),y.status===w&&C.findIndex(D=>D.id===g)<R&&(O=Math.max(0,O-1)),(y.status!==w||O!==y.position)&&a.mutate({taskId:g,status:w,position:O})}}}),[d,a]),i?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"border-b bg-background lg:hidden",children:b.jsx(Zo,{value:u,onValueChange:m=>f(m),children:b.jsx(Qo,{variant:"line",className:"w-full justify-start px-4",children:Uk.map(m=>b.jsxs(Wr,{value:m,className:"gap-1.5",children:[b.jsx("span",{className:"truncate",children:n(`statuses.${m}`)}),b.jsx("span",{className:"text-muted-foreground",children:p[m]})]},m))})})}),b.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:Uk.map(m=>b.jsx(HH,{status:m,tasks:d.filter(E=>E.status===m)},m))}),b.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:b.jsx(HH,{status:u,tasks:d.filter(m=>m.status===u),isMobile:!0})}),s&&b.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:Uk.filter(m=>m!==u).map(m=>b.jsx(MIe,{status:m},m))}),b.jsx(PIe,{})]})}function FIe(e){return b.jsx(IIe,{children:b.jsx(NIe,{children:b.jsx(jIe,{...e})})})}const hae=js("/tasks/")({component:BIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function BIe(){const{t:e}=rn("tasks"),{data:t=[]}=DM(),{repo:n}=hae.useSearch(),r=Ri(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsxs(Bi,{value:n??"",onValueChange:l=>s(l||null),children:[b.jsxs($i,{size:"sm",className:"shrink-0 gap-1.5",children:[b.jsx(fe,{icon:pte,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Ui,{children:n??e("allRepos")})]}),b.jsxs(zi,{className:"min-w-[160px]",children:[b.jsx(Cn,{value:"",children:e("allRepos")}),o.map(l=>b.jsx(Cn,{value:l,children:l},l))]})]})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx(FIe,{repoFilter:n??null,searchQuery:i})})]})}function $o({className:e,size:t="default",...n}){return b.jsx(oxe,{"data-slot":"switch","data-size":t,className:Be("data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:b.jsx(lxe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const UIe=js("/settings/")({component:$Ie});function fc({title:e,children:t}){return b.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[b.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function $Ie(){const{t:e}=rn("settings"),{t}=rn("common"),{data:n,isLoading:r}=jne(),{data:i,isLoading:a}=iw(),{data:s,isLoading:o}=LM(),{data:l,isLoading:u}=PM(),{data:f,isLoading:d}=MM(),{data:p,isLoading:m}=Jxe(),{data:E,isLoading:S}=ewe(),{data:g,isLoading:y}=swe(),{data:v,isLoading:x}=uwe(),{data:T}=Bne(),w=dwe(),{savedLanguage:C,changeLanguage:R}=zne(),{theme:O,syncClaudeCode:N,changeTheme:D}=Eie(),{data:L}=rwe(),{data:z}=iwe(),M=Fne(),V=awe(),H=owe(),B=cwe(),q=lwe(),[K,U]=k.useState(""),[j,$]=k.useState(""),[Y,W]=k.useState("vscode"),[J,ae]=k.useState(""),[se,Q]=k.useState(""),[G,Z]=k.useState(""),[ee,ne]=k.useState(""),[te,ye]=k.useState(!1),[Ee,pe]=k.useState(!1),[_e,Se]=k.useState(!1),[Te,de]=k.useState(!1),[Ce,ge]=k.useState(!1),[he,ce]=k.useState(""),[Ne,Pe]=k.useState(!1),[ve,Le]=k.useState(""),[Ae,Ve]=k.useState(!1),[Ze,gt]=k.useState(""),[st,ot]=k.useState(""),[Fe,ht]=k.useState(!1),[Ie,ze]=k.useState(""),[et,lt]=k.useState("glm-4.5-air"),[pt,bn]=k.useState("glm-4.7"),[Bt,It]=k.useState("glm-4.7"),[ct,nn]=k.useState(!1),[Pt,yt]=k.useState("light-ansi"),[Ut,$t]=k.useState("dark-ansi"),[Ht,ft]=k.useState(!1),[yn,mr]=k.useState(!1),[qr,Pr]=k.useState(!1),Yi=k.useRef(null);k.useEffect(()=>{n!==void 0&&U(String(n)),i!==void 0&&$(i),s!==void 0&&W(s),l!==void 0&&ae(l),f!==void 0&&Q(String(f)),p!==void 0&&Z(p),E!==void 0&&ne(E)},[n,i,s,l,f,p,E]),k.useEffect(()=>{g&&(Se(g.enabled),de(g.sound?.enabled??!1),mr(!!g.sound?.customSoundFile),ge(g.slack?.enabled??!1),ce(g.slack?.webhookUrl??""),Pe(g.discord?.enabled??!1),Le(g.discord?.webhookUrl??""),Ve(g.pushover?.enabled??!1),gt(g.pushover?.appToken??""),ot(g.pushover?.userKey??""))},[g]),k.useEffect(()=>{v&&(ht(v.enabled),ze(v.apiKey??""),lt(v.haikuModel),bn(v.sonnetModel),It(v.opusModel))},[v]),k.useEffect(()=>{N!==void 0&&nn(N),L!==void 0&&yt(L),z!==void 0&&$t(z)},[N,L,z]);const Yt=r||a||o||u||d||m||S||y||x,Di=v&&(Fe!==v.enabled||Ie!==(v.apiKey??"")||et!==v.haikuModel||pt!==v.sonnetModel||Bt!==v.opusModel),gr=ct!==(N??!1)||Pt!==L||Ut!==z,br=g&&(_e!==g.enabled||Te!==(g.sound?.enabled??!1)||Ce!==(g.slack?.enabled??!1)||he!==(g.slack?.webhookUrl??"")||Ne!==(g.discord?.enabled??!1)||ve!==(g.discord?.webhookUrl??"")||Ae!==(g.pushover?.enabled??!1)||Ze!==(g.pushover?.appToken??"")||st!==(g.pushover?.userKey??"")),ls=Y!==s||J!==l||se!==String(f),Xi=K!==String(n)||j!==i||G!==p||ee!==E||ls||br||Di||gr,Vs=async()=>{const Ge=[];if(K!==String(n)){const Nt=parseInt(K,10);!isNaN(Nt)&&Nt>=1&&Nt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.PORT,value:Nt},{onSettled:Cr})}))}if(j!==i&&Ge.push(new Promise(Nt=>{M.mutate({key:In.DEFAULT_GIT_REPOS_DIR,value:j},{onSettled:Nt})})),Y!==s&&Ge.push(new Promise(Nt=>{M.mutate({key:In.EDITOR_APP,value:Y},{onSettled:Nt})})),J!==l&&Ge.push(new Promise(Nt=>{M.mutate({key:In.EDITOR_HOST,value:J},{onSettled:Nt})})),se!==String(f)){const Nt=parseInt(se,10);!isNaN(Nt)&&Nt>=1&&Nt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.EDITOR_SSH_PORT,value:Nt},{onSettled:Cr})}))}G!==p&&Ge.push(new Promise(Nt=>{M.mutate({key:In.LINEAR_API_KEY,value:G},{onSettled:Nt})})),ee!==E&&Ge.push(new Promise(Nt=>{M.mutate({key:In.GITHUB_PAT,value:ee},{onSettled:Nt})})),br&&Ge.push(new Promise(Nt=>{H.mutate({enabled:_e,sound:{enabled:Te},slack:{enabled:Ce,webhookUrl:he},discord:{enabled:Ne,webhookUrl:ve},pushover:{enabled:Ae,appToken:Ze,userKey:st}},{onSettled:Nt})})),Di&&Ge.push(new Promise(Nt=>{B.mutate({enabled:Fe,apiKey:Ie||null,haikuModel:et,sonnetModel:pt,opusModel:Bt},{onSettled:Nt})})),gr&&(ct!==(N??!1)&&Ge.push(new Promise(Nt=>{M.mutate({key:In.SYNC_CLAUDE_CODE_THEME,value:ct},{onSettled:Nt})})),Pt!==L&&Ge.push(new Promise(Nt=>{M.mutate({key:In.CLAUDE_CODE_LIGHT_THEME,value:Pt},{onSettled:Nt})})),Ut!==z&&Ge.push(new Promise(Nt=>{M.mutate({key:In.CLAUDE_CODE_DARK_THEME,value:Ut},{onSettled:Nt})}))),await Promise.all(Ge),pe(!0),setTimeout(()=>pe(!1),2e3)},lg=()=>{V.mutate(In.PORT,{onSuccess:Ge=>{Ge.value!==null&&U(String(Ge.value))}})},hd=()=>{V.mutate(In.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ge=>{Ge.value&&$(String(Ge.value))}})},wl=()=>{V.mutate(In.EDITOR_APP,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&W(Ge.value)}})},Tl=()=>{V.mutate(In.EDITOR_HOST,{onSuccess:Ge=>{ae(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Gs=()=>{V.mutate(In.EDITOR_SSH_PORT,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&Q(String(Ge.value))}})},us=()=>{V.mutate(In.LINEAR_API_KEY,{onSuccess:Ge=>{Z(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Cl=()=>{V.mutate(In.GITHUB_PAT,{onSuccess:Ge=>{ne(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Li=async Ge=>{q.mutate(Ge,{onSuccess:Nt=>{Nt.success?kt.success(e("notifications.testSuccess",{channel:Ge})):kt.error(e("notifications.testFailed",{channel:Ge,error:Nt.error}))},onError:Nt=>{kt.error(e("notifications.testFailed",{channel:Ge,error:Nt.message}))}})},Tr=async Ge=>{const Nt=Ge.target.files?.[0];if(Nt){Pr(!0);try{const Cr=new FormData;Cr.append("file",Nt);const Al=await fetch("/api/uploads/sound",{method:"POST",body:Cr});if(!Al.ok){const Da=await Al.json();throw new Error(Da.error||"Upload failed")}mr(!0),kt.success(e("notifications.soundUploaded"))}catch(Cr){kt.error(e("notifications.soundUploadFailed",{error:Cr instanceof Error?Cr.message:"Unknown error"}))}finally{Pr(!1),Yi.current&&(Yi.current.value="")}}},vi=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");mr(!1),kt.success(e("notifications.soundDeleted"))}catch{kt.error(e("notifications.soundDeleteFailed"))}};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:b.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),b.jsx("div",{className:"flex-1 overflow-auto p-6",children:b.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[b.jsx(fc,{title:e("sections.server"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(dn,{type:"number",min:1,max:65535,value:K,onChange:Ge=>U(Ge.target.value),placeholder:"7777",disabled:Yt,className:"w-24 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:lg,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),b.jsx(fc,{title:e("sections.paths"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{value:j,onChange:Ge=>$(Ge.target.value),placeholder:"~/projects",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>ye(!0),disabled:Yt,title:t("buttons.browse"),children:b.jsx(fe,{icon:Vi,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hd,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),b.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[b.jsx(fc,{title:e("sections.editor"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(Bi,{value:Y,onValueChange:Ge=>W(Ge),children:[b.jsx($i,{className:"w-32",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"vscode",children:"VS Code"}),b.jsx(Cn,{value:"cursor",children:"Cursor"}),b.jsx(Cn,{value:"windsurf",children:"Windsurf"}),b.jsx(Cn,{value:"zed",children:"Zed"})]})]}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:wl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{value:J,onChange:Ge=>ae(Ge.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Tl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(dn,{type:"number",min:1,max:65535,value:se,onChange:Ge=>Q(Ge.target.value),placeholder:"22",disabled:Yt,className:"w-20 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Gs,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),b.jsx(fc,{title:e("sections.integrations"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{type:"password",value:G,onChange:Ge=>Z(Ge.target.value),placeholder:"lin_api_...",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:us,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(dn,{type:"password",value:ee,onChange:Ge=>ne(Ge.target.value),placeholder:"ghp_...",disabled:Yt,className:"flex-1 font-mono text-sm"}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Cl,disabled:Yt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),b.jsx(fc,{title:e("sections.zai"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),b.jsx($o,{checked:Fe,onCheckedChange:ht,disabled:Yt})]}),Fe&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),b.jsx(dn,{type:"password",value:Ie,onChange:Ge=>ze(Ge.target.value),placeholder:"zai_...",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),b.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[b.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),b.jsx(dn,{value:et,onChange:Ge=>lt(Ge.target.value),placeholder:"glm-4.5-air",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),b.jsx(dn,{value:pt,onChange:Ge=>bn(Ge.target.value),placeholder:"glm-4.7",disabled:Yt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),b.jsx(dn,{value:Bt,onChange:Ge=>It(Ge.target.value),placeholder:"glm-4.7",disabled:Yt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),b.jsx(fc,{title:e("sections.notifications"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),b.jsx($o,{checked:_e,onCheckedChange:Se,disabled:Yt})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Te,onCheckedChange:de,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx("input",{ref:Yi,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Tr}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Yi.current?.click(),disabled:Yt||!_e||!Te||qr,title:e("notifications.uploadSound"),children:qr?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:q1e,size:14,strokeWidth:2})}),yn&&b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:vi,disabled:Yt||!_e||!Te,title:e("notifications.deleteSound"),children:b.jsx(fe,{icon:bu,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("sound"),disabled:Yt||!_e||!Te||q.isPending,title:e("notifications.testSound"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]})]}),yn&&b.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ce,onCheckedChange:ge,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("slack"),disabled:Yt||!_e||!Ce||!he||q.isPending,title:e("notifications.slack"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ce&&b.jsx(dn,{type:"password",value:he,onChange:Ge=>ce(Ge.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Yt||!_e,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ne,onCheckedChange:Pe,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("discord"),disabled:Yt||!_e||!Ne||!ve||q.isPending,title:e("notifications.discord"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ne&&b.jsx(dn,{type:"password",value:ve,onChange:Ge=>Le(Ge.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Yt||!_e,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{checked:Ae,onCheckedChange:Ve,disabled:Yt||!_e}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),b.jsx(qe,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Li("pushover"),disabled:Yt||!_e||!Ae||!Ze||!st||q.isPending,title:e("notifications.pushover"),children:q.isPending?b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:v_,size:14,strokeWidth:2})})]}),Ae&&b.jsxs("div",{className:"ml-6 space-y-2",children:[b.jsx(dn,{type:"password",value:Ze,onChange:Ge=>gt(Ge.target.value),placeholder:e("notifications.appToken"),disabled:Yt||!_e,className:"flex-1 font-mono text-sm"}),b.jsx(dn,{type:"password",value:st,onChange:Ge=>ot(Ge.target.value),placeholder:e("notifications.userKey"),disabled:Yt||!_e,className:"flex-1 font-mono text-sm"})]})]})]})}),b.jsx(fc,{title:e("sections.appearance"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),b.jsxs(Bi,{value:C??"auto",onValueChange:Ge=>R(Ge==="auto"?null:Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"auto",children:e("fields.language.options.auto")}),b.jsx(Cn,{value:"en",children:e("fields.language.options.en")}),b.jsx(Cn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),b.jsxs(Bi,{value:O??"system",onValueChange:Ge=>D(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"system",children:e("fields.theme.options.system")}),b.jsx(Cn,{value:"light",children:e("fields.theme.options.light")}),b.jsx(Cn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),b.jsx($o,{checked:ct,onCheckedChange:nn})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ct&&b.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),b.jsxs(Bi,{value:Pt,onValueChange:Ge=>yt(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsx(zi,{children:xz.filter(Ge=>Ge.startsWith("light")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),b.jsxs(Bi,{value:Ut,onValueChange:Ge=>$t(Ge),children:[b.jsx($i,{className:"w-40",children:b.jsx(Ui,{})}),b.jsx(zi,{children:xz.filter(Ge=>Ge.startsWith("dark")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]})]})]})}),T?.enabled&&b.jsx(fc,{title:e("sections.developer"),children:b.jsx("div",{className:"space-y-1",children:b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[b.jsx("div",{className:"flex-1",children:b.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:()=>{const Ge=T?.startedAt;ft(!0),w.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Al=0;Al<120;Al++){await new Promise(Da=>setTimeout(Da,500));try{const Da=await fetch("/api/config/developer-mode");if(Da.ok&&(await Da.json()).startedAt!==Ge){window.location.reload();return}}catch{}}ft(!1),kt.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Nt=>{ft(!1),kt.error(e("developer.restartFailed"),{description:Nt.message})}})},disabled:w.isPending||Ht,className:"shrink-0 gap-2",children:[(w.isPending||Ht)&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),e(Ht?"developer.restarting":"developer.restartButton")]})]})})})]})}),b.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:b.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[Ee&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[b.jsx(fe,{icon:pl,size:12,strokeWidth:2}),t("status.saved")]}),b.jsx(qe,{size:"sm",onClick:Vs,disabled:!Xi||Yt||M.isPending,children:t("buttons.save")})]})}),b.jsx(gf,{open:te,onOpenChange:ye,onSelect:Ge=>$(Ge),initialPath:j||void 0})]})}const _w="";function zIe(){return qn({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${_w}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function HIe(){return qn({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${_w}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function WIe(e,t,n){return qn({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${_w}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function VIe(e,t,n){return qn({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${_w}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function GIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=rn("review"),{t:i}=rn("common"),{data:a,isLoading:s,error:o}=WIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:tn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:rs,size:24}),b.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(qIe,{issue:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:pl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function qIe({issue:e}){return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsx(Mf,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function KIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=rn("review"),{t:i}=rn("common"),{data:a,isLoading:s,error:o}=VIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:tn,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:rs,size:24}),b.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(YIe,{pr:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:pl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function YIe({pr:e}){const{t}=rn("review");return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsx(Mf,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&b.jsx(co,{variant:"secondary",className:Be("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&b.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),b.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const XIe=js("/review/")({component:ZIe});function ZIe(){const{t:e}=rn("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=zIe(),{data:m=[]}=HIe();return!p&&!d?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),b.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:b.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[b.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:b.jsx(fe,{icon:U1e,size:24,className:"text-muted-foreground"})}),b.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),b.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),b.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[b.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),b.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:b.jsxs(qe,{variant:"outline",size:"sm",className:"w-full",children:[b.jsx(fe,{icon:$1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),b.jsx(Ai,{to:"/settings",children:b.jsx(qe,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):b.jsx("div",{className:"flex h-full flex-col",children:b.jsxs(Zo,{value:t,onValueChange:E=>n(E),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 flex-col border-b border-border bg-background sm:flex-row sm:items-center sm:justify-between",children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-1 max-sm:px-2",children:[b.jsxs(Qo,{variant:"line",children:[b.jsx(Wr,{value:"prs",children:e("tabs.pullRequests")}),b.jsx(Wr,{value:"issues",children:e("tabs.issues")})]}),b.jsx("label",{className:"flex cursor-pointer items-center gap-2 text-xs sm:hidden",title:e("filters.viboraReposOnly"),children:b.jsx($o,{checked:o,onCheckedChange:l,disabled:!!u})})]}),b.jsxs("div",{className:"flex items-center gap-2 border-t border-border px-4 py-1.5 sm:gap-4 sm:border-t-0 sm:px-4 sm:py-1",children:[t==="prs"?b.jsxs(Bi,{value:r,onValueChange:E=>i(E),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"created",children:e("filters.pr.created")}),b.jsx(Cn,{value:"assigned",children:e("filters.pr.assigned")}),b.jsx(Cn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),b.jsx(Cn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):b.jsxs(Bi,{value:a,onValueChange:E=>s(E),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"assigned",children:e("filters.issue.assigned")}),b.jsx(Cn,{value:"created",children:e("filters.issue.created")}),b.jsx(Cn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),b.jsxs(Bi,{value:u,onValueChange:E=>f(E||""),children:[b.jsx($i,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Ui,{children:u||e("filters.allOrgs")})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"",children:e("filters.allOrganizations")}),m.map(E=>b.jsx(Cn,{value:E.login,children:E.login},E.login))]})]}),b.jsxs("label",{className:"hidden cursor-pointer items-center gap-2 text-xs sm:flex",title:e("filters.viboraReposOnly"),children:[b.jsx($o,{checked:o,onCheckedChange:l,disabled:!!u}),b.jsx("span",{className:"text-muted-foreground",children:e("filters.viboraReposOnly")})]})]})]}),b.jsx(ci,{value:"prs",className:"flex-1 overflow-auto p-4",children:b.jsx(KIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),b.jsx(ci,{value:"issues",className:"flex-1 overflow-auto p-4",children:b.jsx(GIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function pae(){const e=Ri(),t=Um();return{openInTerminal:k.useCallback((r,i)=>{if(At.ws.info("useOpenInTerminal: openInTerminal called",{directory:r,name:i,connected:t.connected,tabCount:t.tabs.items.length,terminalCount:t.terminals.items.length}),!t.connected){At.ws.warn("useOpenInTerminal: not connected, aborting"),kt.error("Terminal not connected",{description:"Please wait for the connection to establish"});return}const a=t.terminals.items.find(o=>o.cwd===r);if(a){if(a.tabId){At.ws.info("useOpenInTerminal: navigating to terminal tab",{terminalId:a.id,tabId:a.tabId}),e({to:"/terminals",search:{tab:a.tabId}});return}At.ws.info("useOpenInTerminal: adopting orphan terminal into new tab",{terminalId:a.id,name:i,directory:r}),t.createTab(i,void 0,r,a.id),e({to:"/terminals",search:{tab:t.pendingTabCreation}});return}const s=t.tabs.items.find(o=>o.directory===r);if(s){At.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:s.id}),e({to:"/terminals",search:{tab:s.id}});return}At.ws.info("useOpenInTerminal: creating new tab",{name:i,directory:r}),t.createTab(i,void 0,r),e({to:"/terminals",search:{tab:t.pendingTabCreation}})},[t,e]),connected:t.connected}}function QIe({delay:e=0,...t}){return b.jsx(Cxe,{"data-slot":"tooltip-provider",delay:e,...t})}function JIe({...e}){return b.jsx(QIe,{children:b.jsx(mxe,{"data-slot":"tooltip",...e})})}function eDe({...e}){return b.jsx(yxe,{"data-slot":"tooltip-trigger",...e})}function tDe({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...s}){return b.jsx(Exe,{children:b.jsx(Sxe,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:b.jsxs(wxe,{"data-slot":"tooltip-content",className:Be("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs **:data-[slot=kbd]:rounded-md bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",e),...s,children:[a,b.jsx(Txe,{className:"size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const mae="";function nDe(e){return qn({queryKey:["copier-questions",e],queryFn:()=>zt(`${mae}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function rDe(){const{data:e,...t}=t0();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function iDe(){const e=wr();return Fn({mutationFn:t=>zt(`${mae}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function aDe(){const{t:e}=rn("repositories"),t=Ri(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,E]=k.useState(""),[S,g]=k.useState({}),[y,v]=k.useState(""),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(!1),[N,D]=k.useState(!1),{data:L}=rDe(),{data:z}=iw(),M=d||m,{data:V,isLoading:H,error:B}=nDe(i==="questions"||i==="output"?M:null),q=iDe();k.useEffect(()=>{n&&(a("template"),p(""),E(""),g({}),v(z||""),T(""),C(null),O(!1),D(!1))},[n,z]),k.useEffect(()=>{V?.questions&&g(G=>{const Z={...G};for(const ee of V.questions)Z[ee.name]===void 0&&ee.default!==void 0&&(Z[ee.name]=ee.default);return Z})},[V]);const K=k.useCallback(()=>{const G=f.current;if(!G)return;const Z=G.scrollHeight>G.clientHeight&&G.scrollTop+G.clientHeight<G.scrollHeight-10;u(Z)},[]);k.useEffect(()=>{const G=setTimeout(K,100);return()=>clearTimeout(G)},[i,V,K]);const U=k.useCallback(()=>{K()},[K]),j=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},$=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},Y=()=>{a("creating"),C(null),q.mutate({templateSource:M,outputPath:y,answers:S,projectName:x,trust:R},{onSuccess:G=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:G.repositoryId}})},onError:G=>{C(G.message),(G.message.includes("unsafe")||G.message.includes("--trust"))&&D(!0),a("output")}})},W=G=>{const Z=S[G.name],ee=ye=>g(Ee=>({...Ee,[G.name]:ye})),te=G.default===void 0||typeof G.default=="string"&&G.default.includes("{{")?`${G.name} *`:G.name;switch(G.type){case"bool":return b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(hi,{checked:Z,onCheckedChange:ee}),b.jsx(ar,{className:"cursor-pointer",children:te})]}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);case"int":case"float":return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsx(dn,{type:"number",value:Z,onChange:ye=>ee(G.type==="int"?parseInt(ye.target.value):parseFloat(ye.target.value)),step:G.type==="float"?"any":1}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);default:{if(G.choices&&G.choices.length>0)return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsxs(Bi,{value:String(Z??""),onValueChange:ee,children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{})}),b.jsx(zi,{children:G.choices.map(Ee=>b.jsx(Cn,{value:String(Ee.value),children:Ee.label},String(Ee.value)))})]}),G.help&&b.jsx(Ya,{children:G.help})]},G.name);const ye=G.type==="yaml"||G.type==="json";return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),ye?b.jsx(_M,{value:String(Z??""),onChange:Ee=>ee(Ee.target.value),rows:4}):b.jsx(dn,{value:String(Z??""),onChange:Ee=>ee(Ee.target.value)}),G.help&&b.jsx(Ya,{children:G.help})]},G.name)}}},J=!!M,ae=V?.questions.filter(G=>{if(G.default!==void 0&&!(typeof G.default=="string"&&G.default.includes("{{")))return!1;const ee=S[G.name];return ee==null||ee===""})??[],se=V&&!H&&ae.length===0,Q=x.trim()&&y.trim();return b.jsxs(b.Fragment,{children:[b.jsxs(ed,{open:n,onOpenChange:r,children:[b.jsxs(Mte,{render:b.jsx(qe,{variant:"outline",size:"sm"}),children:[b.jsx(fe,{icon:P1e,size:16,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:e("newProject.button")})]}),b.jsxs(td,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[b.jsxs(Gf,{className:"shrink-0",children:[b.jsxs(qf,{className:"flex items-center gap-2",children:[e("newProject.title"),b.jsxs(JIe,{children:[b.jsx(eDe,{className:"text-muted-foreground hover:text-foreground transition-colors",children:b.jsx(fe,{icon:gte,size:16,strokeWidth:2})}),b.jsx(tDe,{side:"bottom",align:"start",className:"max-w-xs",children:b.jsxs("p",{children:[e("newProject.steps.template.help")," ",b.jsx("a",{href:"https://copier.readthedocs.io/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:opacity-80",children:e("newProject.steps.template.learnMore")})]})})]})]}),b.jsxs(Zx,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),b.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((G,Z)=>b.jsx("div",{className:Be("flex-1 h-1 rounded",i===G||["template","questions","output"].indexOf(i)>Z||i==="creating"?"bg-primary":"bg-muted")},G))}),b.jsxs("div",{ref:f,onScroll:U,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&b.jsxs(mf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.savedTemplates")}),b.jsxs(Bi,{value:d,onValueChange:G=>{p(G??""),E("")},children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{children:d?L?.find(G=>G.id===d)?.displayName:b.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),b.jsx(zi,{children:L?.map(G=>b.jsx(Cn,{value:G.id,children:G.displayName},G.id))})]})]}),b.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.customUrl")}),b.jsx(dn,{value:m,onChange:G=>{E(G.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),b.jsx(Ya,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&b.jsxs(mf,{children:[H&&b.jsx("div",{className:"flex items-center justify-center py-8",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),B&&b.jsx("div",{className:"text-destructive text-sm py-4",children:B.message}),V?.questions.map(W),V&&V.questions.length===0&&b.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&b.jsxs(mf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.projectName")}),b.jsx(dn,{value:x,onChange:G=>T(G.target.value),placeholder:"my-new-project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.outputDirectory")}),b.jsxs(qe,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2"}),y||e("newProject.steps.output.selectDirectory")]})]}),x&&y&&b.jsxs(Ya,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",y,"/",x]}),w&&b.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w}),N&&b.jsx(ir,{children:b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx(hi,{checked:R,onCheckedChange:G=>O(G===!0),className:"mt-0.5"}),b.jsxs("div",{children:[b.jsx(ar,{className:"cursor-pointer",children:e("newProject.steps.output.trustTemplate")}),b.jsx(Ya,{children:e("newProject.steps.output.trustWarning")})]})]})})]}),i==="creating"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[b.jsx(fe,{icon:tn,size:32,strokeWidth:2,className:"animate-spin text-primary"}),b.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&b.jsx("div",{className:"flex justify-center py-1",children:b.jsx(fe,{icon:pM,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),b.jsxs(Df,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&b.jsxs(qe,{variant:"outline",onClick:$,children:[b.jsx(fe,{icon:ute,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&b.jsx(Fp,{render:b.jsx(qe,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&b.jsxs(qe,{onClick:j,disabled:!J,children:[e("newProject.next"),b.jsx(fe,{icon:iz,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&b.jsxs(qe,{onClick:j,disabled:!se,children:[e("newProject.next"),b.jsx(fe,{icon:iz,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&b.jsx(qe,{onClick:Y,disabled:!Q||q.isPending,children:e("newProject.create")})]})]})]}),b.jsx(gf,{open:s,onOpenChange:o,onSelect:G=>v(G),initialPath:z||void 0})]})}function WH(e){return e.startsWith("git@")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("gh:")||e.startsWith("gl:")||e.startsWith("bb:")}function sDe(e){const t=e.replace(/\.git$/,"");if(t.startsWith("git@")){const n=t.match(/:([^/]+\/)?([^/]+)$/);if(n)return n[2]}else if(t.startsWith("gh:")||t.startsWith("gl:")||t.startsWith("bb:")){const n=t.split("/");if(n.length>0)return n[n.length-1]}else{const n=t.split("/");if(n.length>0)return n[n.length-1]}return t}function oDe({open:e,onOpenChange:t,onSuccess:n,initialTab:r="add"}){const{t:i}=rn("repositories"),[a,s]=k.useState(r),[o,l]=k.useState(""),[u,f]=k.useState(""),[d,p]=k.useState(""),[m,E]=k.useState(null),[S,g]=k.useState(!1),[y,v]=k.useState(!1),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(new Set),[N,D]=k.useState(null),[L,z]=k.useState(!1),{data:M}=iw(),V=Une(),H=hwe(),B=mwe(),q=gwe(),K=k.useMemo(()=>WH(o.trim()),[o]),U=k.useMemo(()=>K?sDe(o.trim()):null,[o,K]);k.useEffect(()=>{U&&!d&&p(U)},[U,d]);const j=u.trim()||M||"",$=k.useMemo(()=>{if(!K||!j)return null;const Te=d.trim()||U||"";return Te?`${j}/${Te}`:null},[K,j,d,U]),Y=x.trim()||M||"",W=k.useMemo(()=>w?.filter(Te=>!Te.exists)??[],[w]),J=V.isPending||H.isPending,ae=B.isPending||q.isPending,se=async Te=>{Te.preventDefault(),E(null);const de=o.trim();if(de)if(K){const Ce=d.trim()||void 0,ge=u.trim()||void 0;H.mutate({url:de,targetDir:ge,folderName:Ce},{onSuccess:he=>{pe(),t(!1),n?.(he.id)},onError:he=>{E(he instanceof Error?he.message:i("addModal.cloneFailed"))}})}else{const Ce=de.split("/").pop()||"repo";V.mutate({path:de,displayName:Ce},{onSuccess:ge=>{pe(),t(!1),n?.(ge.id)},onError:ge=>{E(ge instanceof Error?ge.message:i("addModal.createFailed"))}})}},Q=Te=>{l(Te),g(!1)},G=Te=>{f(Te),v(!1)},Z=()=>{D(null),C(null),O(new Set),B.mutate(Y||void 0,{onSuccess:Te=>{C(Te.repositories);const de=Te.repositories.filter(Ce=>!Ce.exists);O(new Set(de.map(Ce=>Ce.path)))},onError:Te=>{D(Te instanceof Error?Te.message:i("bulkAdd.scanFailed"))}})},ee=Te=>{T(Te),z(!1),C(null),O(new Set)},ne=Te=>{O(de=>{const Ce=new Set(de);return Ce.has(Te)?Ce.delete(Te):Ce.add(Te),Ce})},te=()=>{O(new Set(W.map(Te=>Te.path)))},ye=()=>{O(new Set)},Ee=()=>{if(R.size===0)return;const Te=Array.from(R).map(de=>{const Ce=w?.find(ge=>ge.path===de);return{path:de,displayName:Ce?.name}});q.mutate(Te,{onSuccess:()=>{_e(),t(!1),n?.("")},onError:de=>{D(de instanceof Error?de.message:i("bulkAdd.addFailed"))}})},pe=()=>{l(""),f(""),p(""),E(null)},_e=()=>{T(""),C(null),O(new Set),D(null)},Se=Te=>{Te||(pe(),_e(),s(r)),t(Te)};return b.jsxs(b.Fragment,{children:[b.jsx(ed,{open:e,onOpenChange:Se,children:b.jsxs(td,{className:"sm:max-w-lg",children:[b.jsxs(Gf,{children:[b.jsx(qf,{children:i("addModal.title")}),b.jsx(Zx,{children:i("addModal.description")})]}),b.jsxs(Zo,{value:a,onValueChange:s,children:[b.jsxs(Qo,{className:"w-full",children:[b.jsx(Wr,{value:"add",className:"flex-1",children:i("addModal.tabs.add")}),b.jsx(Wr,{value:"scan",className:"flex-1",children:i("addModal.tabs.scan")})]}),b.jsx(ci,{value:"add",children:b.jsxs("form",{onSubmit:se,className:"space-y-4 pt-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("addModal.inputLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx(dn,{value:o,onChange:Te=>{l(Te.target.value),E(null),WH(Te.target.value.trim())||p("")},placeholder:i("addModal.inputPlaceholder"),disabled:J,className:"pr-8"}),o&&b.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:b.jsx(fe,{icon:K?bte:Vi,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>g(!0),disabled:J,children:i("addModal.browse")})]})]}),K&&b.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-muted/30 p-3",children:[b.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:i("addModal.cloneOptions")}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs text-muted-foreground",children:i("addModal.targetDirectory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:u,onChange:Te=>f(Te.target.value),placeholder:M||"~/",disabled:J,className:"flex-1 text-xs"}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>v(!0),disabled:J,children:i("addModal.browse")})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs text-muted-foreground",children:i("addModal.folderName")}),b.jsx(dn,{value:d,onChange:Te=>p(Te.target.value),placeholder:U||"",disabled:J,className:"text-xs"})]}),$&&b.jsxs("div",{className:"rounded-md bg-background px-3 py-2 text-xs text-muted-foreground",children:[i("addModal.willCloneTo"),":"," ",b.jsx("span",{className:"font-mono",children:$})]})]}),J&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),i(K?"addModal.cloning":"addModal.adding")]}),m&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:rs,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:m})]}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",disabled:J}),children:i("addModal.cancel")}),b.jsx(qe,{type:"submit",disabled:!o.trim()||J,children:i(m?"addModal.retry":"addModal.add")})]})]})}),b.jsx(ci,{value:"scan",children:b.jsxs("div",{className:"space-y-4 pt-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("bulkAdd.directoryLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:x,onChange:Te=>{T(Te.target.value),D(null),C(null)},placeholder:M||i("bulkAdd.directoryPlaceholder"),disabled:ae,className:"flex-1"}),b.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:()=>z(!0),disabled:ae,children:i("bulkAdd.browse")}),b.jsxs(qe,{type:"button",size:"sm",onClick:Z,disabled:ae||!Y,children:[B.isPending?b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:Gx,size:16,strokeWidth:2}),i("bulkAdd.scan")]})]})]}),w!==null&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:i("bulkAdd.foundRepos",{count:w.length})}),W.length>0&&b.jsxs("div",{className:"flex gap-2 text-xs",children:[b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:te,disabled:ae,children:i("bulkAdd.selectAll")}),b.jsx("span",{className:"text-muted-foreground",children:"/"}),b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:ye,disabled:ae,children:i("bulkAdd.selectNone")})]})]}),w.length===0?b.jsx("div",{className:"rounded-md bg-muted/50 px-3 py-4 text-center text-sm text-muted-foreground",children:i("bulkAdd.noReposFound")}):b.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:w.map(Te=>b.jsxs("div",{className:`flex items-center gap-3 border-b px-3 py-2 last:border-b-0 ${Te.exists?"bg-muted/30 opacity-60":""}`,children:[b.jsx(hi,{checked:R.has(Te.path),onCheckedChange:()=>ne(Te.path),disabled:Te.exists||ae}),b.jsx(fe,{icon:Te.exists?fte:Vi,size:16,strokeWidth:2,className:Te.exists?"text-green-500":"text-muted-foreground"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("div",{className:"truncate text-sm font-medium",children:Te.name}),b.jsx("div",{className:"truncate text-xs text-muted-foreground",children:Te.path})]}),Te.exists&&b.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:i("bulkAdd.alreadyAdded")})]},Te.path))})]}),q.isPending&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),i("bulkAdd.adding")]}),N&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:rs,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:N})]}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",disabled:ae}),children:i("bulkAdd.cancel")}),b.jsx(qe,{onClick:Ee,disabled:R.size===0||ae,children:i("bulkAdd.addSelected",{count:R.size})})]})]})})]})]})}),b.jsx(gf,{open:S,onOpenChange:g,onSelect:Q,initialPath:M||void 0}),b.jsx(gf,{open:y,onOpenChange:v,onSelect:G,initialPath:j||void 0}),b.jsx(gf,{open:L,onOpenChange:z,onSelect:ee,initialPath:Y||void 0})]})}function gae({repository:e,open:t,onOpenChange:n,onDelete:r}){const{t:i}=rn("repositories"),[a,s]=k.useState(!1),[o,l]=k.useState(!1),u=async()=>{s(!0);try{await r(o),n(!1)}catch{}finally{s(!1)}},f=d=>{n(d),d||l(!1)};return e?b.jsx(go,{open:t,onOpenChange:f,children:b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:i("delete.title")}),b.jsx(Eo,{children:i("delete.description",{name:e.displayName})})]}),b.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-destructive/50 bg-destructive/10 p-3",children:[b.jsx(hi,{id:`delete-dir-${e.id}`,checked:o,onCheckedChange:d=>l(d===!0),disabled:a,className:"border-destructive/50 data-[state=checked]:bg-destructive data-[state=checked]:border-destructive mt-0.5"}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{htmlFor:`delete-dir-${e.id}`,className:"text-sm font-medium leading-none cursor-pointer",children:i("delete.alsoDeleteDirectory")}),b.jsx("p",{className:"text-xs text-muted-foreground",children:i("delete.deleteDirectoryWarning")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:a,children:i("addModal.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:u,disabled:a,className:"gap-2",children:[a&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),i(a?"delete.deleting":"delete.button")]})]})]})}):null}const lDe=js("/repositories/")({component:dDe});function uDe({repository:e,onStartTask:t,onOpenInTerminal:n,onViewTasks:r,onDeleteClick:i}){const{t:a}=rn("repositories"),{data:s}=LM(),{data:o}=PM(),{data:l}=MM(),u=()=>{const f=Gie(e.path,s,o,l);Bc(f)};return b.jsxs(wa,{className:"h-full group transition-colors hover:border-foreground/20",children:[b.jsx(Ai,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:b.jsx(Mf,{className:"flex flex-col gap-3 py-4",children:b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),b.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),b.jsx(Mf,{className:"pt-0 pb-4 px-6",children:b.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[b.jsxs(qe,{variant:"outline",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:bM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:jp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[b.jsx(fe,{icon:Wx,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:u,className:"text-muted-foreground hover:text-foreground max-sm:hidden",title:a("openInEditor",{editor:_Ne(s)}),children:[b.jsx(fe,{icon:xte,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{children:a("editor")})]}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-destructive",title:a("delete.button"),children:[b.jsx(fe,{icon:bu,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]})]})})]})}function cDe(){const{t:e}=rn("repositories"),t=Ri(),[n,r]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(qe,{size:"sm",onClick:()=>r(!0),children:[b.jsx(fe,{icon:Nv,size:16,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:e("addRepository")})]}),b.jsx(oDe,{open:n,onOpenChange:r,onSuccess:i=>{t({to:"/repositories/$repoId",params:{repoId:i}})}})]})}function dDe(){const{t:e}=rn("repositories"),t=Ri(),{data:n,isLoading:r,error:i}=t0(),a=$ne(),[s,o]=k.useState(null),[l,u]=k.useState(null),{openInTerminal:f}=pae(),[d,p]=k.useState(""),m=k.useMemo(()=>n?d?.trim()?n.map(g=>({repo:g,score:Math.max(no(g.displayName,d),no(g.path,d))})).filter(({score:g})=>g>0).sort((g,y)=>y.score-g.score).map(({repo:g})=>g):n:[],[n,d]),E=async g=>{l&&await a.mutateAsync({id:l.id,deleteDirectory:g})},S=g=>{t({to:"/tasks",search:{repo:g}})};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:d,onChange:g=>p(g.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsx("div",{className:"hidden sm:block flex-1"}),b.jsx(cDe,{}),b.jsx(aDe,{})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:rs,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),!r&&!i&&n&&n.length>0&&m.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noMatches")})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map(g=>b.jsx(uDe,{repository:g,onStartTask:()=>o(g),onOpenInTerminal:()=>f(g.path,g.displayName),onViewTasks:()=>S(g.displayName),onDeleteClick:()=>u(g)},g.id))})]}),b.jsx(jM,{open:s!==null,onOpenChange:g=>!g&&o(null),defaultRepository:s??void 0,showTrigger:!1}),b.jsx(gae,{repository:l,open:l!==null,onOpenChange:g=>!g&&u(null),onDelete:E})]})}var $k,VH;function Na(){if(VH)return $k;VH=1;var e=Array.isArray;return $k=e,$k}var zk,GH;function bae(){if(GH)return zk;GH=1;var e=typeof J1=="object"&&J1&&J1.Object===Object&&J1;return zk=e,zk}var Hk,qH;function yl(){if(qH)return Hk;qH=1;var e=bae(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Hk=n,Hk}var Wk,KH;function h0(){if(KH)return Wk;KH=1;var e=yl(),t=e.Symbol;return Wk=t,Wk}var Vk,YH;function fDe(){if(YH)return Vk;YH=1;var e=h0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return Vk=a,Vk}var Gk,XH;function hDe(){if(XH)return Gk;XH=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Gk=n,Gk}var qk,ZH;function Du(){if(ZH)return qk;ZH=1;var e=h0(),t=fDe(),n=hDe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return qk=s,qk}var Kk,QH;function Lu(){if(QH)return Kk;QH=1;function e(t){return t!=null&&typeof t=="object"}return Kk=e,Kk}var Yk,JH;function zm(){if(JH)return Yk;JH=1;var e=Du(),t=Lu(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Yk=r,Yk}var Xk,eW;function d3(){if(eW)return Xk;eW=1;var e=Na(),t=zm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Xk=i,Xk}var Zk,tW;function od(){if(tW)return Zk;tW=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Zk=e,Zk}var Qk,nW;function f3(){if(nW)return Qk;nW=1;var e=Du(),t=od(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Qk=s,Qk}var Jk,rW;function pDe(){if(rW)return Jk;rW=1;var e=yl(),t=e["__core-js_shared__"];return Jk=t,Jk}var eO,iW;function mDe(){if(iW)return eO;iW=1;var e=pDe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return eO=n,eO}var tO,aW;function vae(){if(aW)return tO;aW=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return tO=n,tO}var nO,sW;function gDe(){if(sW)return nO;sW=1;var e=f3(),t=mDe(),n=od(),r=vae(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return nO=d,nO}var rO,oW;function bDe(){if(oW)return rO;oW=1;function e(t,n){return t?.[n]}return rO=e,rO}var iO,lW;function th(){if(lW)return iO;lW=1;var e=gDe(),t=bDe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return iO=n,iO}var aO,uW;function Ew(){if(uW)return aO;uW=1;var e=th(),t=e(Object,"create");return aO=t,aO}var sO,cW;function vDe(){if(cW)return sO;cW=1;var e=Ew();function t(){this.__data__=e?e(null):{},this.size=0}return sO=t,sO}var oO,dW;function yDe(){if(dW)return oO;dW=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return oO=e,oO}var lO,fW;function _De(){if(fW)return lO;fW=1;var e=Ew(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return lO=i,lO}var uO,hW;function EDe(){if(hW)return uO;hW=1;var e=Ew(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return uO=r,uO}var cO,pW;function SDe(){if(pW)return cO;pW=1;var e=Ew(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return cO=n,cO}var dO,mW;function xDe(){if(mW)return dO;mW=1;var e=vDe(),t=yDe(),n=_De(),r=EDe(),i=SDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,dO=a,dO}var fO,gW;function wDe(){if(gW)return fO;gW=1;function e(){this.__data__=[],this.size=0}return fO=e,fO}var hO,bW;function h3(){if(bW)return hO;bW=1;function e(t,n){return t===n||t!==t&&n!==n}return hO=e,hO}var pO,vW;function Sw(){if(vW)return pO;vW=1;var e=h3();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return pO=t,pO}var mO,yW;function TDe(){if(yW)return mO;yW=1;var e=Sw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return mO=r,mO}var gO,_W;function CDe(){if(_W)return gO;_W=1;var e=Sw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return gO=t,gO}var bO,EW;function ADe(){if(EW)return bO;EW=1;var e=Sw();function t(n){return e(this.__data__,n)>-1}return bO=t,bO}var vO,SW;function kDe(){if(SW)return vO;SW=1;var e=Sw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return vO=t,vO}var yO,xW;function xw(){if(xW)return yO;xW=1;var e=wDe(),t=TDe(),n=CDe(),r=ADe(),i=kDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,yO=a,yO}var _O,wW;function p3(){if(wW)return _O;wW=1;var e=th(),t=yl(),n=e(t,"Map");return _O=n,_O}var EO,TW;function ODe(){if(TW)return EO;TW=1;var e=xDe(),t=xw(),n=p3();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return EO=r,EO}var SO,CW;function RDe(){if(CW)return SO;CW=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return SO=e,SO}var xO,AW;function ww(){if(AW)return xO;AW=1;var e=RDe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return xO=t,xO}var wO,kW;function NDe(){if(kW)return wO;kW=1;var e=ww();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return wO=t,wO}var TO,OW;function IDe(){if(OW)return TO;OW=1;var e=ww();function t(n){return e(this,n).get(n)}return TO=t,TO}var CO,RW;function DDe(){if(RW)return CO;RW=1;var e=ww();function t(n){return e(this,n).has(n)}return CO=t,CO}var AO,NW;function LDe(){if(NW)return AO;NW=1;var e=ww();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return AO=t,AO}var kO,IW;function m3(){if(IW)return kO;IW=1;var e=ODe(),t=NDe(),n=IDe(),r=DDe(),i=LDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,kO=a,kO}var OO,DW;function yae(){if(DW)return OO;DW=1;var e=m3(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,OO=n,OO}var RO,LW;function PDe(){if(LW)return RO;LW=1;var e=yae(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return RO=n,RO}var NO,PW;function MDe(){if(PW)return NO;PW=1;var e=PDe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return NO=r,NO}var IO,MW;function g3(){if(MW)return IO;MW=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return IO=e,IO}var DO,jW;function jDe(){if(jW)return DO;jW=1;var e=h0(),t=g3(),n=Na(),r=zm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return DO=s,DO}var LO,FW;function _ae(){if(FW)return LO;FW=1;var e=jDe();function t(n){return n==null?"":e(n)}return LO=t,LO}var PO,BW;function Eae(){if(BW)return PO;BW=1;var e=Na(),t=d3(),n=MDe(),r=_ae();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return PO=i,PO}var MO,UW;function Tw(){if(UW)return MO;UW=1;var e=zm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return MO=t,MO}var jO,$W;function b3(){if($W)return jO;$W=1;var e=Eae(),t=Tw();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return jO=n,jO}var FO,zW;function Sae(){if(zW)return FO;zW=1;var e=b3();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return FO=t,FO}var FDe=Sae();const Ps=Sn(FDe);var BO,HW;function BDe(){if(HW)return BO;HW=1;function e(t){return t==null}return BO=e,BO}var UDe=BDe();const hn=Sn(UDe);var UO,WW;function $De(){if(WW)return UO;WW=1;var e=Du(),t=Na(),n=Lu(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return UO=i,UO}var zDe=$De();const Ff=Sn(zDe);var HDe=f3();const Gt=Sn(HDe);var WDe=od();const Hm=Sn(WDe);var $O={exports:{}},Dn={};var VW;function VDe(){if(VW)return Dn;VW=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),E;E=Symbol.for("react.module.reference");function S(g){if(typeof g=="object"&&g!==null){var y=g.$$typeof;switch(y){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return y}}case t:return y}}}return Dn.ContextConsumer=s,Dn.ContextProvider=a,Dn.Element=e,Dn.ForwardRef=l,Dn.Fragment=n,Dn.Lazy=p,Dn.Memo=d,Dn.Portal=t,Dn.Profiler=i,Dn.StrictMode=r,Dn.Suspense=u,Dn.SuspenseList=f,Dn.isAsyncMode=function(){return!1},Dn.isConcurrentMode=function(){return!1},Dn.isContextConsumer=function(g){return S(g)===s},Dn.isContextProvider=function(g){return S(g)===a},Dn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Dn.isForwardRef=function(g){return S(g)===l},Dn.isFragment=function(g){return S(g)===n},Dn.isLazy=function(g){return S(g)===p},Dn.isMemo=function(g){return S(g)===d},Dn.isPortal=function(g){return S(g)===t},Dn.isProfiler=function(g){return S(g)===i},Dn.isStrictMode=function(g){return S(g)===r},Dn.isSuspense=function(g){return S(g)===u},Dn.isSuspenseList=function(g){return S(g)===f},Dn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===E||g.getModuleId!==void 0)},Dn.typeOf=S,Dn}var GW;function GDe(){return GW||(GW=1,$O.exports=VDe()),$O.exports}var qDe=GDe(),zO,qW;function xae(){if(qW)return zO;qW=1;var e=Du(),t=Lu(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return zO=r,zO}var HO,KW;function KDe(){if(KW)return HO;KW=1;var e=xae();function t(n){return e(n)&&n!=+n}return HO=t,HO}var YDe=KDe();const Wm=Sn(YDe);var XDe=xae();const ZDe=Sn(XDe);var Ea=function(t){return t===0?0:t>0?1:-1},tf=function(t){return Ff(t)&&t.indexOf("%")===t.length-1},at=function(t){return ZDe(t)&&!Wm(t)},QDe=function(t){return hn(t)},ni=function(t){return at(t)||Ff(t)},JDe=0,p0=function(t){var n=++JDe;return"".concat(t||"").concat(n)},so=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Ff(t))return r;var a;if(tf(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return Wm(a)&&(a=r),i&&a>n&&(a=n),a},Ec=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},eLe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},ea=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function uS(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Ps(r,t))===n})}var tLe=function(t,n){return at(t)&&at(n)?t-n:Ff(t)&&Ff(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Tp(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function AD(e){"@babel/helpers - typeof";return AD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},AD(e)}var nLe=["viewBox","children"],rLe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],YW=["points","pathLength"],WO={svg:nLe,polygon:YW,polyline:YW},v3=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],cS=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Hm(r))return null;var i={};return Object.keys(r).forEach(function(a){v3.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},iLe=function(t,n,r){return function(i){return t(n,r,i),null}},qc=function(t,n,r){if(!Hm(t)||AD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];v3.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=iLe(s,n,r))}),i},aLe=["children"],sLe=["children"];function XW(e,t){if(e==null)return{};var n=oLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kD(e){"@babel/helpers - typeof";return kD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kD(e)}var ZW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},du=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},QW=null,VO=null,y3=function e(t){if(t===QW&&Array.isArray(VO))return VO;var n=[];return k.Children.forEach(t,function(r){hn(r)||(qDe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),VO=n,QW=t,n};function Ms(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return du(i)}):r=[du(t)],y3(e).forEach(function(i){var a=Ps(i,"type.displayName")||Ps(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function qa(e,t){var n=Ms(e,t);return n&&n[0]}var JW=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},lLe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],uLe=function(t){return t&&t.type&&Ff(t.type)&&lLe.indexOf(t.type)>=0},cLe=function(t){return t&&kD(t)==="object"&&"clipDot"in t},dLe=function(t,n,r,i){var a,s=(a=WO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Gt(t)&&(i&&s.includes(n)||rLe.includes(n))||r&&v3.includes(n)},Lt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Hm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;dLe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},OD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return eV(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!eV(a,s))return!1}return!0},eV=function(t,n){if(hn(t)&&hn(n))return!0;if(!hn(t)&&!hn(n)){var r=t.props||{},i=r.children,a=XW(r,aLe),s=n.props||{},o=s.children,l=XW(s,sLe);return i&&o?Tp(a,l)&&OD(i,o):!i&&!o?Tp(a,l):!1}return!1},tV=function(t,n){var r=[],i={};return y3(t).forEach(function(a,s){if(uLe(a))r.push(a);else if(a){var o=du(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},fLe=function(t){var n=t&&t.type;return n&&ZW[n]?ZW[n]:null},hLe=function(t,n){return y3(n).indexOf(t)},pLe=["children","width","height","viewBox","className","style","title","desc"];function RD(){return RD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RD.apply(this,arguments)}function mLe(e,t){if(e==null)return{};var n=gLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ND(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=mLe(e,pLe),f=i||{width:n,height:r,x:0,y:0},d=Qt("recharts-surface",a);return oe.createElement("svg",RD({},Lt(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var bLe=["children","className"];function ID(){return ID=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ID.apply(this,arguments)}function vLe(e,t){if(e==null)return{};var n=yLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var xn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=vLe(e,bLe),a=Qt("recharts-layer",r);return oe.createElement("g",ID({className:a},Lt(i,!0),{ref:t}),n)}),fu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},GO,nV;function _Le(){if(nV)return GO;nV=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return GO=e,GO}var qO,rV;function ELe(){if(rV)return qO;rV=1;var e=_Le();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return qO=t,qO}var KO,iV;function wae(){if(iV)return KO;iV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return KO=l,KO}var YO,aV;function SLe(){if(aV)return YO;aV=1;function e(t){return t.split("")}return YO=e,YO}var XO,sV;function xLe(){if(sV)return XO;sV=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",E=u+"?",S="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+S+E+")*",y=S+E+g,v="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+v+y,"g");function T(w){return w.match(x)||[]}return XO=T,XO}var ZO,oV;function wLe(){if(oV)return ZO;oV=1;var e=SLe(),t=wae(),n=xLe();function r(i){return t(i)?n(i):e(i)}return ZO=r,ZO}var QO,lV;function TLe(){if(lV)return QO;lV=1;var e=ELe(),t=wae(),n=wLe(),r=_ae();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return QO=i,QO}var JO,uV;function CLe(){if(uV)return JO;uV=1;var e=TLe(),t=e("toUpperCase");return JO=t,JO}var ALe=CLe();const Cw=Sn(ALe);function Zn(e){return function(){return e}}const Tae=Math.cos,dS=Math.sin,Oo=Math.sqrt,fS=Math.PI,Aw=2*fS,DD=Math.PI,LD=2*DD,zd=1e-6,kLe=LD-zd;function Cae(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function OLe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Cae;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class RLe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Cae:OLe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>zd)if(!(Math.abs(d*l-u*f)>zd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,E=i-o,S=l*l+u*u,g=m*m+E*E,y=Math.sqrt(S),v=Math.sqrt(p),x=a*Math.tan((DD-Math.acos((S+p-g)/(2*y*v)))/2),T=x/v,w=x/y;Math.abs(T-1)>zd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*E)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>zd||Math.abs(this._y1-f)>zd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%LD+LD),p>kLe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>zd&&this._append`A${r},${r},0,${+(p>=DD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function _3(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new RLe(t)}function E3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Aae(e){this._context=e}Aae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function kw(e){return new Aae(e)}function kae(e){return e[0]}function Oae(e){return e[1]}function Rae(e,t){var n=Zn(!0),r=null,i=kw,a=null,s=_3(o);e=typeof e=="function"?e:e===void 0?kae:Zn(e),t=typeof t=="function"?t:t===void 0?Oae:Zn(t);function o(l){var u,f=(l=E3(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function N_(e,t,n){var r=null,i=Zn(!0),a=null,s=kw,o=null,l=_3(u);e=typeof e=="function"?e:e===void 0?kae:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Oae:Zn(+n);function u(d){var p,m,E,S=(d=E3(d)).length,g,y=!1,v,x=new Array(S),T=new Array(S);for(a==null&&(o=s(v=l())),p=0;p<=S;++p){if(!(p<S&&i(g=d[p],p,d))===y)if(y=!y)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),E=p-1;E>=m;--E)o.point(x[E],T[E]);o.lineEnd(),o.areaEnd()}y&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(v)return o=null,v+""||null}function f(){return Rae().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class Nae{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function NLe(e){return new Nae(e,!0)}function ILe(e){return new Nae(e,!1)}const S3={draw(e,t){const n=Oo(t/fS);e.moveTo(n,0),e.arc(0,0,n,0,Aw)}},DLe={draw(e,t){const n=Oo(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Iae=Oo(1/3),LLe=Iae*2,PLe={draw(e,t){const n=Oo(t/LLe),r=n*Iae;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},MLe={draw(e,t){const n=Oo(t),r=-n/2;e.rect(r,r,n,n)}},jLe=.8908130915292852,Dae=dS(fS/10)/dS(7*fS/10),FLe=dS(Aw/10)*Dae,BLe=-Tae(Aw/10)*Dae,ULe={draw(e,t){const n=Oo(t*jLe),r=FLe*n,i=BLe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=Aw*a/5,o=Tae(s),l=dS(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},eR=Oo(3),$Le={draw(e,t){const n=-Oo(t/(eR*3));e.moveTo(0,n*2),e.lineTo(-eR*n,-n),e.lineTo(eR*n,-n),e.closePath()}},vs=-.5,ys=Oo(3)/2,PD=1/Oo(12),zLe=(PD/2+1)*3,HLe={draw(e,t){const n=Oo(t/zLe),r=n/2,i=n*PD,a=r,s=n*PD+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(vs*r-ys*i,ys*r+vs*i),e.lineTo(vs*a-ys*s,ys*a+vs*s),e.lineTo(vs*o-ys*l,ys*o+vs*l),e.lineTo(vs*r+ys*i,vs*i-ys*r),e.lineTo(vs*a+ys*s,vs*s-ys*a),e.lineTo(vs*o+ys*l,vs*l-ys*o),e.closePath()}};function WLe(e,t){let n=null,r=_3(i);e=typeof e=="function"?e:Zn(e||S3),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function hS(){}function pS(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Lae(e){this._context=e}Lae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:pS(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VLe(e){return new Lae(e)}function Pae(e){this._context=e}Pae.prototype={areaStart:hS,areaEnd:hS,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GLe(e){return new Pae(e)}function Mae(e){this._context=e}Mae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:pS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qLe(e){return new Mae(e)}function jae(e){this._context=e}jae.prototype={areaStart:hS,areaEnd:hS,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function KLe(e){return new jae(e)}function cV(e){return e<0?-1:1}function dV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(cV(a)+cV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function fV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function tR(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function mS(e){this._context=e}mS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:tR(this,this._t0,fV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,tR(this,fV(this,n=dV(this,e,t)),n);break;default:tR(this,this._t0,n=dV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Fae(e){this._context=new Bae(e)}(Fae.prototype=Object.create(mS.prototype)).point=function(e,t){mS.prototype.point.call(this,t,e)};function Bae(e){this._context=e}Bae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function YLe(e){return new mS(e)}function XLe(e){return new Fae(e)}function Uae(e){this._context=e}Uae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=hV(e),i=hV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function hV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ZLe(e){return new Uae(e)}function Ow(e,t){this._context=e,this._t=t}Ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function QLe(e){return new Ow(e,.5)}function JLe(e){return new Ow(e,0)}function ePe(e){return new Ow(e,1)}function Xp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function MD(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function tPe(e,t){return e[t]}function nPe(e){const t=[];return t.key=e,t}function rPe(){var e=Zn([]),t=MD,n=Xp,r=tPe;function i(a){var s=Array.from(e.apply(this,arguments),nPe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=E3(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?MD:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Xp,i):n},i}function iPe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Xp(e,t)}}function aPe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Xp(e,t)}}function sPe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,E=0;E<o;++E){var S=e[t[E]],g=S[r][1]||0,y=S[r-1][1]||0;m+=g-y}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Xp(e,t)}}function Wv(e){"@babel/helpers - typeof";return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wv(e)}var oPe=["type","size","sizeType"];function jD(){return jD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jD.apply(this,arguments)}function pV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pV(Object(n),!0).forEach(function(r){lPe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lPe(e,t,n){return t=uPe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uPe(e){var t=cPe(e,"string");return Wv(t)=="symbol"?t:t+""}function cPe(e,t){if(Wv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dPe(e,t){if(e==null)return{};var n=fPe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $ae={symbolCircle:S3,symbolCross:DLe,symbolDiamond:PLe,symbolSquare:MLe,symbolStar:ULe,symbolTriangle:$Le,symbolWye:HLe},hPe=Math.PI/180,pPe=function(t){var n="symbol".concat(Cw(t));return $ae[n]||S3},mPe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*hPe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},gPe=function(t,n){$ae["symbol".concat(Cw(t))]=n},x3=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=dPe(t,oPe),u=mV(mV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=pPe(r),y=WLe().type(g).size(mPe(a,o,r));return y()},d=u.className,p=u.cx,m=u.cy,E=Lt(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",jD({},E,{className:Qt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};x3.registerSymbol=gPe;function Zp(e){"@babel/helpers - typeof";return Zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zp(e)}function FD(){return FD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},FD.apply(this,arguments)}function gV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bPe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gV(Object(n),!0).forEach(function(r){Vv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yPe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Hae(r.key),r)}}function _Pe(e,t,n){return t&&yPe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function EPe(e,t,n){return t=gS(t),SPe(e,zae()?Reflect.construct(t,n||[],gS(e).constructor):t.apply(e,n))}function SPe(e,t){if(t&&(Zp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xPe(e)}function xPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zae=function(){return!!e})()}function gS(e){return gS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gS(e)}function wPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BD(e,t)}function BD(e,t){return BD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},BD(e,t)}function Vv(e,t,n){return t=Hae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hae(e){var t=TPe(e,"string");return Zp(t)=="symbol"?t:t+""}function TPe(e,t){if(Zp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _s=32,w3=(function(e){function t(){return vPe(this,t),EPe(this,t,arguments)}return wPe(t,e),_Pe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=_s/2,s=_s/6,o=_s/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:_s,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
|
|
47
47
|
A`).concat(s,",").concat(s,",0,1,1,").concat(2*o,",").concat(a,`
|
|
48
48
|
H`).concat(_s,"M").concat(2*o,",").concat(a,`
|
|
49
49
|
A`).concat(s,",").concat(s,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return oe.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(_s/8,"h").concat(_s,"v").concat(_s*3/4,"h").concat(-_s,"z"),className:"recharts-legend-icon"});if(oe.isValidElement(r.legendIcon)){var u=bPe({},r);return delete u.legendIcon,oe.cloneElement(r.legendIcon,u)}return oe.createElement(x3,{fill:l,cx:a,cy:a,size:_s,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,a=i.payload,s=i.iconSize,o=i.layout,l=i.formatter,u=i.inactiveColor,f={x:0,y:0,width:_s,height:_s},d={display:o==="horizontal"?"inline-block":"block",marginRight:10},p={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(m,E){var S=m.formatter||l,g=Qt(Vv(Vv({"recharts-legend-item":!0},"legend-item-".concat(E),!0),"inactive",m.inactive));if(m.type==="none")return null;var y=Gt(m.value)?null:m.value;fu(!Gt(m.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var v=m.inactive?u:m.color;return oe.createElement("li",FD({className:g,style:d,key:"legend-item-".concat(E)},qc(r.props,m,E)),oe.createElement(ND,{width:s,height:s,viewBox:f,style:p},r.renderIcon(m)),oe.createElement("span",{className:"recharts-legend-item-text",style:{color:v}},S?S(y,m,E):y))})}},{key:"render",value:function(){var r=this.props,i=r.payload,a=r.layout,s=r.align;if(!i||!i.length)return null;var o={padding:0,margin:0,textAlign:a==="horizontal"?s:"left"};return oe.createElement("ul",{className:"recharts-default-legend",style:o},this.renderItems())}}])})(k.PureComponent);Vv(w3,"displayName","Legend");Vv(w3,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var nR,bV;function CPe(){if(bV)return nR;bV=1;var e=xw();function t(){this.__data__=new e,this.size=0}return nR=t,nR}var rR,vV;function APe(){if(vV)return rR;vV=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return rR=e,rR}var iR,yV;function kPe(){if(yV)return iR;yV=1;function e(t){return this.__data__.get(t)}return iR=e,iR}var aR,_V;function OPe(){if(_V)return aR;_V=1;function e(t){return this.__data__.has(t)}return aR=e,aR}var sR,EV;function RPe(){if(EV)return sR;EV=1;var e=xw(),t=p3(),n=m3(),r=200;function i(a,s){var o=this.__data__;if(o instanceof e){var l=o.__data__;if(!t||l.length<r-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new n(l)}return o.set(a,s),this.size=o.size,this}return sR=i,sR}var oR,SV;function Wae(){if(SV)return oR;SV=1;var e=xw(),t=CPe(),n=APe(),r=kPe(),i=OPe(),a=RPe();function s(o){var l=this.__data__=new e(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=n,s.prototype.get=r,s.prototype.has=i,s.prototype.set=a,oR=s,oR}var lR,xV;function NPe(){if(xV)return lR;xV=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return lR=t,lR}var uR,wV;function IPe(){if(wV)return uR;wV=1;function e(t){return this.__data__.has(t)}return uR=e,uR}var cR,TV;function Vae(){if(TV)return cR;TV=1;var e=m3(),t=NPe(),n=IPe();function r(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new e;++a<s;)this.add(i[a])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,cR=r,cR}var dR,CV;function Gae(){if(CV)return dR;CV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return dR=e,dR}var fR,AV;function qae(){if(AV)return fR;AV=1;function e(t,n){return t.has(n)}return fR=e,fR}var hR,kV;function Kae(){if(kV)return hR;kV=1;var e=Vae(),t=Gae(),n=qae(),r=1,i=2;function a(s,o,l,u,f,d){var p=l&r,m=s.length,E=o.length;if(m!=E&&!(p&&E>m))return!1;var S=d.get(s),g=d.get(o);if(S&&g)return S==o&&g==s;var y=-1,v=!0,x=l&i?new e:void 0;for(d.set(s,o),d.set(o,s);++y<m;){var T=s[y],w=o[y];if(u)var C=p?u(w,T,y,o,s,d):u(T,w,y,s,o,d);if(C!==void 0){if(C)continue;v=!1;break}if(x){if(!t(o,function(R,O){if(!n(x,O)&&(T===R||f(T,R,l,u,d)))return x.push(O)})){v=!1;break}}else if(!(T===w||f(T,w,l,u,d))){v=!1;break}}return d.delete(s),d.delete(o),v}return hR=a,hR}var pR,OV;function DPe(){if(OV)return pR;OV=1;var e=yl(),t=e.Uint8Array;return pR=t,pR}var mR,RV;function LPe(){if(RV)return mR;RV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,a){r[++n]=[a,i]}),r}return mR=e,mR}var gR,NV;function T3(){if(NV)return gR;NV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return gR=e,gR}var bR,IV;function PPe(){if(IV)return bR;IV=1;var e=h0(),t=DPe(),n=h3(),r=Kae(),i=LPe(),a=T3(),s=1,o=2,l="[object Boolean]",u="[object Date]",f="[object Error]",d="[object Map]",p="[object Number]",m="[object RegExp]",E="[object Set]",S="[object String]",g="[object Symbol]",y="[object ArrayBuffer]",v="[object DataView]",x=e?e.prototype:void 0,T=x?x.valueOf:void 0;function w(C,R,O,N,D,L,z){switch(O){case v:if(C.byteLength!=R.byteLength||C.byteOffset!=R.byteOffset)return!1;C=C.buffer,R=R.buffer;case y:return!(C.byteLength!=R.byteLength||!L(new t(C),new t(R)));case l:case u:case p:return n(+C,+R);case f:return C.name==R.name&&C.message==R.message;case m:case S:return C==R+"";case d:var M=i;case E:var V=N&s;if(M||(M=a),C.size!=R.size&&!V)return!1;var H=z.get(C);if(H)return H==R;N|=o,z.set(C,R);var B=r(M(C),M(R),N,D,L,z);return z.delete(C),B;case g:if(T)return T.call(C)==T.call(R)}return!1}return bR=w,bR}var vR,DV;function Yae(){if(DV)return vR;DV=1;function e(t,n){for(var r=-1,i=n.length,a=t.length;++r<i;)t[a+r]=n[r];return t}return vR=e,vR}var yR,LV;function MPe(){if(LV)return yR;LV=1;var e=Yae(),t=Na();function n(r,i,a){var s=i(r);return t(r)?s:e(s,a(r))}return yR=n,yR}var _R,PV;function jPe(){if(PV)return _R;PV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=0,s=[];++r<i;){var o=t[r];n(o,r,t)&&(s[a++]=o)}return s}return _R=e,_R}var ER,MV;function FPe(){if(MV)return ER;MV=1;function e(){return[]}return ER=e,ER}var SR,jV;function BPe(){if(jV)return SR;jV=1;var e=jPe(),t=FPe(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),e(i(s),function(o){return r.call(s,o)}))}:t;return SR=a,SR}var xR,FV;function UPe(){if(FV)return xR;FV=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return xR=e,xR}var wR,BV;function $Pe(){if(BV)return wR;BV=1;var e=Du(),t=Lu(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return wR=r,wR}var TR,UV;function C3(){if(UV)return TR;UV=1;var e=$Pe(),t=Lu(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&r.call(s,"callee")&&!i.call(s,"callee")};return TR=a,TR}var Db={exports:{}},CR,$V;function zPe(){if($V)return CR;$V=1;function e(){return!1}return CR=e,CR}Db.exports;var zV;function Xae(){return zV||(zV=1,(function(e,t){var n=yl(),r=zPe(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===i,o=s?n.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||r;e.exports=u})(Db,Db.exports)),Db.exports}var AR,HV;function A3(){if(HV)return AR;HV=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var a=typeof r;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return AR=n,AR}var kR,WV;function k3(){if(WV)return kR;WV=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return kR=t,kR}var OR,VV;function HPe(){if(VV)return OR;VV=1;var e=Du(),t=k3(),n=Lu(),r="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",f="[object Number]",d="[object Object]",p="[object RegExp]",m="[object Set]",E="[object String]",S="[object WeakMap]",g="[object ArrayBuffer]",y="[object DataView]",v="[object Float32Array]",x="[object Float64Array]",T="[object Int8Array]",w="[object Int16Array]",C="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",N="[object Uint16Array]",D="[object Uint32Array]",L={};L[v]=L[x]=L[T]=L[w]=L[C]=L[R]=L[O]=L[N]=L[D]=!0,L[r]=L[i]=L[g]=L[a]=L[y]=L[s]=L[o]=L[l]=L[u]=L[f]=L[d]=L[p]=L[m]=L[E]=L[S]=!1;function z(M){return n(M)&&t(M.length)&&!!L[e(M)]}return OR=z,OR}var RR,GV;function Zae(){if(GV)return RR;GV=1;function e(t){return function(n){return t(n)}}return RR=e,RR}var Lb={exports:{}};Lb.exports;var qV;function WPe(){return qV||(qV=1,(function(e,t){var n=bae(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===r,s=a&&n.process,o=(function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=o})(Lb,Lb.exports)),Lb.exports}var NR,KV;function Qae(){if(KV)return NR;KV=1;var e=HPe(),t=Zae(),n=WPe(),r=n&&n.isTypedArray,i=r?t(r):e;return NR=i,NR}var IR,YV;function VPe(){if(YV)return IR;YV=1;var e=UPe(),t=C3(),n=Na(),r=Xae(),i=A3(),a=Qae(),s=Object.prototype,o=s.hasOwnProperty;function l(u,f){var d=n(u),p=!d&&t(u),m=!d&&!p&&r(u),E=!d&&!p&&!m&&a(u),S=d||p||m||E,g=S?e(u.length,String):[],y=g.length;for(var v in u)(f||o.call(u,v))&&!(S&&(v=="length"||m&&(v=="offset"||v=="parent")||E&&(v=="buffer"||v=="byteLength"||v=="byteOffset")||i(v,y)))&&g.push(v);return g}return IR=l,IR}var DR,XV;function GPe(){if(XV)return DR;XV=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return DR=t,DR}var LR,ZV;function Jae(){if(ZV)return LR;ZV=1;function e(t,n){return function(r){return t(n(r))}}return LR=e,LR}var PR,QV;function qPe(){if(QV)return PR;QV=1;var e=Jae(),t=e(Object.keys,Object);return PR=t,PR}var MR,JV;function KPe(){if(JV)return MR;JV=1;var e=GPe(),t=qPe(),n=Object.prototype,r=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var s=[];for(var o in Object(a))r.call(a,o)&&o!="constructor"&&s.push(o);return s}return MR=i,MR}var jR,eG;function m0(){if(eG)return jR;eG=1;var e=f3(),t=k3();function n(r){return r!=null&&t(r.length)&&!e(r)}return jR=n,jR}var FR,tG;function Rw(){if(tG)return FR;tG=1;var e=VPe(),t=KPe(),n=m0();function r(i){return n(i)?e(i):t(i)}return FR=r,FR}var BR,nG;function YPe(){if(nG)return BR;nG=1;var e=MPe(),t=BPe(),n=Rw();function r(i){return e(i,n,t)}return BR=r,BR}var UR,rG;function XPe(){if(rG)return UR;rG=1;var e=YPe(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(a,s,o,l,u,f){var d=o&t,p=e(a),m=p.length,E=e(s),S=E.length;if(m!=S&&!d)return!1;for(var g=m;g--;){var y=p[g];if(!(d?y in s:r.call(s,y)))return!1}var v=f.get(a),x=f.get(s);if(v&&x)return v==s&&x==a;var T=!0;f.set(a,s),f.set(s,a);for(var w=d;++g<m;){y=p[g];var C=a[y],R=s[y];if(l)var O=d?l(R,C,y,s,a,f):l(C,R,y,a,s,f);if(!(O===void 0?C===R||u(C,R,o,l,f):O)){T=!1;break}w||(w=y=="constructor")}if(T&&!w){var N=a.constructor,D=s.constructor;N!=D&&"constructor"in a&&"constructor"in s&&!(typeof N=="function"&&N instanceof N&&typeof D=="function"&&D instanceof D)&&(T=!1)}return f.delete(a),f.delete(s),T}return UR=i,UR}var $R,iG;function ZPe(){if(iG)return $R;iG=1;var e=th(),t=yl(),n=e(t,"DataView");return $R=n,$R}var zR,aG;function QPe(){if(aG)return zR;aG=1;var e=th(),t=yl(),n=e(t,"Promise");return zR=n,zR}var HR,sG;function ese(){if(sG)return HR;sG=1;var e=th(),t=yl(),n=e(t,"Set");return HR=n,HR}var WR,oG;function JPe(){if(oG)return WR;oG=1;var e=th(),t=yl(),n=e(t,"WeakMap");return WR=n,WR}var VR,lG;function eMe(){if(lG)return VR;lG=1;var e=ZPe(),t=p3(),n=QPe(),r=ese(),i=JPe(),a=Du(),s=vae(),o="[object Map]",l="[object Object]",u="[object Promise]",f="[object Set]",d="[object WeakMap]",p="[object DataView]",m=s(e),E=s(t),S=s(n),g=s(r),y=s(i),v=a;return(e&&v(new e(new ArrayBuffer(1)))!=p||t&&v(new t)!=o||n&&v(n.resolve())!=u||r&&v(new r)!=f||i&&v(new i)!=d)&&(v=function(x){var T=a(x),w=T==l?x.constructor:void 0,C=w?s(w):"";if(C)switch(C){case m:return p;case E:return o;case S:return u;case g:return f;case y:return d}return T}),VR=v,VR}var GR,uG;function tMe(){if(uG)return GR;uG=1;var e=Wae(),t=Kae(),n=PPe(),r=XPe(),i=eMe(),a=Na(),s=Xae(),o=Qae(),l=1,u="[object Arguments]",f="[object Array]",d="[object Object]",p=Object.prototype,m=p.hasOwnProperty;function E(S,g,y,v,x,T){var w=a(S),C=a(g),R=w?f:i(S),O=C?f:i(g);R=R==u?d:R,O=O==u?d:O;var N=R==d,D=O==d,L=R==O;if(L&&s(S)){if(!s(g))return!1;w=!0,N=!1}if(L&&!N)return T||(T=new e),w||o(S)?t(S,g,y,v,x,T):n(S,g,R,y,v,x,T);if(!(y&l)){var z=N&&m.call(S,"__wrapped__"),M=D&&m.call(g,"__wrapped__");if(z||M){var V=z?S.value():S,H=M?g.value():g;return T||(T=new e),x(V,H,y,v,T)}}return L?(T||(T=new e),r(S,g,y,v,x,T)):!1}return GR=E,GR}var qR,cG;function O3(){if(cG)return qR;cG=1;var e=tMe(),t=Lu();function n(r,i,a,s,o){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,a,s,n,o)}return qR=n,qR}var KR,dG;function nMe(){if(dG)return KR;dG=1;var e=Wae(),t=O3(),n=1,r=2;function i(a,s,o,l){var u=o.length,f=u,d=!l;if(a==null)return!f;for(a=Object(a);u--;){var p=o[u];if(d&&p[2]?p[1]!==a[p[0]]:!(p[0]in a))return!1}for(;++u<f;){p=o[u];var m=p[0],E=a[m],S=p[1];if(d&&p[2]){if(E===void 0&&!(m in a))return!1}else{var g=new e;if(l)var y=l(E,S,m,a,s,g);if(!(y===void 0?t(S,E,n|r,l,g):y))return!1}}return!0}return KR=i,KR}var YR,fG;function tse(){if(fG)return YR;fG=1;var e=od();function t(n){return n===n&&!e(n)}return YR=t,YR}var XR,hG;function rMe(){if(hG)return XR;hG=1;var e=tse(),t=Rw();function n(r){for(var i=t(r),a=i.length;a--;){var s=i[a],o=r[s];i[a]=[s,o,e(o)]}return i}return XR=n,XR}var ZR,pG;function nse(){if(pG)return ZR;pG=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return ZR=e,ZR}var QR,mG;function iMe(){if(mG)return QR;mG=1;var e=nMe(),t=rMe(),n=nse();function r(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(s){return s===i||e(s,i,a)}}return QR=r,QR}var JR,gG;function aMe(){if(gG)return JR;gG=1;function e(t,n){return t!=null&&n in Object(t)}return JR=e,JR}var e2,bG;function sMe(){if(bG)return e2;bG=1;var e=Eae(),t=C3(),n=Na(),r=A3(),i=k3(),a=Tw();function s(o,l,u){l=e(l,o);for(var f=-1,d=l.length,p=!1;++f<d;){var m=a(l[f]);if(!(p=o!=null&&u(o,m)))break;o=o[m]}return p||++f!=d?p:(d=o==null?0:o.length,!!d&&i(d)&&r(m,d)&&(n(o)||t(o)))}return e2=s,e2}var t2,vG;function oMe(){if(vG)return t2;vG=1;var e=aMe(),t=sMe();function n(r,i){return r!=null&&t(r,i,e)}return t2=n,t2}var n2,yG;function lMe(){if(yG)return n2;yG=1;var e=O3(),t=Sae(),n=oMe(),r=d3(),i=tse(),a=nse(),s=Tw(),o=1,l=2;function u(f,d){return r(f)&&i(d)?a(s(f),d):function(p){var m=t(p,f);return m===void 0&&m===d?n(p,f):e(d,m,o|l)}}return n2=u,n2}var r2,_G;function Vm(){if(_G)return r2;_G=1;function e(t){return t}return r2=e,r2}var i2,EG;function uMe(){if(EG)return i2;EG=1;function e(t){return function(n){return n?.[t]}}return i2=e,i2}var a2,SG;function cMe(){if(SG)return a2;SG=1;var e=b3();function t(n){return function(r){return e(r,n)}}return a2=t,a2}var s2,xG;function dMe(){if(xG)return s2;xG=1;var e=uMe(),t=cMe(),n=d3(),r=Tw();function i(a){return n(a)?e(r(a)):t(a)}return s2=i,s2}var o2,wG;function _l(){if(wG)return o2;wG=1;var e=iMe(),t=lMe(),n=Vm(),r=Na(),i=dMe();function a(s){return typeof s=="function"?s:s==null?n:typeof s=="object"?r(s)?t(s[0],s[1]):e(s):i(s)}return o2=a,o2}var l2,TG;function rse(){if(TG)return l2;TG=1;function e(t,n,r,i){for(var a=t.length,s=r+(i?1:-1);i?s--:++s<a;)if(n(t[s],s,t))return s;return-1}return l2=e,l2}var u2,CG;function fMe(){if(CG)return u2;CG=1;function e(t){return t!==t}return u2=e,u2}var c2,AG;function hMe(){if(AG)return c2;AG=1;function e(t,n,r){for(var i=r-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return c2=e,c2}var d2,kG;function pMe(){if(kG)return d2;kG=1;var e=rse(),t=fMe(),n=hMe();function r(i,a,s){return a===a?n(i,a,s):e(i,t,s)}return d2=r,d2}var f2,OG;function mMe(){if(OG)return f2;OG=1;var e=pMe();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return f2=t,f2}var h2,RG;function gMe(){if(RG)return h2;RG=1;function e(t,n,r){for(var i=-1,a=t==null?0:t.length;++i<a;)if(r(n,t[i]))return!0;return!1}return h2=e,h2}var p2,NG;function bMe(){if(NG)return p2;NG=1;function e(){}return p2=e,p2}var m2,IG;function vMe(){if(IG)return m2;IG=1;var e=ese(),t=bMe(),n=T3(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(a){return new e(a)}:t;return m2=i,m2}var g2,DG;function yMe(){if(DG)return g2;DG=1;var e=Vae(),t=mMe(),n=gMe(),r=qae(),i=vMe(),a=T3(),s=200;function o(l,u,f){var d=-1,p=t,m=l.length,E=!0,S=[],g=S;if(f)E=!1,p=n;else if(m>=s){var y=u?null:i(l);if(y)return a(y);E=!1,p=r,g=new e}else g=u?[]:S;e:for(;++d<m;){var v=l[d],x=u?u(v):v;if(v=f||v!==0?v:0,E&&x===x){for(var T=g.length;T--;)if(g[T]===x)continue e;u&&g.push(x),S.push(v)}else p(g,x,f)||(g!==S&&g.push(x),S.push(v))}return S}return g2=o,g2}var b2,LG;function _Me(){if(LG)return b2;LG=1;var e=_l(),t=yMe();function n(r,i){return r&&r.length?t(r,e(i,2)):[]}return b2=n,b2}var EMe=_Me();const PG=Sn(EMe);function ise(e,t,n){return t===!0?PG(e,n):Gt(t)?PG(e,t):e}function Qp(e){"@babel/helpers - typeof";return Qp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qp(e)}var SMe=["ref"];function MG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?MG(Object(n),!0).forEach(function(r){Nw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MG(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jG(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sse(r.key),r)}}function wMe(e,t,n){return t&&jG(e.prototype,t),n&&jG(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function TMe(e,t,n){return t=bS(t),CMe(e,ase()?Reflect.construct(t,n||[],bS(e).constructor):t.apply(e,n))}function CMe(e,t){if(t&&(Qp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AMe(e)}function AMe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ase(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ase=function(){return!!e})()}function bS(e){return bS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bS(e)}function kMe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UD(e,t)}function UD(e,t){return UD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},UD(e,t)}function Nw(e,t,n){return t=sse(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sse(e){var t=OMe(e,"string");return Qp(t)=="symbol"?t:t+""}function OMe(e,t){if(Qp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function RMe(e,t){if(e==null)return{};var n=NMe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function NMe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function IMe(e){return e.value}function DMe(e,t){if(oe.isValidElement(e))return oe.cloneElement(e,t);if(typeof e=="function")return oe.createElement(e,t);t.ref;var n=RMe(t,SMe);return oe.createElement(w3,n)}var FG=1,Cp=(function(e){function t(){var n;xMe(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=TMe(this,t,[].concat(i)),Nw(n,"lastBoundingBox",{width:-1,height:-1}),n}return kMe(t,e),wMe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>FG||Math.abs(i.height-this.lastBoundingBox.height)>FG)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Xl({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,a=i.layout,s=i.align,o=i.verticalAlign,l=i.margin,u=i.chartWidth,f=i.chartHeight,d,p;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&a==="vertical"){var m=this.getBBoxSnapshot();d={left:((u||0)-m.width)/2}}else d=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(o==="middle"){var E=this.getBBoxSnapshot();p={top:((f||0)-E.height)/2}}else p=o==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Xl(Xl({},d),p)}},{key:"render",value:function(){var r=this,i=this.props,a=i.content,s=i.width,o=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,f=i.payload,d=Xl(Xl({position:"absolute",width:s||"auto",height:o||"auto"},this.getDefaultPosition(l)),l);return oe.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(m){r.wrapperNode=m}},DMe(a,Xl(Xl({},this.props),{},{payload:ise(f,u,IMe)})))}}],[{key:"getWithHeight",value:function(r,i){var a=Xl(Xl({},this.defaultProps),r.props),s=a.layout;return s==="vertical"&&at(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])})(k.PureComponent);Nw(Cp,"displayName","Legend");Nw(Cp,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var v2,BG;function LMe(){if(BG)return v2;BG=1;var e=h0(),t=C3(),n=Na(),r=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(r&&a&&a[r])}return v2=i,v2}var y2,UG;function ose(){if(UG)return y2;UG=1;var e=Yae(),t=LMe();function n(r,i,a,s,o){var l=-1,u=r.length;for(a||(a=t),o||(o=[]);++l<u;){var f=r[l];i>0&&a(f)?i>1?n(f,i-1,a,s,o):e(o,f):s||(o[o.length]=f)}return o}return y2=n,y2}var _2,$G;function PMe(){if($G)return _2;$G=1;function e(t){return function(n,r,i){for(var a=-1,s=Object(n),o=i(n),l=o.length;l--;){var u=o[t?l:++a];if(r(s[u],u,s)===!1)break}return n}}return _2=e,_2}var E2,zG;function MMe(){if(zG)return E2;zG=1;var e=PMe(),t=e();return E2=t,E2}var S2,HG;function lse(){if(HG)return S2;HG=1;var e=MMe(),t=Rw();function n(r,i){return r&&e(r,i,t)}return S2=n,S2}var x2,WG;function jMe(){if(WG)return x2;WG=1;var e=m0();function t(n,r){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var s=i.length,o=r?s:-1,l=Object(i);(r?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return x2=t,x2}var w2,VG;function R3(){if(VG)return w2;VG=1;var e=lse(),t=jMe(),n=t(e);return w2=n,w2}var T2,GG;function use(){if(GG)return T2;GG=1;var e=R3(),t=m0();function n(r,i){var a=-1,s=t(r)?Array(r.length):[];return e(r,function(o,l,u){s[++a]=i(o,l,u)}),s}return T2=n,T2}var C2,qG;function FMe(){if(qG)return C2;qG=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return C2=e,C2}var A2,KG;function BMe(){if(KG)return A2;KG=1;var e=zm();function t(n,r){if(n!==r){var i=n!==void 0,a=n===null,s=n===n,o=e(n),l=r!==void 0,u=r===null,f=r===r,d=e(r);if(!u&&!d&&!o&&n>r||o&&l&&f&&!u&&!d||a&&l&&f||!i&&f||!s)return 1;if(!a&&!o&&!d&&n<r||d&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!f)return-1}return 0}return A2=t,A2}var k2,YG;function UMe(){if(YG)return k2;YG=1;var e=BMe();function t(n,r,i){for(var a=-1,s=n.criteria,o=r.criteria,l=s.length,u=i.length;++a<l;){var f=e(s[a],o[a]);if(f){if(a>=u)return f;var d=i[a];return f*(d=="desc"?-1:1)}}return n.index-r.index}return k2=t,k2}var O2,XG;function $Me(){if(XG)return O2;XG=1;var e=g3(),t=b3(),n=_l(),r=use(),i=FMe(),a=Zae(),s=UMe(),o=Vm(),l=Na();function u(f,d,p){d.length?d=e(d,function(S){return l(S)?function(g){return t(g,S.length===1?S[0]:S)}:S}):d=[o];var m=-1;d=e(d,a(n));var E=r(f,function(S,g,y){var v=e(d,function(x){return x(S)});return{criteria:v,index:++m,value:S}});return i(E,function(S,g){return s(S,g,p)})}return O2=u,O2}var R2,ZG;function zMe(){if(ZG)return R2;ZG=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return R2=e,R2}var N2,QG;function HMe(){if(QG)return N2;QG=1;var e=zMe(),t=Math.max;function n(r,i,a){return i=t(i===void 0?r.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var f=Array(i+1);++o<i;)f[o]=s[o];return f[i]=a(u),e(r,this,f)}}return N2=n,N2}var I2,JG;function WMe(){if(JG)return I2;JG=1;function e(t){return function(){return t}}return I2=e,I2}var D2,eq;function cse(){if(eq)return D2;eq=1;var e=th(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return D2=t,D2}var L2,tq;function VMe(){if(tq)return L2;tq=1;var e=WMe(),t=cse(),n=Vm(),r=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return L2=r,L2}var P2,nq;function GMe(){if(nq)return P2;nq=1;var e=800,t=16,n=Date.now;function r(i){var a=0,s=0;return function(){var o=n(),l=t-(o-s);if(s=o,l>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return P2=r,P2}var M2,rq;function qMe(){if(rq)return M2;rq=1;var e=VMe(),t=GMe(),n=t(e);return M2=n,M2}var j2,iq;function KMe(){if(iq)return j2;iq=1;var e=Vm(),t=HMe(),n=qMe();function r(i,a){return n(t(i,a,e),i+"")}return j2=r,j2}var F2,aq;function Iw(){if(aq)return F2;aq=1;var e=h3(),t=m0(),n=A3(),r=od();function i(a,s,o){if(!r(o))return!1;var l=typeof s;return(l=="number"?t(o)&&n(s,o.length):l=="string"&&s in o)?e(o[s],a):!1}return F2=i,F2}var B2,sq;function YMe(){if(sq)return B2;sq=1;var e=ose(),t=$Me(),n=KMe(),r=Iw(),i=n(function(a,s){if(a==null)return[];var o=s.length;return o>1&&r(a,s[0],s[1])?s=[]:o>2&&r(s[0],s[1],s[2])&&(s=[s[0]]),t(a,e(s,1),[])});return B2=i,B2}var XMe=YMe();const N3=Sn(XMe);function Gv(e){"@babel/helpers - typeof";return Gv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gv(e)}function $D(){return $D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$D.apply(this,arguments)}function ZMe(e,t){return t3e(e)||e3e(e,t)||JMe(e,t)||QMe()}function QMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -110,7 +110,7 @@ ${n.map(([a,s])=>{const o=s.theme?.[r]||s.color;return o?` --color-${a}: ${o};`
|
|
|
110
110
|
`)}
|
|
111
111
|
}
|
|
112
112
|
`).join(`
|
|
113
|
-
`)}}):null},WX=zo;function VX({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:l,formatter:u,color:f,nameKey:d,labelKey:p}){const{config:m}=QHe(),E=k.useMemo(()=>{if(i||!t?.length)return null;const[g]=t,y=`${p||g?.dataKey||g?.name||"value"}`,v=GX(m,g,y),x=!p&&typeof s=="string"?m[s]?.label||s:v?.label;return o?b.jsx("div",{className:Be("font-medium",l),children:o(x,t)}):x?b.jsx("div",{className:Be("font-medium",l),children:x}):null},[s,o,t,i,l,m,p]);if(!e||!t?.length)return null;const S=t.length===1&&r!=="dot";return b.jsxs("div",{className:Be("border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs/relaxed shadow-xl grid min-w-[8rem] items-start",n),children:[S?null:E,b.jsx("div",{className:"grid gap-1.5",children:t.filter(g=>g.type!=="none").map((g,y)=>{const v=`${d||g.name||g.dataKey||"value"}`,x=GX(m,g,v),T=f||g.payload.fill||g.color;return b.jsx("div",{className:Be("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:u&&g?.value!==void 0&&g.name?u(g.value,g.name,g,y,g.payload):b.jsxs(b.Fragment,{children:[x?.icon?b.jsx(x.icon,{}):!a&&b.jsx("div",{className:Be("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":T,"--color-border":T}}),b.jsxs("div",{className:Be("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[b.jsxs("div",{className:"grid gap-1.5",children:[S?E:null,b.jsx("span",{className:"text-muted-foreground",children:x?.label||g.name})]}),g.value&&b.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:g.value.toLocaleString()})]})]})},g.dataKey)})})]})}function GX(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in e?e[i]:e[n]}const ku="";function eWe(e="vibora"){return qn({queryKey:["monitoring","claude-instances",e],queryFn:()=>zt(`${ku}/api/monitoring/claude-instances?filter=${e}`),refetchInterval:5e3})}function tWe(e="1h"){return qn({queryKey:["monitoring","system-metrics",e],queryFn:()=>zt(`${ku}/api/monitoring/system-metrics?window=${e}`),refetchInterval:5e3})}function nWe(){const e=wr();return Fn({mutationFn:({terminalId:t,pid:n})=>{if(t)return zt(`${ku}/api/monitoring/claude-instances/${t}/kill`,{method:"POST"});if(n)return zt(`${ku}/api/monitoring/claude-instances/${n}/kill-pid`,{method:"POST"});throw new Error("Either terminalId or pid must be provided")},onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","claude-instances"]})}})}function _b(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function qX(e){return{"1m":"1 min","10m":"10 min","1h":"1 hour","3h":"3 hours","6h":"6 hours","12h":"12 hours","24h":"24 hours"}[e]}function rWe(e="memory",t=10){return qn({queryKey:["monitoring","top-processes",e,t],queryFn:()=>zt(`${ku}/api/monitoring/top-processes?sort=${e}&limit=${t}`),refetchInterval:5e3})}function iWe(){return qn({queryKey:["monitoring","docker-stats"],queryFn:()=>zt(`${ku}/api/monitoring/docker-stats`),refetchInterval:5e3})}function aWe(){return qn({queryKey:["monitoring","vibora-instances"],queryFn:()=>zt(`${ku}/api/monitoring/vibora-instances`),refetchInterval:5e3})}function sWe(){const e=wr();return Fn({mutationFn:({backendPid:t})=>zt(`${ku}/api/monitoring/vibora-instances/${t}/kill`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","vibora-instances"]})}})}function oWe(){return qn({queryKey:["monitoring","claude-usage"],queryFn:()=>zt(`${ku}/api/monitoring/claude-usage`),refetchInterval:5e3})}const lWe=["system","processes","claude","vibora","worktrees","usage"],$le=js("/monitoring/")({component:yWe,validateSearch:e=>({tab:lWe.includes(e.tab)?e.tab:void 0})}),KX=["1m","10m","1h","3h","6h","12h","24h"],YX={cpu:{label:"CPU",color:"var(--chart-system)"},memoryUsed:{label:"Used",color:"var(--chart-system)"},memoryCache:{label:"Cache / Buffers",color:"var(--muted-foreground)"},disk:{label:"Disk",color:"var(--muted-foreground)"}};function uWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("vibora"),[r,i]=k.useState(null),[a,s]=k.useState(new Set),[o,l]=k.useState(!1),{data:u,isLoading:f,error:d}=eWe(t),p=nWe(),m=u?.reduce((x,T)=>x+T.ramMB,0)||0,E=r!==null||o;k.useEffect(()=>{r!==null&&u&&!u.some(x=>x.pid===r)&&i(null)},[r,u]),k.useEffect(()=>{if(a.size>0&&u){const x=new Set([...a].filter(T=>u.some(w=>w.pid===T)));x.size!==a.size&&s(x)}},[a,u]);const S=x=>{i(x.pid);const T=x.isViboraManaged&&x.terminalId?{terminalId:x.terminalId}:{pid:x.pid};p.mutate(T,{onError:()=>i(null)})},g=x=>{s(T=>{const w=new Set(T);return w.has(x)?w.delete(x):w.add(x),w})},y=()=>{u&&(a.size===u.length?s(new Set):s(new Set(u.map(x=>x.pid))))},v=async()=>{if(!u||a.size===0)return;l(!0);const x=u.filter(T=>a.has(T.pid));for(const T of x){const w=T.isViboraManaged&&T.terminalId?{terminalId:T.terminalId}:{pid:T.pid};try{await p.mutateAsync(w)}catch{}}s(new Set),l(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{id:"show-all",checked:t==="all",onCheckedChange:x=>n(x?"all":"vibora")}),b.jsx(Ute,{htmlFor:"show-all",className:"text-sm text-muted-foreground",children:e("claude.showAllInstances")})]}),a.size>0&&b.jsxs(qe,{variant:"destructive",size:"sm",onClick:v,disabled:E,className:"gap-1.5",children:[o?b.jsx(fe,{icon:tn,className:"size-3.5 animate-spin"}):b.jsx(fe,{icon:fi,className:"size-3.5"}),e("claude.killSelected",{count:a.size})]})]}),u&&b.jsxs("span",{className:"text-sm text-muted-foreground",children:[e("claude.instanceCount",{count:u.length}),m>0&&` · ${e("claude.totalRam",{ram:m.toFixed(0)})}`]})]}),f&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),d&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("claude.error",{message:d.message})}),u&&u.length===0&&b.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e("claude.empty"),t==="vibora"&&e("claude.emptyVibora")]}),u&&u.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(hi,{checked:a.size===u.length,onCheckedChange:y,disabled:E})}),b.jsx("span",{children:e("claude.headers.pid")}),b.jsx("span",{children:e("claude.headers.terminal")}),b.jsx("span",{children:e("claude.headers.task")}),b.jsx("span",{children:e("claude.headers.workingDirectory")}),b.jsx("span",{className:"text-right",children:e("claude.headers.ram")}),b.jsx("span",{className:"text-right",children:e("claude.headers.actions")})]}),u.map(x=>b.jsxs(wa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(hi,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:E,className:"shrink-0"}),b.jsx("span",{className:"text-sm font-medium truncate",children:x.taskId?b.jsx(Ai,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):b.jsx("span",{className:"text-muted-foreground",children:x.isViboraManaged?x.terminalName:e("claude.source.external")})})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx(qe,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:E,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${E?"opacity-50":""}`,children:b.jsx(fe,{icon:r===x.pid?tn:fi,className:`size-3.5 ${r===x.pid?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate pl-6",title:x.cwd,children:x.cwd})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] items-center gap-4",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(hi,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:E})}),b.jsx("span",{className:"font-mono text-xs",children:x.pid}),b.jsx("span",{className:"truncate text-sm",children:x.isViboraManaged?b.jsx("span",{children:x.terminalName||`Terminal ${x.terminalId?.slice(0,8)}`}):b.jsx("span",{className:"text-muted-foreground",children:e("claude.source.external")})}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",children:x.taskId?b.jsx(Ai,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):e("claude.noTask")}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:x.cwd,children:x.cwd}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(qe,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:E,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${E?"opacity-50":""}`,children:[b.jsx(fe,{icon:r===x.pid?tn:fi,className:`size-3.5 ${r===x.pid?"animate-spin":""}`}),r===x.pid?e("claude.killing"):e("claude.kill")]})})]})]},x.pid))]})]})}function cWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("1h"),{data:r,isLoading:i,error:a}=tWe(t),s=r?.dataPoints.map(o=>({time:new Date(o.timestamp*1e3).toLocaleTimeString(),timestamp:o.timestamp,cpu:Math.round(o.cpuPercent*10)/10,memoryUsed:Math.round(o.memoryUsedPercent*10)/10,memoryCache:Math.round(o.memoryCachePercent*10)/10}))||[];return b.jsxs("div",{className:"space-y-6",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(Bi,{value:t,onValueChange:o=>n(o),children:[b.jsx($i,{size:"sm",className:"w-auto gap-2",children:b.jsx(Ui,{})}),b.jsx(zi,{children:KX.map(o=>b.jsx(Cn,{value:o,children:qX(o)},o))})]})}),b.jsx("div",{className:"hidden sm:flex gap-1",children:KX.map(o=>b.jsx(qe,{variant:t===o?"secondary":"ghost",size:"xs",onClick:()=>n(o),children:qX(o)},o))}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("system.error",{message:a.message})}),r&&b.jsxs("div",{className:"space-y-6",children:[b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.cpuUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.cpu.toFixed(1),"%"]})]}),b.jsx(HX,{config:YX,className:"h-[150px] w-full",children:b.jsxs(zX,{data:s,margin:{left:0,right:0},children:[b.jsx(FL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(wy,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(Ty,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(WX,{content:b.jsx(VX,{hideLabel:!0,formatter:o=>[`${o}% `,"CPU"]})}),b.jsx(il,{type:"monotone",dataKey:"cpu",stroke:"var(--color-cpu)",fill:"var(--color-cpu)",fillOpacity:.4,strokeWidth:2})]})})]}),b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.memoryUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[_b(r.current.memory.used)," ",e("system.memoryLabels.used").toLowerCase()," + ",_b(r.current.memory.cache)," ",e("system.memoryLabels.cache").toLowerCase()," / ",_b(r.current.memory.total)]})]}),b.jsx(HX,{config:YX,className:"h-[150px] w-full",children:b.jsxs(zX,{data:s,margin:{left:0,right:0},children:[b.jsx(FL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(wy,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(Ty,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(WX,{content:b.jsx(VX,{hideLabel:!0,formatter:(o,l)=>{const u=e(l==="memoryUsed"?"system.memoryLabels.used":"system.memoryLabels.cache");return[`${o}% `,u]}})}),b.jsx(il,{type:"monotone",dataKey:"memoryUsed",stroke:"var(--color-memoryUsed)",fill:"var(--color-memoryUsed)",fillOpacity:.5,strokeWidth:2,stackId:"memory"}),b.jsx(il,{type:"monotone",dataKey:"memoryCache",stroke:"var(--color-memoryCache)",fill:"var(--color-memoryCache)",fillOpacity:.4,strokeWidth:1,stackId:"memory"})]})})]}),b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.diskUsage",{path:r.current.disk.path})}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.disk.usedPercent.toFixed(1),"% (",_b(r.current.disk.used)," /"," ",_b(r.current.disk.total),")"]})]}),b.jsx("div",{className:"h-4 w-full overflow-hidden rounded-full bg-muted",children:b.jsx("div",{className:"h-full bg-chart-system transition-all",style:{width:`${Math.min(r.current.disk.usedPercent,100)}%`}})})]})]})]})}function dWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("memory"),{data:r,isLoading:i,error:a}=rWe(t),{data:s,isLoading:o}=iWe();return b.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start",children:[b.jsxs(wa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between shrink-0",children:[b.jsx("h3",{className:"font-medium",children:e("processes.topProcesses")}),b.jsxs(Bi,{value:t,onValueChange:l=>n(l),children:[b.jsx($i,{className:"w-32",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"memory",children:e("processes.sortBy.memory")}),b.jsx(Cn,{value:"cpu",children:e("processes.sortBy.cpu")})]})]})]}),i&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("processes.error",{message:a.message})}),r&&r.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.pid")}),b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{children:e("processes.headers.command")}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),r.map(l=>b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.pid}),b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsx("span",{className:"truncate text-muted-foreground text-xs",title:l.command,children:l.command}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.pid))]})}),r&&r.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.empty")})]}),b.jsxs(wa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsx("div",{className:"mb-4 flex items-center justify-between shrink-0",children:b.jsxs("h3",{className:"font-medium",children:[e("processes.containers"),s?.runtime&&b.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(",s.runtime,")"]})]})}),o&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),s&&!s.available&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersUnavailable")}),s&&s.available&&s.containers.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersEmpty")}),s&&s.available&&s.containers.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{className:"text-right",children:"CPU"}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),s.containers.map(l=>b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.cpuPercent.toFixed(1),"%"]}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," / ",l.memoryLimit.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.id))]})})]})]})}function fWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState(null),{data:r,isLoading:i,error:a}=aWe(),s=sWe();k.useEffect(()=>{t!==null&&r&&!r.some(l=>l.backend?.pid===t)&&n(null)},[t,r]);const o=l=>{l.backend&&(n(l.backend.pid),s.mutate({backendPid:l.backend.pid},{onError:()=>n(null)}))};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.description")}),r&&r.length>0&&b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.instanceCount",{count:r.length})})]}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("vibora.error",{message:a.message})}),r&&r.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:e("vibora.empty")}),r&&r.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("vibora.headers.port")}),b.jsx("span",{children:e("vibora.headers.mode")}),b.jsx("span",{children:e("vibora.headers.directory")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.ram")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.actions")})]}),r.map(l=>{const u=t===l.backend?.pid,f=t!==null;return b.jsxs(wa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("span",{className:"text-sm font-medium",children:[b.jsxs("span",{className:"font-mono",children:[":",l.port]}),b.jsxs("span",{className:`ml-2 text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx(qe,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:b.jsx(fe,{icon:u?tn:fi,className:`size-3.5 ${u?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate",title:l.viboraDir,children:l.viboraDir})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] items-center gap-4",children:[b.jsx("span",{className:"font-mono text-sm",children:l.port}),b.jsxs("span",{className:`text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:l.viboraDir,children:l.viboraDir}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(qe,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:[b.jsx(fe,{icon:u?tn:fi,className:`size-3.5 ${u?"animate-spin":""}`}),e(u?"vibora.killing":"vibora.kill")]})})]})]},l.backend?.pid||l.port)})]})]})}function hWe(e){return e>=90?"text-destructive":e>=70?"text-muted-foreground":"text-chart-system"}function pWe(e){if(e<60)return`${e}m`;const t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}function WN(e){const t=new Date(e),n=new Date,r=t.getTime()-n.getTime(),i=Math.floor(r/(1e3*60*60*24));return i===0?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):i===1?`Tomorrow ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:i<7?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function W_({percent:e,label:t,subtitle:n,color:r}){const i=[{value:Math.min(e,100),fill:r}],a=Math.round(96*yc),s=Math.round(48*yc),o=Math.round(32*yc),l=Math.round(44*yc),u=Math.round(10*yc),f=Math.round(5*yc);return b.jsx(wa,{className:"p-4",children:b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative size-24 shrink-0",children:[b.jsxs(XHe,{width:a,height:a,cx:s,cy:s,innerRadius:o,outerRadius:l,barSize:u,data:i,startAngle:90,endAngle:-270,children:[b.jsx(_0,{type:"number",domain:[0,100],angleAxisId:0,tick:!1}),b.jsx(E0,{background:{fill:"var(--border)"},dataKey:"value",cornerRadius:f,angleAxisId:0})]}),b.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:b.jsxs("span",{className:`text-lg font-semibold tabular-nums ${hWe(e)}`,children:[e.toFixed(0),"%"]})})]}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("h3",{className:"text-sm font-medium truncate",children:t}),b.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})]})})}function mWe(){const{t:e}=rn("monitoring"),{data:t,isLoading:n,error:r}=oWe(),i=a=>a>=90?"var(--destructive)":a>=70?"var(--muted-foreground)":"var(--chart-system)";return b.jsxs("div",{className:"space-y-4",children:[n&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),r&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("usage.error",{message:r.message})}),t&&!t.available&&b.jsx("div",{className:"rounded-lg border border-muted-foreground/50 bg-muted p-4 text-sm text-muted-foreground",children:t.error||e("usage.unavailable")}),t&&t.available&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.fiveHour&&b.jsx(W_,{percent:t.fiveHour.percentUsed,label:e("usage.fiveHourBlock"),subtitle:e("usage.resetsIn",{time:pWe(t.fiveHour.timeRemainingMinutes)}),color:i(t.fiveHour.percentUsed)}),t.sevenDay&&b.jsx(W_,{percent:t.sevenDay.percentUsed,label:e("usage.sevenDayRolling"),subtitle:`${e("usage.resetsAt",{time:WN(t.sevenDay.resetAt)})} · ${e("usage.weekProgress",{percent:t.sevenDay.weekProgressPercent})}`,color:i(t.sevenDay.percentUsed)})]}),(t.sevenDayOpus||t.sevenDaySonnet)&&b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.sevenDayOpus&&b.jsx(W_,{percent:t.sevenDayOpus.percentUsed,label:e("usage.opusWeekly"),subtitle:e("usage.resetsAt",{time:WN(t.sevenDayOpus.resetAt)}),color:i(t.sevenDayOpus.percentUsed)}),t.sevenDaySonnet&&b.jsx(W_,{percent:t.sevenDaySonnet.percentUsed,label:e("usage.sonnetWeekly"),subtitle:e("usage.resetsAt",{time:WN(t.sevenDaySonnet.resetAt)}),color:i(t.sevenDaySonnet.percentUsed)})]})]})]})}const VN={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},gWe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function bWe(){const{t:e}=rn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function vWe(){const{t:e}=rn("common"),{t}=rn("worktrees"),n=bWe(),{worktrees:r,summary:i,isLoading:a,isLoadingDetails:s,error:o,refetch:l}=wie(),u=Tie(),[f,d]=k.useState(new Set),[p,m]=k.useState(!1),[E,S]=k.useState(!1),[g,y]=k.useState(!1),[v,x]=k.useState(null),[T,w]=k.useState(null),[C,R]=k.useState(!1),O=B=>{d(q=>{const K=new Set(q);return K.has(B)?K.delete(B):K.add(B),K})},N=()=>{d(new Set)},D=k.useMemo(()=>f.size===0?r:r.filter(B=>!!(B.isOrphaned&&f.has("ORPHANED")||B.taskStatus&&f.has(B.taskStatus))),[r,f]),L=k.useMemo(()=>r.filter(B=>B.taskStatus==="DONE"||B.taskStatus==="CANCELED"),[r]),z=async()=>{if(L.length!==0){S(!0);try{for(const B of L)await u.mutateAsync({worktreePath:B.path,repoPath:B.repoPath,deleteLinkedTask:g});m(!1),l()}catch{}finally{S(!1)}}},M=async(B,q)=>{x(B.path);try{await u.mutateAsync({worktreePath:B.path,repoPath:B.repoPath,deleteLinkedTask:q}),w(null),l()}catch{}finally{x(null)}},V=B=>{B||(w(null),R(!1))},H=B=>{m(B),B||y(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[b.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:(i||r.length>0)&&b.jsxs(b.Fragment,{children:[b.jsx("span",{children:t("summary.total",{count:i?.total??r.length})}),(i?.orphaned??r.filter(B=>B.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:i?.orphaned??r.filter(B=>B.isOrphaned).length})}),s?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):i?b.jsx("span",{children:i.totalSizeFormatted}):null]})}),b.jsxs("div",{className:"flex items-center gap-2",children:[L.length>0&&b.jsxs(go,{open:p,onOpenChange:H,children:[b.jsxs(wu,{render:b.jsx(qe,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[b.jsx(fe,{icon:hte,size:12,strokeWidth:2}),t("cleanup.button",{count:L.length})]}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("cleanup.title")}),b.jsxs(Eo,{children:[t("cleanup.description",{count:L.length}),g&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:g,onCheckedChange:B=>y(B===!0),disabled:E}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:E,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:z,disabled:E,className:"gap-2",children:[E&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),E?e("status.deleting"):t("delete.button",{count:L.length})]})]})]})]}),f.size>0&&b.jsxs(qe,{variant:"ghost",size:"sm",onClick:N,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:fi,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:gWe.map(B=>{const q=f.has(B);return b.jsx("button",{onClick:()=>O(B),className:Be("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",q?VN[B]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${B}`)},B)})}),a&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),o&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:t("error.failedToLoad",{message:o.message})}),!a&&!o&&D.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:f.size>0?t("empty.noMatch"):t("empty.noWorktrees")}),!a&&D.length>0&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:D.map(B=>{const q=B.sizeFormatted==="..."||B.branch==="...",K=!B.isOrphaned&&B.taskId,U=v===B.path;return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Mf,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:B.name}),B.isOrphaned?b.jsx(co,{className:Be("shrink-0",VN.ORPHANED),children:e("statuses.ORPHANED")}):B.taskStatus?b.jsx(co,{className:Be("shrink-0",VN[B.taskStatus]),children:e(`statuses.${B.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:B.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),B.branch==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-16"}):b.jsx("span",{className:"font-mono",children:B.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:mte,size:12,strokeWidth:2,className:"shrink-0"}),B.sizeFormatted==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-12"}):b.jsx("span",{children:B.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:cte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:n(B.lastModified)})]})]}),B.taskId&&B.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(Ai,{to:"/tasks/$taskId",params:{taskId:B.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:B.taskTitle}),b.jsx(fe,{icon:Xy,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:T?.path===B.path,onOpenChange:V,children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:q||U,onClick:()=>w(B)}),children:b.jsx(fe,{icon:U?tn:bu,size:14,strokeWidth:2,className:U?"animate-spin":""})}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("delete.title")}),b.jsxs(Eo,{children:[t("delete.description")," ",b.jsx("span",{className:"font-mono",children:B.name}),".",C&&K&&b.jsxs(b.Fragment,{children:[" ",t("delete.linkedTaskWillBeDeleted",{title:B.taskTitle})]})," ",t("delete.cannotUndo")]}),K&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:C,onCheckedChange:j=>R(j===!0),disabled:U}),t("delete.alsoDeleteLinkedTask",{title:B.taskTitle})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:U,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:()=>M(B,C),disabled:U,className:"gap-2",children:[U&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),e(U?"status.deleting":"buttons.delete")]})]})]})]})]})},B.path)})})]})}function yWe(){const{t:e}=rn("monitoring"),{data:t}=Bne(),n=Ri(),{tab:r}=$le.useSearch(),i=r||"system",a=k.useCallback(l=>{n({to:"/monitoring",search:l==="system"?{}:{tab:l},replace:!0})},[n]),o=[{value:"system",label:e("tabs.system")},{value:"processes",label:e("tabs.processes")},{value:"claude",label:e("tabs.claude")},{value:"vibora",label:e("tabs.vibora"),devOnly:!0},{value:"worktrees",label:e("tabs.worktrees")},{value:"usage",label:e("tabs.usage")}].filter(l=>!l.devOnly||t?.enabled);return b.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(Bi,{value:i,onValueChange:l=>a(l),children:[b.jsx($i,{size:"sm",className:"w-auto gap-2",children:b.jsx(Ui,{})}),b.jsx(zi,{children:o.map(l=>b.jsx(Cn,{value:l.value,children:l.label},l.value))})]})}),b.jsx("div",{className:"hidden sm:block",children:b.jsx(Zo,{value:i,onValueChange:l=>a(l),children:b.jsx(Qo,{variant:"line",children:o.map(l=>b.jsx(Wr,{value:l.value,className:"px-3 py-1.5",children:l.label},l.value))})})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i==="system"&&b.jsx(cWe,{}),i==="processes"&&b.jsx(dWe,{}),i==="claude"&&b.jsx(uWe,{}),i==="vibora"&&t?.enabled&&b.jsx(fWe,{}),i==="worktrees"&&b.jsx(vWe,{}),i==="usage"&&b.jsx(mWe,{})]})]})}const _We=()=>"http://localhost:3000",Eb={activeTab:"diff",browserUrl:_We(),diffOptions:{wrap:!0,ignoreWhitespace:!0,includeUntracked:!1,collapsedFiles:[]},filesViewState:{selectedFile:null,expandedDirs:[]}};function g5(e){const t=wr(),n=k.useRef(void 0),r=k.useRef({}),{data:i}=Mne(e),a=k.useMemo(()=>{const p=i?.viewState;return p?{activeTab:p.activeTab??Eb.activeTab,browserUrl:p.browserUrl??Eb.browserUrl,diffOptions:{...Eb.diffOptions,...p.diffOptions},filesViewState:{...Eb.filesViewState,...p.filesViewState}}:Eb},[i?.viewState]),s=Fn({mutationFn:async p=>{const m=await fetch(`/api/tasks/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({viewState:p})});if(!m.ok)throw new Error("Failed to update view state");return m.json()},onSuccess:p=>{t.setQueryData(["tasks",e],p),t.setQueryData(["tasks"],m=>m&&m.map(E=>E.id===e?p:E))}}),o=k.useCallback(p=>{const m=r.current;r.current={...m,...p,diffOptions:p.diffOptions||m.diffOptions?{...m.diffOptions,...p.diffOptions}:void 0,filesViewState:p.filesViewState||m.filesViewState?{...m.filesViewState,...p.filesViewState}:void 0};const E=r.current,S={activeTab:E.activeTab??a.activeTab,browserUrl:E.browserUrl??a.browserUrl,diffOptions:{...a.diffOptions,...E.diffOptions},filesViewState:{...a.filesViewState,...E.filesViewState}};t.setQueryData(["tasks",e],g=>g&&{...g,viewState:S}),t.setQueryData(["tasks"],g=>g&&g.map(y=>y.id===e?{...y,viewState:S}:y)),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.mutate(S),r.current={}},500)},[t,e,a,s]),l=k.useCallback(p=>{o({activeTab:p})},[o]),u=k.useCallback(p=>{o({browserUrl:p})},[o]),f=k.useCallback(p=>{o({diffOptions:p})},[o]),d=k.useCallback(p=>{o({filesViewState:p})},[o]);return{viewState:a,setActiveTab:l,setBrowserUrl:u,setDiffOptions:f,setFilesViewState:d}}function EWe(e){return qn({queryKey:["linear-ticket",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/linear/ticket/${e}`);return t.ok?t.json():null},enabled:!!e,staleTime:300*1e3})}function SWe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function xWe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function b5(e={}){const t=bie();return{get terminals(){return t.terminals.map(SWe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(xWe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup,clearStartingUp:t.clearStartingUp}}function V_(e){return`$'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function XX({taskName:e,cwd:t,className:n,aiMode:r,description:i,startupScript:a,serverPort:s=7777}){const o=k.useRef(null),l=k.useRef(null),u=k.useRef(null),f=k.useRef(!1),d=k.useRef(!1),[p,m]=k.useState(null),[E,S]=k.useState(!1),[g,y]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),{resolvedTheme:C}=Kc(),R=C==="dark",O=R?Vie:Wie;k.useEffect(()=>{At.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),f.current=!1,d.current=!1,m(null),S(!1)},[t]);const{setTerminalFocused:N}=vM(),{terminals:D,terminalsLoaded:L,connected:z,createTerminal:M,attachXterm:V,resizeTerminal:H,setupImagePaste:B,writeToTerminal:q,consumePendingStartup:K,clearStartingUp:U}=b5(),j=k.useRef(V),$=k.useRef(B),Y=k.useRef(q),W=k.useRef(K),J=k.useRef(U);k.useEffect(()=>{j.current=V},[V]),k.useEffect(()=>{$.current=B},[B]),k.useEffect(()=>{Y.current=q},[q]),k.useEffect(()=>{W.current=K},[K]),k.useEffect(()=>{J.current=U},[U]);const ae=p?D.find(Z=>Z.id===p):null,se=ae?.status;k.useEffect(()=>{if(!o.current||l.current)return;const Z=new $ie.Terminal({cursorBlink:!0,fontSize:Math.round(13*yc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:O}),ee=new zie.FitAddon,ne=new Hie.WebLinksAddon;Z.loadAddon(ee),Z.loadAddon(ne),Z.open(o.current),l.current=Z,u.current=ee,x(!0),requestAnimationFrame(()=>{ee.fit()});const te=setTimeout(()=>{ee.fit(),Z.refresh(0,Z.rows-1)},100),ye=()=>N(!0),Ee=()=>N(!1);return Z.textarea&&(Z.textarea.addEventListener("focus",ye),Z.textarea.addEventListener("blur",Ee)),()=>{clearTimeout(te),Z.textarea&&(Z.textarea.removeEventListener("focus",ye),Z.textarea.removeEventListener("blur",Ee)),N(!1),Z.dispose(),l.current=null,u.current=null,x(!1)}},[N]);const Q=k.useCallback(()=>{if(!u.current||!l.current)return;u.current.fit();const{cols:Z,rows:ee}=l.current;p&&H(p,Z,ee)},[p,H]);k.useEffect(()=>{if(!o.current)return;const Z=()=>{requestAnimationFrame(Q)};window.addEventListener("resize",Z);const ee=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})};document.addEventListener("visibilitychange",ee);const ne=new ResizeObserver(Z);ne.observe(o.current);const te=new IntersectionObserver(ye=>{ye[0]?.isIntersecting&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})},{threshold:.1});return te.observe(o.current),()=>{window.removeEventListener("resize",Z),document.removeEventListener("visibilitychange",ee),ne.disconnect(),te.disconnect()}},[Q]),k.useEffect(()=>{if(!z||!t||!v||!L)return;const Z=D.find(ee=>ee.cwd===t);if(Z){m(Z.id);return}if(!f.current&&l.current){f.current=!0,S(!0);const{cols:ee,rows:ne}=l.current;M({name:e,cols:ee,rows:ne,cwd:t,startup:{startupScript:a,aiMode:r,description:i,taskName:e,serverPort:s}})}},[z,t,v,L,D,e,M]),k.useEffect(()=>{if(!t)return;const Z=D.find(ne=>ne.cwd===t);if(!Z)return;const ee=p&&D.some(ne=>ne.id===p);(!p||!ee)&&(At.taskTerminal.debug("setting terminalId",{newId:Z.id,prevId:p,reason:p?"tempId replaced":"initial",cwd:t,terminalCount:D.length}),m(Z.id),S(!1),p&&!ee&&(d.current=!1))},[D,t,p]),k.useEffect(()=>{if(At.taskTerminal.debug("attach effect",{terminalId:p,hasTermRef:!!l.current,hasContainerRef:!!o.current,attachedRef:d.current}),!p||!l.current||!o.current||d.current)return;At.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:p});const Z=te=>{requestAnimationFrame(Q);const ye=W.current(te);if(At.taskTerminal.debug("onAttached checking pending startup",{terminalId:te,hasPendingStartup:!!ye}),ye){At.taskTerminal.info("onAttached: running startup commands",{terminalId:te}),y(!0);const{startupScript:Ee,aiMode:pe,description:_e,taskName:Se,serverPort:Te}=ye;Ee&&setTimeout(()=>{const Ne="VIBORA_STARTUP_"+Date.now(),Pe=`source /dev/stdin <<'${Ne}'
|
|
113
|
+
`)}}):null},WX=zo;function VX({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:l,formatter:u,color:f,nameKey:d,labelKey:p}){const{config:m}=QHe(),E=k.useMemo(()=>{if(i||!t?.length)return null;const[g]=t,y=`${p||g?.dataKey||g?.name||"value"}`,v=GX(m,g,y),x=!p&&typeof s=="string"?m[s]?.label||s:v?.label;return o?b.jsx("div",{className:Be("font-medium",l),children:o(x,t)}):x?b.jsx("div",{className:Be("font-medium",l),children:x}):null},[s,o,t,i,l,m,p]);if(!e||!t?.length)return null;const S=t.length===1&&r!=="dot";return b.jsxs("div",{className:Be("border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs/relaxed shadow-xl grid min-w-[8rem] items-start",n),children:[S?null:E,b.jsx("div",{className:"grid gap-1.5",children:t.filter(g=>g.type!=="none").map((g,y)=>{const v=`${d||g.name||g.dataKey||"value"}`,x=GX(m,g,v),T=f||g.payload.fill||g.color;return b.jsx("div",{className:Be("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:u&&g?.value!==void 0&&g.name?u(g.value,g.name,g,y,g.payload):b.jsxs(b.Fragment,{children:[x?.icon?b.jsx(x.icon,{}):!a&&b.jsx("div",{className:Be("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":T,"--color-border":T}}),b.jsxs("div",{className:Be("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[b.jsxs("div",{className:"grid gap-1.5",children:[S?E:null,b.jsx("span",{className:"text-muted-foreground",children:x?.label||g.name})]}),g.value&&b.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:g.value.toLocaleString()})]})]})},g.dataKey)})})]})}function GX(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in e?e[i]:e[n]}const ku="";function eWe(e="vibora"){return qn({queryKey:["monitoring","claude-instances",e],queryFn:()=>zt(`${ku}/api/monitoring/claude-instances?filter=${e}`),refetchInterval:5e3})}function tWe(e="1h"){return qn({queryKey:["monitoring","system-metrics",e],queryFn:()=>zt(`${ku}/api/monitoring/system-metrics?window=${e}`),refetchInterval:5e3})}function nWe(){const e=wr();return Fn({mutationFn:({terminalId:t,pid:n})=>{if(t)return zt(`${ku}/api/monitoring/claude-instances/${t}/kill`,{method:"POST"});if(n)return zt(`${ku}/api/monitoring/claude-instances/${n}/kill-pid`,{method:"POST"});throw new Error("Either terminalId or pid must be provided")},onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","claude-instances"]})}})}function _b(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function qX(e){return{"1m":"1 min","10m":"10 min","1h":"1 hour","3h":"3 hours","6h":"6 hours","12h":"12 hours","24h":"24 hours"}[e]}function rWe(e="memory",t=10){return qn({queryKey:["monitoring","top-processes",e,t],queryFn:()=>zt(`${ku}/api/monitoring/top-processes?sort=${e}&limit=${t}`),refetchInterval:5e3})}function iWe(){return qn({queryKey:["monitoring","docker-stats"],queryFn:()=>zt(`${ku}/api/monitoring/docker-stats`),refetchInterval:5e3})}function aWe(){return qn({queryKey:["monitoring","vibora-instances"],queryFn:()=>zt(`${ku}/api/monitoring/vibora-instances`),refetchInterval:5e3})}function sWe(){const e=wr();return Fn({mutationFn:({backendPid:t})=>zt(`${ku}/api/monitoring/vibora-instances/${t}/kill`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","vibora-instances"]})}})}function oWe(){return qn({queryKey:["monitoring","claude-usage"],queryFn:()=>zt(`${ku}/api/monitoring/claude-usage`),refetchInterval:5e3})}const lWe=["system","processes","claude","vibora","worktrees","usage"],$le=js("/monitoring/")({component:yWe,validateSearch:e=>({tab:lWe.includes(e.tab)?e.tab:void 0})}),KX=["1m","10m","1h","3h","6h","12h","24h"],YX={cpu:{label:"CPU",color:"var(--chart-system)"},memoryUsed:{label:"Used",color:"var(--chart-system)"},memoryCache:{label:"Cache / Buffers",color:"var(--muted-foreground)"},disk:{label:"Disk",color:"var(--muted-foreground)"}};function uWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("vibora"),[r,i]=k.useState(null),[a,s]=k.useState(new Set),[o,l]=k.useState(!1),{data:u,isLoading:f,error:d}=eWe(t),p=nWe(),m=u?.reduce((x,T)=>x+T.ramMB,0)||0,E=r!==null||o;k.useEffect(()=>{r!==null&&u&&!u.some(x=>x.pid===r)&&i(null)},[r,u]),k.useEffect(()=>{if(a.size>0&&u){const x=new Set([...a].filter(T=>u.some(w=>w.pid===T)));x.size!==a.size&&s(x)}},[a,u]);const S=x=>{i(x.pid);const T=x.isViboraManaged&&x.terminalId?{terminalId:x.terminalId}:{pid:x.pid};p.mutate(T,{onError:()=>i(null)})},g=x=>{s(T=>{const w=new Set(T);return w.has(x)?w.delete(x):w.add(x),w})},y=()=>{u&&(a.size===u.length?s(new Set):s(new Set(u.map(x=>x.pid))))},v=async()=>{if(!u||a.size===0)return;l(!0);const x=u.filter(T=>a.has(T.pid));for(const T of x){const w=T.isViboraManaged&&T.terminalId?{terminalId:T.terminalId}:{pid:T.pid};try{await p.mutateAsync(w)}catch{}}s(new Set),l(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx($o,{id:"show-all",checked:t==="all",onCheckedChange:x=>n(x?"all":"vibora")}),b.jsx(Ute,{htmlFor:"show-all",className:"text-sm text-muted-foreground",children:e("claude.showAllInstances")})]}),a.size>0&&b.jsxs(qe,{variant:"destructive",size:"sm",onClick:v,disabled:E,className:"gap-1.5",children:[o?b.jsx(fe,{icon:tn,className:"size-3.5 animate-spin"}):b.jsx(fe,{icon:fi,className:"size-3.5"}),e("claude.killSelected",{count:a.size})]})]}),u&&b.jsxs("span",{className:"text-sm text-muted-foreground",children:[e("claude.instanceCount",{count:u.length}),m>0&&` · ${e("claude.totalRam",{ram:m.toFixed(0)})}`]})]}),f&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),d&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("claude.error",{message:d.message})}),u&&u.length===0&&b.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e("claude.empty"),t==="vibora"&&e("claude.emptyVibora")]}),u&&u.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(hi,{checked:a.size===u.length,onCheckedChange:y,disabled:E})}),b.jsx("span",{children:e("claude.headers.pid")}),b.jsx("span",{children:e("claude.headers.terminal")}),b.jsx("span",{children:e("claude.headers.task")}),b.jsx("span",{children:e("claude.headers.workingDirectory")}),b.jsx("span",{className:"text-right",children:e("claude.headers.ram")}),b.jsx("span",{className:"text-right",children:e("claude.headers.actions")})]}),u.map(x=>b.jsxs(wa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(hi,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:E,className:"shrink-0"}),b.jsx("span",{className:"text-sm font-medium truncate",children:x.taskId?b.jsx(Ai,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):b.jsx("span",{className:"text-muted-foreground",children:x.isViboraManaged?x.terminalName:e("claude.source.external")})})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx(qe,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:E,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${E?"opacity-50":""}`,children:b.jsx(fe,{icon:r===x.pid?tn:fi,className:`size-3.5 ${r===x.pid?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate pl-6",title:x.cwd,children:x.cwd})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] items-center gap-4",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(hi,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:E})}),b.jsx("span",{className:"font-mono text-xs",children:x.pid}),b.jsx("span",{className:"truncate text-sm",children:x.isViboraManaged?b.jsx("span",{children:x.terminalName||`Terminal ${x.terminalId?.slice(0,8)}`}):b.jsx("span",{className:"text-muted-foreground",children:e("claude.source.external")})}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",children:x.taskId?b.jsx(Ai,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):e("claude.noTask")}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:x.cwd,children:x.cwd}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(qe,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:E,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${E?"opacity-50":""}`,children:[b.jsx(fe,{icon:r===x.pid?tn:fi,className:`size-3.5 ${r===x.pid?"animate-spin":""}`}),r===x.pid?e("claude.killing"):e("claude.kill")]})})]})]},x.pid))]})]})}function cWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("1h"),{data:r,isLoading:i,error:a}=tWe(t),s=r?.dataPoints.map(o=>({time:new Date(o.timestamp*1e3).toLocaleTimeString(),timestamp:o.timestamp,cpu:Math.round(o.cpuPercent*10)/10,memoryUsed:Math.round(o.memoryUsedPercent*10)/10,memoryCache:Math.round(o.memoryCachePercent*10)/10}))||[];return b.jsxs("div",{className:"space-y-6",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(Bi,{value:t,onValueChange:o=>n(o),children:[b.jsx($i,{size:"sm",className:"w-auto gap-2",children:b.jsx(Ui,{})}),b.jsx(zi,{children:KX.map(o=>b.jsx(Cn,{value:o,children:qX(o)},o))})]})}),b.jsx("div",{className:"hidden sm:flex gap-1",children:KX.map(o=>b.jsx(qe,{variant:t===o?"default":"ghost",size:"xs",onClick:()=>n(o),children:qX(o)},o))}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("system.error",{message:a.message})}),r&&b.jsxs("div",{className:"space-y-6",children:[b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.cpuUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.cpu.toFixed(1),"%"]})]}),b.jsx(HX,{config:YX,className:"h-[150px] w-full",children:b.jsxs(zX,{data:s,margin:{left:0,right:0},children:[b.jsx(FL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(wy,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(Ty,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(WX,{content:b.jsx(VX,{hideLabel:!0,formatter:o=>[`${o}% `,"CPU"]})}),b.jsx(il,{type:"monotone",dataKey:"cpu",stroke:"var(--color-cpu)",fill:"var(--color-cpu)",fillOpacity:.4,strokeWidth:2})]})})]}),b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.memoryUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[_b(r.current.memory.used)," ",e("system.memoryLabels.used").toLowerCase()," + ",_b(r.current.memory.cache)," ",e("system.memoryLabels.cache").toLowerCase()," / ",_b(r.current.memory.total)]})]}),b.jsx(HX,{config:YX,className:"h-[150px] w-full",children:b.jsxs(zX,{data:s,margin:{left:0,right:0},children:[b.jsx(FL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(wy,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(Ty,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(WX,{content:b.jsx(VX,{hideLabel:!0,formatter:(o,l)=>{const u=e(l==="memoryUsed"?"system.memoryLabels.used":"system.memoryLabels.cache");return[`${o}% `,u]}})}),b.jsx(il,{type:"monotone",dataKey:"memoryUsed",stroke:"var(--color-memoryUsed)",fill:"var(--color-memoryUsed)",fillOpacity:.5,strokeWidth:2,stackId:"memory"}),b.jsx(il,{type:"monotone",dataKey:"memoryCache",stroke:"var(--color-memoryCache)",fill:"var(--color-memoryCache)",fillOpacity:.4,strokeWidth:1,stackId:"memory"})]})})]}),b.jsxs(wa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.diskUsage",{path:r.current.disk.path})}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.disk.usedPercent.toFixed(1),"% (",_b(r.current.disk.used)," /"," ",_b(r.current.disk.total),")"]})]}),b.jsx("div",{className:"h-4 w-full overflow-hidden rounded-full bg-muted",children:b.jsx("div",{className:"h-full bg-chart-system transition-all",style:{width:`${Math.min(r.current.disk.usedPercent,100)}%`}})})]})]})]})}function dWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState("memory"),{data:r,isLoading:i,error:a}=rWe(t),{data:s,isLoading:o}=iWe();return b.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start",children:[b.jsxs(wa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between shrink-0",children:[b.jsx("h3",{className:"font-medium",children:e("processes.topProcesses")}),b.jsxs(Bi,{value:t,onValueChange:l=>n(l),children:[b.jsx($i,{className:"w-32",children:b.jsx(Ui,{})}),b.jsxs(zi,{children:[b.jsx(Cn,{value:"memory",children:e("processes.sortBy.memory")}),b.jsx(Cn,{value:"cpu",children:e("processes.sortBy.cpu")})]})]})]}),i&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("processes.error",{message:a.message})}),r&&r.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.pid")}),b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{children:e("processes.headers.command")}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),r.map(l=>b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.pid}),b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsx("span",{className:"truncate text-muted-foreground text-xs",title:l.command,children:l.command}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.pid))]})}),r&&r.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.empty")})]}),b.jsxs(wa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsx("div",{className:"mb-4 flex items-center justify-between shrink-0",children:b.jsxs("h3",{className:"font-medium",children:[e("processes.containers"),s?.runtime&&b.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(",s.runtime,")"]})]})}),o&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),s&&!s.available&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersUnavailable")}),s&&s.available&&s.containers.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersEmpty")}),s&&s.available&&s.containers.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{className:"text-right",children:"CPU"}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),s.containers.map(l=>b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.cpuPercent.toFixed(1),"%"]}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," / ",l.memoryLimit.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.id))]})})]})]})}function fWe(){const{t:e}=rn("monitoring"),[t,n]=k.useState(null),{data:r,isLoading:i,error:a}=aWe(),s=sWe();k.useEffect(()=>{t!==null&&r&&!r.some(l=>l.backend?.pid===t)&&n(null)},[t,r]);const o=l=>{l.backend&&(n(l.backend.pid),s.mutate({backendPid:l.backend.pid},{onError:()=>n(null)}))};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.description")}),r&&r.length>0&&b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.instanceCount",{count:r.length})})]}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("vibora.error",{message:a.message})}),r&&r.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:e("vibora.empty")}),r&&r.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("vibora.headers.port")}),b.jsx("span",{children:e("vibora.headers.mode")}),b.jsx("span",{children:e("vibora.headers.directory")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.ram")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.actions")})]}),r.map(l=>{const u=t===l.backend?.pid,f=t!==null;return b.jsxs(wa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("span",{className:"text-sm font-medium",children:[b.jsxs("span",{className:"font-mono",children:[":",l.port]}),b.jsxs("span",{className:`ml-2 text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx(qe,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:b.jsx(fe,{icon:u?tn:fi,className:`size-3.5 ${u?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate",title:l.viboraDir,children:l.viboraDir})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] items-center gap-4",children:[b.jsx("span",{className:"font-mono text-sm",children:l.port}),b.jsxs("span",{className:`text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:l.viboraDir,children:l.viboraDir}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(qe,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:[b.jsx(fe,{icon:u?tn:fi,className:`size-3.5 ${u?"animate-spin":""}`}),e(u?"vibora.killing":"vibora.kill")]})})]})]},l.backend?.pid||l.port)})]})]})}function hWe(e){return e>=90?"text-destructive":e>=70?"text-muted-foreground":"text-chart-system"}function pWe(e){if(e<60)return`${e}m`;const t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}function WN(e){const t=new Date(e),n=new Date,r=t.getTime()-n.getTime(),i=Math.floor(r/(1e3*60*60*24));return i===0?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):i===1?`Tomorrow ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:i<7?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function W_({percent:e,label:t,subtitle:n,color:r}){const i=[{value:Math.min(e,100),fill:r}],a=Math.round(96*yc),s=Math.round(48*yc),o=Math.round(32*yc),l=Math.round(44*yc),u=Math.round(10*yc),f=Math.round(5*yc);return b.jsx(wa,{className:"p-4",children:b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative size-24 shrink-0",children:[b.jsxs(XHe,{width:a,height:a,cx:s,cy:s,innerRadius:o,outerRadius:l,barSize:u,data:i,startAngle:90,endAngle:-270,children:[b.jsx(_0,{type:"number",domain:[0,100],angleAxisId:0,tick:!1}),b.jsx(E0,{background:{fill:"var(--border)"},dataKey:"value",cornerRadius:f,angleAxisId:0})]}),b.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:b.jsxs("span",{className:`text-lg font-semibold tabular-nums ${hWe(e)}`,children:[e.toFixed(0),"%"]})})]}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("h3",{className:"text-sm font-medium truncate",children:t}),b.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})]})})}function mWe(){const{t:e}=rn("monitoring"),{data:t,isLoading:n,error:r}=oWe(),i=a=>a>=90?"var(--destructive)":a>=70?"var(--muted-foreground)":"var(--chart-system)";return b.jsxs("div",{className:"space-y-4",children:[n&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),r&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("usage.error",{message:r.message})}),t&&!t.available&&b.jsx("div",{className:"rounded-lg border border-muted-foreground/50 bg-muted p-4 text-sm text-muted-foreground",children:t.error||e("usage.unavailable")}),t&&t.available&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.fiveHour&&b.jsx(W_,{percent:t.fiveHour.percentUsed,label:e("usage.fiveHourBlock"),subtitle:e("usage.resetsIn",{time:pWe(t.fiveHour.timeRemainingMinutes)}),color:i(t.fiveHour.percentUsed)}),t.sevenDay&&b.jsx(W_,{percent:t.sevenDay.percentUsed,label:e("usage.sevenDayRolling"),subtitle:`${e("usage.resetsAt",{time:WN(t.sevenDay.resetAt)})} · ${e("usage.weekProgress",{percent:t.sevenDay.weekProgressPercent})}`,color:i(t.sevenDay.percentUsed)})]}),(t.sevenDayOpus||t.sevenDaySonnet)&&b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.sevenDayOpus&&b.jsx(W_,{percent:t.sevenDayOpus.percentUsed,label:e("usage.opusWeekly"),subtitle:e("usage.resetsAt",{time:WN(t.sevenDayOpus.resetAt)}),color:i(t.sevenDayOpus.percentUsed)}),t.sevenDaySonnet&&b.jsx(W_,{percent:t.sevenDaySonnet.percentUsed,label:e("usage.sonnetWeekly"),subtitle:e("usage.resetsAt",{time:WN(t.sevenDaySonnet.resetAt)}),color:i(t.sevenDaySonnet.percentUsed)})]})]})]})}const VN={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},gWe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function bWe(){const{t:e}=rn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function vWe(){const{t:e}=rn("common"),{t}=rn("worktrees"),n=bWe(),{worktrees:r,summary:i,isLoading:a,isLoadingDetails:s,error:o,refetch:l}=wie(),u=Tie(),[f,d]=k.useState(new Set),[p,m]=k.useState(!1),[E,S]=k.useState(!1),[g,y]=k.useState(!1),[v,x]=k.useState(null),[T,w]=k.useState(null),[C,R]=k.useState(!1),O=B=>{d(q=>{const K=new Set(q);return K.has(B)?K.delete(B):K.add(B),K})},N=()=>{d(new Set)},D=k.useMemo(()=>f.size===0?r:r.filter(B=>!!(B.isOrphaned&&f.has("ORPHANED")||B.taskStatus&&f.has(B.taskStatus))),[r,f]),L=k.useMemo(()=>r.filter(B=>B.taskStatus==="DONE"||B.taskStatus==="CANCELED"),[r]),z=async()=>{if(L.length!==0){S(!0);try{for(const B of L)await u.mutateAsync({worktreePath:B.path,repoPath:B.repoPath,deleteLinkedTask:g});m(!1),l()}catch{}finally{S(!1)}}},M=async(B,q)=>{x(B.path);try{await u.mutateAsync({worktreePath:B.path,repoPath:B.repoPath,deleteLinkedTask:q}),w(null),l()}catch{}finally{x(null)}},V=B=>{B||(w(null),R(!1))},H=B=>{m(B),B||y(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[b.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:(i||r.length>0)&&b.jsxs(b.Fragment,{children:[b.jsx("span",{children:t("summary.total",{count:i?.total??r.length})}),(i?.orphaned??r.filter(B=>B.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:i?.orphaned??r.filter(B=>B.isOrphaned).length})}),s?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):i?b.jsx("span",{children:i.totalSizeFormatted}):null]})}),b.jsxs("div",{className:"flex items-center gap-2",children:[L.length>0&&b.jsxs(go,{open:p,onOpenChange:H,children:[b.jsxs(wu,{render:b.jsx(qe,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[b.jsx(fe,{icon:hte,size:12,strokeWidth:2}),t("cleanup.button",{count:L.length})]}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("cleanup.title")}),b.jsxs(Eo,{children:[t("cleanup.description",{count:L.length}),g&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:g,onCheckedChange:B=>y(B===!0),disabled:E}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:E,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:z,disabled:E,className:"gap-2",children:[E&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),E?e("status.deleting"):t("delete.button",{count:L.length})]})]})]})]}),f.size>0&&b.jsxs(qe,{variant:"ghost",size:"sm",onClick:N,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:fi,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:gWe.map(B=>{const q=f.has(B);return b.jsx("button",{onClick:()=>O(B),className:Be("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",q?VN[B]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${B}`)},B)})}),a&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,className:"size-6 animate-spin text-muted-foreground"})}),o&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:t("error.failedToLoad",{message:o.message})}),!a&&!o&&D.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:f.size>0?t("empty.noMatch"):t("empty.noWorktrees")}),!a&&D.length>0&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:D.map(B=>{const q=B.sizeFormatted==="..."||B.branch==="...",K=!B.isOrphaned&&B.taskId,U=v===B.path;return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Mf,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:B.name}),B.isOrphaned?b.jsx(co,{className:Be("shrink-0",VN.ORPHANED),children:e("statuses.ORPHANED")}):B.taskStatus?b.jsx(co,{className:Be("shrink-0",VN[B.taskStatus]),children:e(`statuses.${B.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:B.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),B.branch==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-16"}):b.jsx("span",{className:"font-mono",children:B.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:mte,size:12,strokeWidth:2,className:"shrink-0"}),B.sizeFormatted==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-12"}):b.jsx("span",{children:B.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:cte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:n(B.lastModified)})]})]}),B.taskId&&B.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(Ai,{to:"/tasks/$taskId",params:{taskId:B.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:B.taskTitle}),b.jsx(fe,{icon:Xy,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:T?.path===B.path,onOpenChange:V,children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:q||U,onClick:()=>w(B)}),children:b.jsx(fe,{icon:U?tn:bu,size:14,strokeWidth:2,className:U?"animate-spin":""})}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("delete.title")}),b.jsxs(Eo,{children:[t("delete.description")," ",b.jsx("span",{className:"font-mono",children:B.name}),".",C&&K&&b.jsxs(b.Fragment,{children:[" ",t("delete.linkedTaskWillBeDeleted",{title:B.taskTitle})]})," ",t("delete.cannotUndo")]}),K&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:C,onCheckedChange:j=>R(j===!0),disabled:U}),t("delete.alsoDeleteLinkedTask",{title:B.taskTitle})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:U,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:()=>M(B,C),disabled:U,className:"gap-2",children:[U&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),e(U?"status.deleting":"buttons.delete")]})]})]})]})]})},B.path)})})]})}function yWe(){const{t:e}=rn("monitoring"),{data:t}=Bne(),n=Ri(),{tab:r}=$le.useSearch(),i=r||"system",a=k.useCallback(l=>{n({to:"/monitoring",search:l==="system"?{}:{tab:l},replace:!0})},[n]),o=[{value:"system",label:e("tabs.system")},{value:"processes",label:e("tabs.processes")},{value:"claude",label:e("tabs.claude")},{value:"vibora",label:e("tabs.vibora"),devOnly:!0},{value:"worktrees",label:e("tabs.worktrees")},{value:"usage",label:e("tabs.usage")}].filter(l=>!l.devOnly||t?.enabled);return b.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(Bi,{value:i,onValueChange:l=>a(l),children:[b.jsx($i,{size:"sm",className:"w-auto gap-2",children:b.jsx(Ui,{})}),b.jsx(zi,{children:o.map(l=>b.jsx(Cn,{value:l.value,children:l.label},l.value))})]})}),b.jsx("div",{className:"hidden sm:block",children:b.jsx(Zo,{value:i,onValueChange:l=>a(l),children:b.jsx(Qo,{variant:"line",children:o.map(l=>b.jsx(Wr,{value:l.value,className:"px-3 py-1.5",children:l.label},l.value))})})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i==="system"&&b.jsx(cWe,{}),i==="processes"&&b.jsx(dWe,{}),i==="claude"&&b.jsx(uWe,{}),i==="vibora"&&t?.enabled&&b.jsx(fWe,{}),i==="worktrees"&&b.jsx(vWe,{}),i==="usage"&&b.jsx(mWe,{})]})]})}const _We=()=>"http://localhost:3000",Eb={activeTab:"diff",browserUrl:_We(),diffOptions:{wrap:!0,ignoreWhitespace:!0,includeUntracked:!1,collapsedFiles:[]},filesViewState:{selectedFile:null,expandedDirs:[]}};function g5(e){const t=wr(),n=k.useRef(void 0),r=k.useRef({}),{data:i}=Mne(e),a=k.useMemo(()=>{const p=i?.viewState;return p?{activeTab:p.activeTab??Eb.activeTab,browserUrl:p.browserUrl??Eb.browserUrl,diffOptions:{...Eb.diffOptions,...p.diffOptions},filesViewState:{...Eb.filesViewState,...p.filesViewState}}:Eb},[i?.viewState]),s=Fn({mutationFn:async p=>{const m=await fetch(`/api/tasks/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({viewState:p})});if(!m.ok)throw new Error("Failed to update view state");return m.json()},onSuccess:p=>{t.setQueryData(["tasks",e],p),t.setQueryData(["tasks"],m=>m&&m.map(E=>E.id===e?p:E))}}),o=k.useCallback(p=>{const m=r.current;r.current={...m,...p,diffOptions:p.diffOptions||m.diffOptions?{...m.diffOptions,...p.diffOptions}:void 0,filesViewState:p.filesViewState||m.filesViewState?{...m.filesViewState,...p.filesViewState}:void 0};const E=r.current,S={activeTab:E.activeTab??a.activeTab,browserUrl:E.browserUrl??a.browserUrl,diffOptions:{...a.diffOptions,...E.diffOptions},filesViewState:{...a.filesViewState,...E.filesViewState}};t.setQueryData(["tasks",e],g=>g&&{...g,viewState:S}),t.setQueryData(["tasks"],g=>g&&g.map(y=>y.id===e?{...y,viewState:S}:y)),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.mutate(S),r.current={}},500)},[t,e,a,s]),l=k.useCallback(p=>{o({activeTab:p})},[o]),u=k.useCallback(p=>{o({browserUrl:p})},[o]),f=k.useCallback(p=>{o({diffOptions:p})},[o]),d=k.useCallback(p=>{o({filesViewState:p})},[o]);return{viewState:a,setActiveTab:l,setBrowserUrl:u,setDiffOptions:f,setFilesViewState:d}}function EWe(e){return qn({queryKey:["linear-ticket",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/linear/ticket/${e}`);return t.ok?t.json():null},enabled:!!e,staleTime:300*1e3})}function SWe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function xWe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function b5(e={}){const t=bie();return{get terminals(){return t.terminals.map(SWe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(xWe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup,clearStartingUp:t.clearStartingUp}}function V_(e){return`$'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function XX({taskName:e,cwd:t,className:n,aiMode:r,description:i,startupScript:a,serverPort:s=7777}){const o=k.useRef(null),l=k.useRef(null),u=k.useRef(null),f=k.useRef(!1),d=k.useRef(!1),[p,m]=k.useState(null),[E,S]=k.useState(!1),[g,y]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),{resolvedTheme:C}=Kc(),R=C==="dark",O=R?Vie:Wie;k.useEffect(()=>{At.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),f.current=!1,d.current=!1,m(null),S(!1)},[t]);const{setTerminalFocused:N}=vM(),{terminals:D,terminalsLoaded:L,connected:z,createTerminal:M,attachXterm:V,resizeTerminal:H,setupImagePaste:B,writeToTerminal:q,consumePendingStartup:K,clearStartingUp:U}=b5(),j=k.useRef(V),$=k.useRef(B),Y=k.useRef(q),W=k.useRef(K),J=k.useRef(U);k.useEffect(()=>{j.current=V},[V]),k.useEffect(()=>{$.current=B},[B]),k.useEffect(()=>{Y.current=q},[q]),k.useEffect(()=>{W.current=K},[K]),k.useEffect(()=>{J.current=U},[U]);const ae=p?D.find(Z=>Z.id===p):null,se=ae?.status;k.useEffect(()=>{if(!o.current||l.current)return;const Z=new $ie.Terminal({cursorBlink:!0,fontSize:Math.round(13*yc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:O}),ee=new zie.FitAddon,ne=new Hie.WebLinksAddon;Z.loadAddon(ee),Z.loadAddon(ne),Z.open(o.current),l.current=Z,u.current=ee,x(!0),requestAnimationFrame(()=>{ee.fit()});const te=setTimeout(()=>{ee.fit(),Z.refresh(0,Z.rows-1)},100),ye=()=>N(!0),Ee=()=>N(!1);return Z.textarea&&(Z.textarea.addEventListener("focus",ye),Z.textarea.addEventListener("blur",Ee)),()=>{clearTimeout(te),Z.textarea&&(Z.textarea.removeEventListener("focus",ye),Z.textarea.removeEventListener("blur",Ee)),N(!1),Z.dispose(),l.current=null,u.current=null,x(!1)}},[N]);const Q=k.useCallback(()=>{if(!u.current||!l.current)return;u.current.fit();const{cols:Z,rows:ee}=l.current;p&&H(p,Z,ee)},[p,H]);k.useEffect(()=>{if(!o.current)return;const Z=()=>{requestAnimationFrame(Q)};window.addEventListener("resize",Z);const ee=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})};document.addEventListener("visibilitychange",ee);const ne=new ResizeObserver(Z);ne.observe(o.current);const te=new IntersectionObserver(ye=>{ye[0]?.isIntersecting&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})},{threshold:.1});return te.observe(o.current),()=>{window.removeEventListener("resize",Z),document.removeEventListener("visibilitychange",ee),ne.disconnect(),te.disconnect()}},[Q]),k.useEffect(()=>{if(!z||!t||!v||!L)return;const Z=D.find(ee=>ee.cwd===t);if(Z){m(Z.id);return}if(!f.current&&l.current){f.current=!0,S(!0);const{cols:ee,rows:ne}=l.current;M({name:e,cols:ee,rows:ne,cwd:t,startup:{startupScript:a,aiMode:r,description:i,taskName:e,serverPort:s}})}},[z,t,v,L,D,e,M]),k.useEffect(()=>{if(!t)return;const Z=D.find(ne=>ne.cwd===t);if(!Z)return;const ee=p&&D.some(ne=>ne.id===p);(!p||!ee)&&(At.taskTerminal.debug("setting terminalId",{newId:Z.id,prevId:p,reason:p?"tempId replaced":"initial",cwd:t,terminalCount:D.length}),m(Z.id),S(!1),p&&!ee&&(d.current=!1))},[D,t,p]),k.useEffect(()=>{if(At.taskTerminal.debug("attach effect",{terminalId:p,hasTermRef:!!l.current,hasContainerRef:!!o.current,attachedRef:d.current}),!p||!l.current||!o.current||d.current)return;At.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:p});const Z=te=>{requestAnimationFrame(Q);const ye=W.current(te);if(At.taskTerminal.debug("onAttached checking pending startup",{terminalId:te,hasPendingStartup:!!ye}),ye){At.taskTerminal.info("onAttached: running startup commands",{terminalId:te}),y(!0);const{startupScript:Ee,aiMode:pe,description:_e,taskName:Se,serverPort:Te}=ye;Ee&&setTimeout(()=>{const Ne="VIBORA_STARTUP_"+Date.now(),Pe=`source /dev/stdin <<'${Ne}'
|
|
114
114
|
${Ee}
|
|
115
115
|
${Ne}`;Y.current(te,Pe+"\r")},100);const de=Te??7777,Ce=de!==7777?` --port=${de}`:"",ge=`You are working in a Vibora task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: vibora current-task review${Ce}. When linking a PR: vibora current-task pr <url>${Ce}. For notifications: vibora notify "Title" "Message"${Ce}.`,he=_e?`${Se}: ${_e}`:Se,ce=pe==="plan"?`claude ${V_(he)} --append-system-prompt ${V_(ge)} --session-id "${te}" --allow-dangerously-skip-permissions --permission-mode plan`:`claude ${V_(he)} --append-system-prompt ${V_(ge)} --session-id "${te}" --dangerously-skip-permissions`;setTimeout(()=>{At.taskTerminal.debug("writing claude command to terminal",{terminalId:te,taskCommand:ce.substring(0,50)+"..."}),Y.current(te,ce+"\r"),y(!1),J.current(te)},Ee?5e3:100)}},ee=j.current(p,l.current,{onAttached:Z}),ne=$.current(o.current,p);return d.current=!0,At.taskTerminal.debug("attachedRef set to true",{terminalId:p}),()=>{At.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:p}),ee(),ne(),d.current=!1}},[p,Q]),k.useEffect(()=>{l.current&&(l.current.options.theme=O)},[O]),k.useEffect(()=>{if(!l.current||T)return;const Z=l.current,ee=()=>{const te=Z.buffer.active;for(let ye=Math.max(0,te.cursorY-3);ye<=te.cursorY;ye++){const Ee=te.getLine(ye);if(Ee){const pe=Ee.translateToString();if(pe.includes("claude: command not found")||pe.includes("claude: not found")||pe.includes("'claude' is not recognized")||pe.includes("command not found: claude")){w(!0);return}}}},ne=Z.onLineFeed(ee);return()=>{ne.dispose()}},[T]);const G=k.useCallback(Z=>{p&&Y.current(p,Z)},[p]);return t?b.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!z&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),se==="error"&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),se==="exited"&&b.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",ae?.exitCode,")"]}),b.jsxs("div",{className:"relative min-h-0 flex-1",children:[b.jsx("div",{ref:o,className:Be("h-full w-full overflow-hidden p-2 bg-terminal-background",n)}),E&&!p&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:Be("animate-spin",R?"text-white/50":"text-black/50")}),b.jsx("span",{className:Be("font-mono text-sm",R?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),g&&b.jsx("div",{className:"pointer-events-auto absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:Be("animate-spin",R?"text-white/60":"text-black/60")}),b.jsx("span",{className:Be("font-mono text-sm",R?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})}),T&&b.jsx("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:b.jsxs("div",{className:Be("flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[b.jsx(fe,{icon:rs,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex-1 space-y-2",children:[b.jsx("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",b.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:"npm install -g @anthropic/claude-code"})]}),b.jsx("a",{href:"https://docs.anthropic.com/en/docs/claude-code/overview",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),b.jsx("button",{onClick:()=>w(!1),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:b.jsx(fe,{icon:fi,size:14,strokeWidth:2})})]})}),b.jsx("button",{onClick:()=>l.current?.scrollToBottom(),className:Be("absolute top-2 right-5 p-1 transition-colors",R?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:b.jsx(fe,{icon:pM,size:20,strokeWidth:2})})]}),b.jsx(oS,{onSend:G})]}):b.jsx("div",{className:Be("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",n),children:"No worktree path configured for this task"})}function wWe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function TWe(e,t=[]){let n=[];function r(a,s){const o=k.createContext(s),l=n.length;n=[...n,s];const u=d=>{const{scope:p,children:m,...E}=d,S=p?.[e]?.[l]||o,g=k.useMemo(()=>E,Object.values(E));return b.jsx(S.Provider,{value:g,children:m})};u.displayName=a+"Provider";function f(d,p){const m=p?.[e]?.[l]||o,E=k.useContext(m);if(E)return E;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,f]}const i=()=>{const a=n.map(s=>k.createContext(s));return function(o){const l=o?.[e]||a;return k.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return i.scopeName=e,[r,CWe(i,...t)]}function CWe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...o,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ky=globalThis?.document?k.useLayoutEffect:()=>{},AWe=_x[" useInsertionEffect ".trim().toString()]||ky;function kWe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,s]=OWe({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:i;{const f=k.useRef(e!==void 0);k.useEffect(()=>{const d=f.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=o},[o,r])}const u=k.useCallback(f=>{if(o){const d=RWe(f)?f(e):f;d!==e&&s.current?.(d)}else a(f)},[o,e,a,s]);return[l,u]}function OWe({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),i=k.useRef(n),a=k.useRef(t);return AWe(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function RWe(e){return typeof e=="function"}function ZX(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zle(...e){return t=>{let n=!1;const r=e.map(i=>{const a=ZX(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():ZX(e[i],null)}}}}function Hle(...e){return k.useCallback(zle(...e),e)}function NWe(e){const t=IWe(e),n=k.forwardRef((r,i)=>{const{children:a,...s}=r,o=k.Children.toArray(a),l=o.find(LWe);if(l){const u=l.props.children,f=o.map(d=>d===l?k.Children.count(u)>1?k.Children.only(null):k.isValidElement(u)?u.props.children:null:d);return b.jsx(t,{...s,ref:i,children:k.isValidElement(u)?k.cloneElement(u,void 0,f):null})}return b.jsx(t,{...s,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function IWe(e){const t=k.forwardRef((n,r)=>{const{children:i,...a}=n;if(k.isValidElement(i)){const s=MWe(i),o=PWe(a,i.props);return i.type!==k.Fragment&&(o.ref=r?zle(r,s):s),k.cloneElement(i,o)}return k.Children.count(i)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DWe=Symbol("radix.slottable");function LWe(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DWe}function PWe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...o)=>{const l=a(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function MWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jWe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],v5=jWe.reduce((e,t)=>{const n=NWe(`Primitive.${t}`),r=k.forwardRef((i,a)=>{const{asChild:s,...o}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(l,{...o,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function FWe(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Wle=e=>{const{present:t,children:n}=e,r=BWe(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),a=Hle(r.ref,UWe(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:a}):null};Wle.displayName="Presence";function BWe(e){const[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),a=k.useRef("none"),s=e?"mounted":"unmounted",[o,l]=FWe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=G_(r.current);a.current=o==="mounted"?u:"none"},[o]),ky(()=>{const u=r.current,f=i.current;if(f!==e){const p=a.current,m=G_(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),ky(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const S=G_(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&S&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},p=m=>{m.target===t&&(a.current=G_(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:k.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function G_(e){return e?.animationName||"none"}function UWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $We=_x[" useId ".trim().toString()]||(()=>{}),zWe=0;function HWe(e){const[t,n]=k.useState($We());return ky(()=>{n(r=>r??String(zWe++))},[e]),e||(t?`radix-${t}`:"")}var nT="Collapsible",[WWe]=TWe(nT),[VWe,y5]=WWe(nT),Vle=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[l,u]=kWe({prop:r,defaultProp:i??!1,onChange:s,caller:nT});return b.jsx(VWe,{scope:n,disabled:a,contentId:HWe(),open:l,onOpenToggle:k.useCallback(()=>u(f=>!f),[u]),children:b.jsx(v5.div,{"data-state":E5(l),"data-disabled":a?"":void 0,...o,ref:t})})});Vle.displayName=nT;var Gle="CollapsibleTrigger",qle=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=y5(Gle,n);return b.jsx(v5.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":E5(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:wWe(e.onClick,i.onOpenToggle)})});qle.displayName=Gle;var _5="CollapsibleContent",Kle=k.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=y5(_5,e.__scopeCollapsible);return b.jsx(Wle,{present:n||i.open,children:({present:a})=>b.jsx(GWe,{...r,ref:t,present:a})})});Kle.displayName=_5;var GWe=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=y5(_5,n),[o,l]=k.useState(r),u=k.useRef(null),f=Hle(t,u),d=k.useRef(0),p=d.current,m=k.useRef(0),E=m.current,S=s.open||o,g=k.useRef(S),y=k.useRef(void 0);return k.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),ky(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();d.current=x.height,m.current=x.width,g.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),l(r)}},[s.open,r]),b.jsx(v5.div,{"data-state":E5(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!S,...a,ref:f,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...e.style},children:S&&i})});function E5(e){return e?"open":"closed"}var qWe=Vle;const KWe=qWe,YWe=qle,XWe=Kle;function ZWe(e){const{viewState:t,setDiffOptions:n}=g5(e),{collapsedFiles:r}=t.diffOptions,i=k.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(f=>f!==l):[...r,l]})},[r,n]),a=k.useCallback(l=>{n({collapsedFiles:l})},[n]),s=k.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=k.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function QWe(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
|
|
116
116
|
`))if(a.startsWith("diff --git"))n={path:a.match(/diff --git a\/(.+?) b\//)?.[1]??"unknown",lines:[],additions:0,deletions:0},t.push(n),n.lines.push({type:"header",content:a});else if(a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++"))n?.lines.push({type:"header",content:a});else if(a.startsWith("@@")){const s=a.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);s&&(r=parseInt(s[1],10),i=parseInt(s[2],10)),n?.lines.push({type:"hunk",content:a})}else a.startsWith("+")?n&&(n.additions++,n.lines.push({type:"added",content:a.slice(1),newLineNumber:i++})):a.startsWith("-")?n&&(n.deletions++,n.lines.push({type:"removed",content:a.slice(1),oldLineNumber:r++})):a.startsWith(" ")&&n?.lines.push({type:"context",content:a.slice(1),oldLineNumber:r++,newLineNumber:i++});return t}function JWe({file:e,wrap:t,isCollapsed:n,onToggle:r}){return b.jsxs(KWe,{open:!n,onOpenChange:()=>r(),children:[b.jsx(YWe,{asChild:!0,children:b.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-card border-b border-border cursor-pointer hover:bg-muted select-none",children:[b.jsx(fe,{icon:n?Xy:Yy,size:12,strokeWidth:2,className:"text-muted-foreground shrink-0"}),b.jsx("span",{className:"font-mono text-xs text-foreground truncate flex-1",children:e.path}),b.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.additions>0&&b.jsxs("span",{className:"text-accent",children:["+",e.additions]}),e.additions>0&&e.deletions>0&&" ",e.deletions>0&&b.jsxs("span",{className:"text-destructive",children:["-",e.deletions]})]})]})}),b.jsx(XWe,{children:b.jsx("div",{className:"font-mono text-xs",children:e.lines.slice(1).map((i,a)=>b.jsxs("div",{className:Be("flex px-2 py-0.5",i.type==="added"&&"bg-accent/10",i.type==="removed"&&"bg-destructive/10",i.type==="header"&&"bg-muted/50 text-muted-foreground",i.type==="hunk"&&"bg-accent/10 text-accent"),children:[(i.type==="added"||i.type==="removed"||i.type==="context")&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.oldLineNumber??""}),b.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.newLineNumber??""})]}),b.jsxs("span",{className:Be("w-4 shrink-0 select-none text-center",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:[i.type==="added"&&"+",i.type==="removed"&&"-"]}),b.jsx("span",{className:Be("flex-1",t?"whitespace-pre-wrap break-all":"whitespace-pre",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:i.content})]},a))})})]})}function QX({taskId:e,worktreePath:t}){const{options:n,setOption:r,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}=ZWe(e),{wrap:l,ignoreWhitespace:u,includeUntracked:f,collapsedFiles:d}=n,{data:p,isLoading:m,error:E}=Kxe(t,{ignoreWhitespace:u,includeUntracked:f}),S=k.useMemo(()=>p?.diff?QWe(p.diff):[],[p?.diff]),g=k.useMemo(()=>S.map(w=>w.path),[S]),y=S.length>0&&d.length===S.length,v=k.useMemo(()=>S.reduce((w,C)=>w+C.additions,0),[S]),x=k.useMemo(()=>S.reduce((w,C)=>w+C.deletions,0),[S]);if(k.useEffect(()=>{const w=C=>{if(C.shiftKey&&C.key==="C"&&!C.ctrlKey&&!C.metaKey&&!C.altKey){const R=C.target;if(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable)return;C.preventDefault(),y?s():a(g)}};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[y,g,a,s]),!t)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"});if(m)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading diff..."});if(E)return b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:E.message});const T=p?.files?.some(w=>w.status==="untracked")??!1;return S.length===0?b.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[b.jsx("p",{children:"No changes detected"}),p?.files&&p.files.length>0&&b.jsxs("div",{className:"text-xs",children:[b.jsx("p",{className:"text-center mb-2",children:"Modified files:"}),b.jsxs("div",{className:"flex flex-col gap-1",children:[p.files.map(w=>b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("span",{className:Be("w-4 text-center",w.status==="added"&&"text-accent",w.status==="deleted"&&"text-destructive",w.status==="modified"&&"text-muted-foreground",w.status==="untracked"&&"text-muted-foreground"),children:[w.status==="added"&&"A",w.status==="deleted"&&"D",w.status==="modified"&&"M",w.status==="untracked"&&"?"]}),b.jsx("span",{children:w.path})]},w.path)),T&&b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-muted-foreground hover:text-foreground mt-1",children:[b.jsx("input",{type:"checkbox",checked:f,onChange:w=>r("includeUntracked",w.target.checked),className:"w-4 h-3"}),b.jsx("span",{children:"Show untracked files"})]})]})]})]}):b.jsxs("div",{className:"flex flex-col h-full bg-background",children:[b.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[p?.branch&&b.jsxs("span",{className:"text-muted-foreground",children:[p.branch,p.isBranchDiff&&b.jsx("span",{className:"opacity-70",children:" (vs master)"})]}),(v>0||x>0)&&b.jsxs("span",{className:"text-muted-foreground",children:[b.jsxs("span",{className:"text-accent",children:["+",v]})," ",b.jsxs("span",{className:"text-destructive",children:["-",x]})]}),b.jsx("div",{className:"flex-1"}),b.jsxs("button",{onClick:()=>y?s():a(g),className:"flex items-center gap-1 px-1.5 py-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:y?"Expand all (Shift+C)":"Collapse all (Shift+C)",children:[b.jsx(fe,{icon:y?Ste:yte,size:12,strokeWidth:2}),b.jsx("span",{className:"hidden sm:inline",children:y?"Expand":"Collapse"})]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:l,onChange:w=>r("wrap",w.target.checked),className:"w-3 h-3"}),"Wrap"]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:u,onChange:w=>r("ignoreWhitespace",w.target.checked),className:"w-3 h-3"}),"Ignore whitespace"]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:f,onChange:w=>r("includeUntracked",w.target.checked),className:"w-3 h-3"}),"Untracked"]})]}),b.jsx(n0,{className:"flex-1 min-h-0",children:S.map(w=>b.jsx(JWe,{file:w,wrap:l,isCollapsed:o(w.path),onToggle:()=>i(w.path)},w.path))})]})}function eVe(e){const{viewState:t,setBrowserUrl:n}=g5(e);return{url:t.browserUrl,setUrl:n}}function JX({taskId:e}){const{url:t,setUrl:n}=eVe(e),[r,i]=k.useState(t),[a,s]=k.useState(0);k.useEffect(()=>{i(t)},[t]);const o=k.useCallback(()=>{s(u=>u+1)},[]),l=k.useCallback(u=>{u.preventDefault();let f=r.trim();!f.startsWith("http://")&&!f.startsWith("https://")&&(f=`http://${f}`),n(f),s(d=>d+1)},[r,n]);return b.jsxs("div",{className:"flex h-full flex-col bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5",children:[b.jsx(qe,{variant:"ghost",size:"icon-xs",disabled:!0,children:b.jsx(fe,{icon:lte,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon-xs",disabled:!0,children:b.jsx(fe,{icon:Xy,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"ghost",size:"icon-xs",onClick:o,children:b.jsx(fe,{icon:W1e,size:14,strokeWidth:2})}),b.jsx("form",{onSubmit:l,className:"flex-1",children:b.jsx(dn,{value:r,onChange:u=>i(u.target.value),className:"h-7 bg-background text-xs",placeholder:"Enter URL..."})})]}),b.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:b.jsx("iframe",{src:t,className:"h-full w-full border-0",title:"Browser Preview",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},a)})]})}function tVe(e){const t=[];function n(r){for(const i of r)i.type==="file"?t.push({name:i.name,path:i.path}):i.children&&n(i.children)}return n(e),t}function Yle(e){const t=e.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","svg","webp","ico"].includes(t)?F1e:["ts","tsx","js","jsx","json","css","html","md","yaml","yml","toml","sh","py","rs","go","sql"].includes(t)?D1e:L1e}function Xle({entry:e,depth:t,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a}){const s=r.includes(e.path),o=n===e.path,l=e.type==="directory",u=k.useCallback(()=>{l?a(e.path):i(e.path)},[l,e.path,i,a]);return b.jsxs("div",{children:[b.jsxs("div",{className:Be("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",o&&"bg-primary/10 text-primary"),style:{paddingLeft:`${t*12+8}px`},onClick:u,children:[b.jsx(fe,{icon:l?s?JI:Vi:Yle(e.name),size:14,strokeWidth:2,className:Be("shrink-0",l?"text-accent":"text-muted-foreground")}),b.jsx("span",{className:"break-all",children:e.name})]}),l&&s&&e.children&&b.jsx("div",{children:e.children.map(f=>b.jsx(Xle,{entry:f,depth:t+1,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a},f.path))})]})}function nVe({entries:e,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i,onCollapseAll:a}){const[s,o]=k.useState(""),l=k.useMemo(()=>tVe(e),[e]),u=k.useMemo(()=>{if(!s.trim())return null;const d=s.trim();return l.map(p=>({...p,score:Math.max(no(p.name,d),no(p.path,d))})).filter(p=>p.score>0).sort((p,m)=>m.score-p.score)},[l,s]),f=k.useCallback(()=>{o("")},[]);return e.length===0?b.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No files"}):b.jsxs("div",{className:"flex flex-col h-full bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1 border-b border-border bg-card",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:"Files"}),b.jsx("button",{onClick:a,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Collapse all folders",children:b.jsx(fe,{icon:yte,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"shrink-0 px-2 py-1.5 border-b border-border bg-card",children:b.jsxs("div",{className:"relative",children:[b.jsx("input",{type:"text",value:s,onChange:d=>o(d.target.value),placeholder:"Search files...",className:"w-full text-sm bg-muted/50 border border-border rounded px-2 py-1 pr-7 placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),s&&b.jsx("button",{onClick:f,className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted",children:b.jsx(fe,{icon:fi,size:12,strokeWidth:2})})]})}),b.jsx("div",{className:"py-1 flex-1 overflow-auto",children:u?u.length>0?u.map(d=>b.jsxs("div",{className:Be("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",t===d.path&&"bg-primary/10 text-primary"),onClick:()=>r(d.path),children:[b.jsx(fe,{icon:Yle(d.name),size:14,strokeWidth:2,className:"shrink-0 text-muted-foreground"}),b.jsx("span",{className:"truncate",title:d.path,children:d.name}),b.jsx("span",{className:"text-xs text-muted-foreground truncate ml-auto",children:d.path.split("/").slice(0,-1).join("/")})]},d.path)):b.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No matching files"}):e.map(d=>b.jsx(Xle,{entry:d,depth:0,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i},d.path))})]})}function eZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rVe(e){if(Array.isArray(e))return e}function iVe(e,t,n){return(t=dVe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aVe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(f){u=!0,i=f}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function sVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|