prime-dev-cli 1.0.16 → 1.0.17
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.
- package/dist/server/.next/BUILD_ID +1 -1
- package/dist/server/.next/app-build-manifest.json +2 -2
- package/dist/server/.next/build-manifest.json +2 -2
- package/dist/server/.next/cache/.rscinfo +1 -1
- package/dist/server/.next/cache/.tsbuildinfo +1 -1
- package/dist/server/.next/cache/eslint/.cache_1qa5vxt +1 -1
- package/dist/server/.next/fallback-build-manifest.json +2 -2
- package/dist/server/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/server/.next/next-server.js.nft.json +1 -1
- package/dist/server/.next/prerender-manifest.json +9 -9
- package/dist/server/.next/server/app/_not-found.html +1 -1
- package/dist/server/.next/server/app/_not-found.rsc +1 -1
- package/dist/server/.next/server/app/configuration/page/app-build-manifest.json +1 -1
- package/dist/server/.next/server/app/configuration/page_client-reference-manifest.js +1 -1
- package/dist/server/.next/server/app/configuration.html +1 -1
- package/dist/server/.next/server/app/configuration.rsc +2 -2
- package/dist/server/.next/server/app/index.html +1 -1
- package/dist/server/.next/server/app/index.rsc +1 -1
- package/dist/server/.next/server/app/initialization/page/app-build-manifest.json +1 -1
- package/dist/server/.next/server/app/initialization/page_client-reference-manifest.js +1 -1
- package/dist/server/.next/server/app/initialization.html +1 -1
- package/dist/server/.next/server/app/initialization.rsc +2 -2
- package/dist/server/.next/server/chunks/[root-of-the-server]__072f5c45._.js +7 -7
- package/dist/server/.next/server/chunks/[root-of-the-server]__072f5c45._.js.map +1 -1
- package/dist/server/.next/server/chunks/[root-of-the-server]__7fc974c9._.js +10 -10
- package/dist/server/.next/server/chunks/[root-of-the-server]__7fc974c9._.js.map +1 -1
- package/dist/server/.next/server/chunks/[root-of-the-server]__899d82eb._.js +6 -6
- package/dist/server/.next/server/chunks/[root-of-the-server]__899d82eb._.js.map +1 -1
- package/dist/server/.next/server/chunks/[root-of-the-server]__f6d4fb58._.js +6 -6
- package/dist/server/.next/server/chunks/[root-of-the-server]__f6d4fb58._.js.map +1 -1
- package/dist/server/.next/server/chunks/ssr/_5d353cf8._.js +1 -1
- package/dist/server/.next/server/chunks/ssr/_5d353cf8._.js.map +1 -1
- package/dist/server/.next/server/chunks/ssr/packages_server_src_7cef6dbd._.js +1 -1
- package/dist/server/.next/server/chunks/ssr/packages_server_src_7cef6dbd._.js.map +1 -1
- package/dist/server/.next/server/pages/404.html +1 -1
- package/dist/server/.next/server/pages/500.html +1 -1
- package/dist/server/.next/server/server-reference-manifest.js +1 -1
- package/dist/server/.next/server/server-reference-manifest.json +1 -1
- package/dist/server/.next/static/chunks/{684226c5a0f22bc1.js → 5f8beee58a024d75.js} +2 -2
- package/dist/server/.next/static/chunks/{765c1fd313250591.js.map → 7e0a49ac2b139df9.js.map} +1 -1
- package/dist/server/.next/static/chunks/{2c0e57fbc9520adc.js → 9650e7136a9bfc30.js} +2 -2
- package/dist/server/.next/static/chunks/f31695470ae3a484.js.map +1 -0
- package/dist/server/.next/trace +1 -1
- package/package.json +1 -1
- package/dist/server/.next/static/chunks/2c669537f498f2db.js.map +0 -1
- /package/dist/server/.next/static/{bC3bTGQyq6cbRR_M7T8N6 → Xoig0sIWc0oIgbMH6U6Ew}/_buildManifest.js +0 -0
- /package/dist/server/.next/static/{bC3bTGQyq6cbRR_M7T8N6 → Xoig0sIWc0oIgbMH6U6Ew}/_clientMiddlewareManifest.json +0 -0
- /package/dist/server/.next/static/{bC3bTGQyq6cbRR_M7T8N6 → Xoig0sIWc0oIgbMH6U6Ew}/_ssgManifest.js +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return(0,n.useEffect)(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},J=({contentRef:e,descriptionId:t})=>{let r=Y("DialogDescriptionWarning"),o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return(0,n.useEffect)(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Z=N,Q=E,ee=P,et=_,er=D,en=B,eo=U,ei=V},12610:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({__iconNode:()=>t,default:()=>r});var n=e.i(49770);let t=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],r=(0,n.default)("x",t)}},96758:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({XIcon:()=>n.default});var n=e.i(12610)},19579:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Dialog:()=>s,DialogClose:()=>u,DialogContent:()=>f,DialogDescription:()=>g,DialogFooter:()=>p,DialogHeader:()=>m,DialogOverlay:()=>d,DialogPortal:()=>c,DialogTitle:()=>h,DialogTrigger:()=>l});var n=e.i(20393),o=e.i(75267),i=e.i(96758),a=e.i(39037);function s({...e}){return(0,n.jsx)(o.Root,{"data-slot":"dialog",...e})}function l({...e}){return(0,n.jsx)(o.Trigger,{"data-slot":"dialog-trigger",...e})}function c({...e}){return(0,n.jsx)(o.Portal,{"data-slot":"dialog-portal",...e})}function u({...e}){return(0,n.jsx)(o.Close,{"data-slot":"dialog-close",...e})}function d({className:e,...t}){return(0,n.jsx)(o.Overlay,{"data-slot":"dialog-overlay",className:(0,a.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function f({className:e,children:t,showCloseButton:r=!0,...s}){return(0,n.jsxs)(c,{"data-slot":"dialog-portal",children:[(0,n.jsx)(d,{}),(0,n.jsxs)(o.Content,{"data-slot":"dialog-content",className:(0,a.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",e),...s,children:[t,r&&(0,n.jsxs)(o.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,n.jsx)(i.XIcon,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,a.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function p({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-footer",className:(0,a.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function h({className:e,...t}){return(0,n.jsx)(o.Title,{"data-slot":"dialog-title",className:(0,a.cn)("text-lg leading-none font-semibold",e),...t})}function g({className:e,...t}){return(0,n.jsx)(o.Description,{"data-slot":"dialog-description",className:(0,a.cn)("text-muted-foreground text-sm",e),...t})}},92391:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({canUseDOM:()=>n,composeEventHandlers:()=>o,getActiveElement:()=>function e(t,r=!1){let{activeElement:n}=a(t);if(!n?.nodeName)return null;if(s(n)&&n.contentDocument)return e(n.contentDocument.body,r);if(r){let e=n.getAttribute("aria-activedescendant");if(e){let t=a(n).getElementById(e);if(t)return t}}return n},getOwnerDocument:()=>a,getOwnerWindow:()=>i,isFrame:()=>s});var n=!!("undefined"!=typeof window&&window.document&&window.document.createElement);function o(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function i(e){if(!n)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}function a(e){if(!n)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function s(e){return"IFRAME"===e.tagName}},65113:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Presence:()=>a,Root:()=>l});var n=e.i(19886),o=e.i(28537),i=e.i(91327),a=e=>{let{present:t,children:r}=e,a=function(e){var t,r;let[o,a]=(0,n.useState)(),l=(0,n.useRef)(null),c=(0,n.useRef)(e),u=(0,n.useRef)("none"),[d,f]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},(0,n.useReducer)((e,t)=>r[e][t]??e,t));return(0,n.useEffect)(()=>{let e=s(l.current);u.current="mounted"===d?e:"none"},[d]),(0,i.useLayoutEffect)(()=>{let t=l.current,r=c.current;if(r!==e){let n=u.current,o=s(t);e?f("MOUNT"):"none"===o||t?.display==="none"?f("UNMOUNT"):r&&n!==o?f("ANIMATION_OUT"):f("UNMOUNT"),c.current=e}},[e,f]),(0,i.useLayoutEffect)(()=>{if(o){let e,t=o.ownerDocument.defaultView??window,r=r=>{let n=s(l.current).includes(CSS.escape(r.animationName));if(r.target===o&&n&&(f("ANIMATION_END"),!c.current)){let r=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=r)})}},n=e=>{e.target===o&&(u.current=s(l.current))};return o.addEventListener("animationstart",n),o.addEventListener("animationcancel",r),o.addEventListener("animationend",r),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",n),o.removeEventListener("animationcancel",r),o.removeEventListener("animationend",r)}}f("ANIMATION_END")},[o,f]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:(0,n.useCallback)(e=>{l.current=e?getComputedStyle(e):null,a(e)},[])}}(t),l="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),c=(0,o.useComposedRefs)(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}(l));return"function"==typeof r||a.isPresent?(0,n.cloneElement)(l,{ref:c}):null};function s(e){return e?.animationName||"none"}a.displayName="Presence";var l=a},45155:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Checkbox:()=>w,CheckboxIndicator:()=>S,Indicator:()=>S,Root:()=>w,createCheckboxScope:()=>h,unstable_BubbleInput:()=>C,unstable_CheckboxBubbleInput:()=>C,unstable_CheckboxProvider:()=>x,unstable_CheckboxTrigger:()=>b,unstable_Provider:()=>x,unstable_Trigger:()=>b});var n=e.i(19886),o=e.i(28537),i=e.i(15836),a=e.i(92391),s=e.i(98644),l=e.i(44916),c=e.i(30287),u=e.i(65113),d=e.i(21349),f=e.i(20393),m="Checkbox",[p,h]=(0,i.createContextScope)(m),[g,v]=p(m);function x(e){let{__scopeCheckbox:t,checked:r,children:o,defaultChecked:i,disabled:a,form:l,name:c,onCheckedChange:u,required:d,value:p="on",internal_do_not_use_render:h}=e,[v,x]=(0,s.useControllableState)({prop:r,defaultProp:i??!1,onChange:u,caller:m}),[y,b]=(0,n.useState)(null),[w,j]=(0,n.useState)(null),S=(0,n.useRef)(!1),N=!y||!!l||!!y.closest("form"),C={checked:v,disabled:a,setChecked:x,control:y,setControl:b,name:c,form:l,value:p,hasConsumerStoppedPropagationRef:S,required:d,defaultChecked:!E(i)&&i,isFormControl:N,bubbleInput:w,setBubbleInput:j};return(0,f.jsx)(g,{scope:t,...C,children:"function"==typeof h?h(C):o})}var y="CheckboxTrigger",b=(0,n.forwardRef)(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...i},s)=>{let{control:l,value:c,disabled:u,checked:m,required:p,setControl:h,setChecked:g,hasConsumerStoppedPropagationRef:x,isFormControl:b,bubbleInput:w}=v(y,e),j=(0,o.useComposedRefs)(s,h),S=(0,n.useRef)(m);return(0,n.useEffect)(()=>{let e=l?.form;if(e){let t=()=>g(S.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[l,g]),(0,f.jsx)(d.Primitive.button,{type:"button",role:"checkbox","aria-checked":E(m)?"mixed":m,"aria-required":p,"data-state":k(m),"data-disabled":u?"":void 0,disabled:u,value:c,...i,ref:j,onKeyDown:(0,a.composeEventHandlers)(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,a.composeEventHandlers)(r,e=>{g(e=>!!E(e)||!e),w&&b&&(x.current=e.isPropagationStopped(),x.current||e.stopPropagation())})})});b.displayName=y;var w=(0,n.forwardRef)((e,t)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:l,onCheckedChange:c,form:u,...d}=e;return(0,f.jsx)(x,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:c,name:n,form:u,value:l,internal_do_not_use_render:({isFormControl:e})=>(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(b,{...d,ref:t,__scopeCheckbox:r}),e&&(0,f.jsx)(C,{__scopeCheckbox:r})]})})});w.displayName=m;var j="CheckboxIndicator",S=(0,n.forwardRef)((e,t)=>{let{__scopeCheckbox:r,forceMount:n,...o}=e,i=v(j,r);return(0,f.jsx)(u.Presence,{present:n||E(i.checked)||!0===i.checked,children:(0,f.jsx)(d.Primitive.span,{"data-state":k(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});S.displayName=j;var N="CheckboxBubbleInput",C=(0,n.forwardRef)(({__scopeCheckbox:e,...t},r)=>{let{control:i,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:u,required:m,disabled:p,name:h,value:g,form:x,bubbleInput:y,setBubbleInput:b}=v(N,e),w=(0,o.useComposedRefs)(r,b),j=(0,l.usePrevious)(s),S=(0,c.useSize)(i);(0,n.useEffect)(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=!a.current;if(j!==s&&e){let r=new Event("click",{bubbles:t});y.indeterminate=E(s),e.call(y,!E(s)&&s),y.dispatchEvent(r)}},[y,j,s,a]);let C=(0,n.useRef)(!E(s)&&s);return(0,f.jsx)(d.Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:m,disabled:p,name:h,value:g,form:x,...t,tabIndex:-1,ref:w,style:{...t.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function E(e){return"indeterminate"===e}function k(e){return E(e)?"indeterminate":e?"checked":"unchecked"}C.displayName=N},46456:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Check:()=>n.default});var n=e.i(64412)},42736:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({Checkbox:()=>t});var n=e.i(20393),o=e.i(19886),i=e.i(45155),a=e.i(46456),s=e.i(39037);let t=(0,o.forwardRef)(({className:e,...t},r)=>(0,n.jsx)(i.Root,{ref:r,className:(0,s.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-gray-300 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-900 data-[state=checked]:text-white dark:border-gray-800 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300 dark:data-[state=checked]:bg-gray-50 dark:data-[state=checked]:text-gray-900",e),...t,children:(0,n.jsx)(i.Indicator,{className:(0,s.cn)("flex items-center justify-center text-current"),children:(0,n.jsx)(a.Check,{className:"h-4 w-4"})})}));t.displayName=i.Root.displayName}},95113:e=>{"use strict";var{g:t,__dirname:r}=e;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function a(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function s(e,t){if(null==e)return{};var r,n,o=a(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function l(e,t){return c(e)||u(e,t)||d(e,t)||m()}function c(e){if(Array.isArray(e))return e}function u(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.s({arrayLikeToArray:()=>f,arrayWithHoles:()=>c,defineProperty:()=>n,iterableToArrayLimit:()=>u,nonIterableRest:()=>m,objectSpread2:()=>i,objectWithoutProperties:()=>s,objectWithoutPropertiesLoose:()=>a,slicedToArray:()=>l,unsupportedIterableToArray:()=>d})},85767:e=>{"use strict";var{g:t,__dirname:r}=e;{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e){return function t(){for(var r=this,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(o,n))}}}function a(e){return({}).toString.call(e).includes("Object")}function s(e){return"function"==typeof e}e.s({default:()=>t});var l=i(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),c={changes:function(e,t){return a(t)||l("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&l("changeField"),t},selector:function(e){s(e)||l("selectorType")},handler:function(e){s(e)||a(e)||l("handlerType"),a(e)&&Object.values(e).some(function(e){return!s(e)})&&l("handlersType")},initial:function(e){e||l("initialIsRequired"),a(e)||l("initialType"),Object.keys(e).length||l("initialContent")}};function u(e,t){return s(t)?t(e.current):t}function d(e,t){return e.current=o(o({},e.current),t),t}function f(e,t,r){return s(t)?t(e.current):Object.keys(r).forEach(function(r){var n;return null==(n=t[r])?void 0:n.call(t,e.current[r])}),r}let t={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c.initial(e),c.handler(t);var r={current:e},n=i(f)(r,t),o=i(d)(r),a=i(c.changes)(e),s=i(u)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return c.selector(e),e(r.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(n,o,a,s)(e)}]}}}},53120:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}}}},72460:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(e){return function t(){for(var r=this,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(o,n))}}}}},63839:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(e){return({}).toString.call(e).includes("Object")}}},93408:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t,errorHandler:()=>a,errorMessages:()=>i});var n=e.i(72460),o=e.i(63839),i={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},a=(0,n.default)(function(e,t){throw Error(e[t]||e.default)})(i);let t={config:function(e){return(e||a("configIsRequired"),(0,o.default)(e)||a("configType"),e.urls)?(console.warn(i.deprecation),{paths:{vs:e.urls.monacoBase}}):e}}}},28295:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}}},13614:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});var n=e.i(95113);let t=function e(t,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&t[n]&&Object.assign(r[n],e(t[n],r[n]))}),(0,n.objectSpread2)((0,n.objectSpread2)({},t),r)}}},28042:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({CANCELATION_MESSAGE:()=>n,default:()=>t});var n={type:"cancelation",msg:"operation is manually canceled"};let t=function(e){var t=!1,r=new Promise(function(r,o){e.then(function(e){return t?o(n):r(e)}),e.catch(o)});return r.cancel=function(){return t=!0},r}}},72189:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});var n=e.i(95113),o=e.i(85767),i=e.i(53120),a=e.i(93408),s=e.i(28295),l=e.i(13614),c=e.i(28042),u=o.default.create({config:i.default,isInitialized:!1,resolve:null,reject:null,monaco:null}),d=(0,n.slicedToArray)(u,2),f=d[0],m=d[1];function p(e){return document.body.appendChild(e)}function h(e){var t,r,n=f(function(e){return{config:e.config,reject:e.reject}}),o=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return o.onload=function(){return e()},o.onerror=n.reject,o}function g(){var e=f(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){v(t),e.resolve(t)},function(t){e.reject(t)})}function v(e){f().monaco||m({monaco:e})}var x=new Promise(function(e,t){return m({resolve:e,reject:t})});let t={config:function(e){var t=a.default.config(e),r=t.monaco,o=(0,n.objectWithoutProperties)(t,["monaco"]);m(function(e){return{config:(0,l.default)(e.config,o),monaco:r}})},init:function(){var e=f(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(m({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),(0,c.default)(x);if(window.monaco&&window.monaco.editor)return v(window.monaco),e.resolve(window.monaco),(0,c.default)(x);(0,s.default)(p,h)(g)}return(0,c.default)(x)},__getMonacoInstance:function(){return f(function(e){return e.monaco})}}}},25799:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(72189)},30079:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(72189),e.i(25799)},14991:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({DiffEditor:()=>p,Editor:()=>x,default:()=>y,useMonaco:()=>h}),e.i(30079);var n=e.i(19886),o=e.i(72189),i={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},a={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},s=function({children:e}){return n.default.createElement("div",{style:a.container},e)},l=(0,n.memo)(function({width:e,height:t,isEditorReady:r,loading:o,_ref:a,className:l,wrapperProps:c}){return n.default.createElement("section",{style:{...i.wrapper,width:e,height:t},...c},!r&&n.default.createElement(s,null,o),n.default.createElement("div",{ref:a,style:{...i.fullWidth,...!r&&i.hide},className:l}))}),c=function(e){(0,n.useEffect)(e,[])},u=function(e,t,r=!0){let o=(0,n.useRef)(!0);(0,n.useEffect)(o.current||!r?()=>{o.current=!1}:e,t)};function d(){}function f(e,t,r,n){var o,i,a,s,l,c;return o=e,i=n,o.editor.getModel(m(o,i))||(a=e,s=t,l=r,c=n,a.editor.createModel(s,l,c?m(a,c):void 0))}function m(e,t){return e.Uri.parse(t)}var p=(0,n.memo)(function({original:e,modified:t,language:r,originalLanguage:i,modifiedLanguage:a,originalModelPath:s,modifiedModelPath:m,keepCurrentOriginalModel:p=!1,keepCurrentModifiedModel:h=!1,theme:g="light",loading:v="Loading...",options:x={},height:y="100%",width:b="100%",className:w,wrapperProps:j={},beforeMount:S=d,onMount:N=d}){let[C,E]=(0,n.useState)(!1),[k,R]=(0,n.useState)(!0),T=(0,n.useRef)(null),P=(0,n.useRef)(null),O=(0,n.useRef)(null),_=(0,n.useRef)(N),M=(0,n.useRef)(S),A=(0,n.useRef)(!1);c(()=>{let e=o.default.init();return e.then(e=>(P.current=e)&&R(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return T.current?(t=T.current?.getModel(),void(p||t?.original?.dispose(),h||t?.modified?.dispose(),T.current?.dispose())):e.cancel()}}),u(()=>{if(T.current&&P.current){let t=T.current.getOriginalEditor(),n=f(P.current,e||"",i||r||"text",s||"");n!==t.getModel()&&t.setModel(n)}},[s],C),u(()=>{if(T.current&&P.current){let e=T.current.getModifiedEditor(),n=f(P.current,t||"",a||r||"text",m||"");n!==e.getModel()&&e.setModel(n)}},[m],C),u(()=>{let e=T.current.getModifiedEditor();e.getOption(P.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],C),u(()=>{T.current?.getModel()?.original.setValue(e||"")},[e],C),u(()=>{let{original:e,modified:t}=T.current.getModel();P.current.editor.setModelLanguage(e,i||r||"text"),P.current.editor.setModelLanguage(t,a||r||"text")},[r,i,a],C),u(()=>{P.current?.editor.setTheme(g)},[g],C),u(()=>{T.current?.updateOptions(x)},[x],C);let I=(0,n.useCallback)(()=>{if(!P.current)return;M.current(P.current);let n=f(P.current,e||"",i||r||"text",s||""),o=f(P.current,t||"",a||r||"text",m||"");T.current?.setModel({original:n,modified:o})},[r,t,a,e,i,s,m]),D=(0,n.useCallback)(()=>{!A.current&&O.current&&(T.current=P.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...x}),I(),P.current?.editor.setTheme(g),E(!0),A.current=!0)},[x,g,I]);return(0,n.useEffect)(()=>{C&&_.current(T.current,P.current)},[C]),(0,n.useEffect)(()=>{k||C||D()},[k,C,D]),n.default.createElement(l,{width:b,height:y,isEditorReady:C,loading:v,_ref:O,className:w,wrapperProps:j})}),h=function(){let[e,t]=(0,n.useState)(o.default.__getMonacoInstance());return c(()=>{let r;return e||(r=o.default.init()).then(e=>{t(e)}),()=>r?.cancel()}),e},g=function(e){let t=(0,n.useRef)();return(0,n.useEffect)(()=>{t.current=e},[e]),t.current},v=new Map,x=(0,n.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:i,language:a,path:s,theme:m="light",line:p,loading:h="Loading...",options:x={},overrideServices:y={},saveViewState:b=!0,keepCurrentModel:w=!1,width:j="100%",height:S="100%",className:N,wrapperProps:C={},beforeMount:E=d,onMount:k=d,onChange:R,onValidate:T=d}){let[P,O]=(0,n.useState)(!1),[_,M]=(0,n.useState)(!0),A=(0,n.useRef)(null),I=(0,n.useRef)(null),D=(0,n.useRef)(null),L=(0,n.useRef)(k),F=(0,n.useRef)(E),z=(0,n.useRef)(),H=(0,n.useRef)(i),B=g(s),$=(0,n.useRef)(!1),U=(0,n.useRef)(!1);c(()=>{let e=o.default.init();return e.then(e=>(A.current=e)&&M(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>I.current?void(z.current?.dispose(),w?b&&v.set(s,I.current.saveViewState()):I.current.getModel()?.dispose(),I.current.dispose()):e.cancel()}),u(()=>{let n=f(A.current,e||i||"",t||a||"",s||r||"");n!==I.current?.getModel()&&(b&&v.set(B,I.current?.saveViewState()),I.current?.setModel(n),b&&I.current?.restoreViewState(v.get(s)))},[s],P),u(()=>{I.current?.updateOptions(x)},[x],P),u(()=>{I.current&&void 0!==i&&(I.current.getOption(A.current.editor.EditorOption.readOnly)?I.current.setValue(i):i!==I.current.getValue()&&(U.current=!0,I.current.executeEdits("",[{range:I.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),I.current.pushUndoStop(),U.current=!1))},[i],P),u(()=>{let e=I.current?.getModel();e&&a&&A.current?.editor.setModelLanguage(e,a)},[a],P),u(()=>{void 0!==p&&I.current?.revealLine(p)},[p],P),u(()=>{A.current?.editor.setTheme(m)},[m],P);let W=(0,n.useCallback)(()=>{if(!(!D.current||!A.current)&&!$.current){F.current(A.current);let n=s||r,o=f(A.current,i||e||"",t||a||"",n||"");I.current=A.current?.editor.create(D.current,{model:o,automaticLayout:!0,...x},y),b&&I.current.restoreViewState(v.get(n)),A.current.editor.setTheme(m),void 0!==p&&I.current.revealLine(p),O(!0),$.current=!0}},[e,t,r,i,a,s,x,y,b,m,p]);return(0,n.useEffect)(()=>{P&&L.current(I.current,A.current)},[P]),(0,n.useEffect)(()=>{_||P||W()},[_,P,W]),H.current=i,(0,n.useEffect)(()=>{P&&R&&(z.current?.dispose(),z.current=I.current?.onDidChangeModelContent(e=>{U.current||R(I.current.getValue(),e)}))},[P,R]),(0,n.useEffect)(()=>{if(P){let e=A.current.editor.onDidChangeMarkers(e=>{let t=I.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=A.current.editor.getModelMarkers({resource:t});T?.(e)}});return()=>{e?.dispose()}}return()=>{}},[P,T]),n.default.createElement(l,{width:j,height:S,isEditorReady:P,loading:h,_ref:D,className:N,wrapperProps:C})}),y=x},94087:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(30079),e.i(19886),e.i(14991)},20561:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>l});var n=e.i(20393),o=e.i(19886),i=e.i(9385),a=e.i(70599),s=e.i(86871);function l({className:e,currentProjectName:t,currentEnvName:r}){let[l,c]=(0,o.useState)([]),[u,d]=(0,o.useState)(!0),[f,m]=(0,o.useState)(null),[p,h]=(0,o.useState)(new Set),[g,v]=(0,o.useState)(""),[x,y]=(0,o.useState)(!1),[b,w]=(0,o.useState)(""),[j,S]=(0,o.useState)(!1),[N,C]=(0,o.useState)(null),E=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(l.length>0){let e=l.find(e=>e.projectName===t&&e.envName===r);if(e&&e.subApps.length>0){let t=new Set;e.subApps.forEach(e=>{l.forEach(r=>{r.envName===e&&t.add(O(r))})}),h(t)}}},[l,t,r]);let k=async()=>{d(!0),m(null);try{let e=await fetch("/api/all-projects-envs"),t=await e.json();t.success?c(t.data):m(t.error||"获取项目环境信息失败")}catch(e){console.error("获取项目环境信息失败:",e),m("获取项目环境信息失败: 网络错误")}finally{d(!1)}};(0,o.useEffect)(()=>(k(),R(),()=>{T()}),[r]);let R=()=>{E.current&&T();let e=`microapp-table-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,t=`/api/microapp-proxy-change-stream?env=${encodeURIComponent(r)}&clientId=${encodeURIComponent(e)}`;console.log(`[SSE] 建立连接到: ${t}`),C(null);try{let e=new EventSource(t);E.current=e,e.onopen=()=>{console.log(`[SSE] 连接已建立,环境: ${r}`),S(!0),C(null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);P(t)}catch(e){console.error("[SSE] 解析消息失败:",e)}},e.onerror=()=>{console.error(`[SSE] 连接错误,环境: ${r}`),S(!1),C("实时推送连接断开"),setTimeout(()=>{E.current&&E.current.readyState!==EventSource.CLOSED||(console.log("[SSE] 尝试重新连接..."),R())},3e3)}}catch(e){console.error("[SSE] 建立连接失败:",e),C("无法建立实时推送连接")}},T=()=>{E.current&&(console.log("[SSE] 关闭连接"),E.current.close(),E.current=null,S(!1))},P=e=>{switch(console.log("[SSE] 收到消息:",e),e.type){case"connection-established":console.log(`[SSE] 连接确认: ${e.message}`),S(!0),C(null);break;case"microapp-proxy-config-change":if(console.log(`[SSE] 配置变化通知: 环境=${e.envName}`),console.log(`[SSE] 变化详情:`,e.changes),e.changes){let{added:t,removed:r}=e.changes,n="";t.length>0&&(n+=`新增: ${t.join(", ")}`),r.length>0&&(n&&(n+="; "),n+=`移除: ${r.join(", ")}`),w(`配置已更新 (${n})`)}else w("配置已更新");k(),setTimeout(()=>w(""),3e3);break;case"heartbeat":S(!0),C(null);break;default:console.log("[SSE] 未知消息类型:",e.type)}},O=e=>`${e.projectName}-${e.envName}`,_=g.trim()?l.filter(e=>e.projectName.toLowerCase().includes(g.toLowerCase())||e.envName.toLowerCase().includes(g.toLowerCase())||e.host.toLowerCase().includes(g.toLowerCase())):l,M=(e,t)=>{let r=new Set(p);t?r.add(e):r.delete(e),h(r)},A=e=>{e?h(new Set(_.map(e=>O(e)))):h(new Set)},I=async()=>{y(!0),w("");try{let e=Array.from(p).map(e=>{let t=l.find(t=>O(t)===e);return t?t.envName:""}).filter(e=>""!==e),n=[...new Set(e)],o=await fetch("/api/microapp-proxy-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:t,envName:r,selectedItems:n})}),i=await o.json();i.success?(w(i.message||"保存成功"),await k()):w(`保存失败: ${i.error}`)}catch(e){console.error("保存MicroApp代理配置失败:",e),w("保存失败: 网络错误")}finally{y(!1),setTimeout(()=>{w("")},5e3)}},D=p.size,L=_.length>0&&_.every(e=>p.has(O(e))),F=_.some(e=>p.has(O(e)));return u?(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsx)("h4",{className:"text-md font-medium mb-4",children:"MicroApp代理配置"}),(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{className:"text-gray-500",children:"加载中..."})})]}):f?(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsx)("h4",{className:"text-md font-medium mb-4",children:"MicroApp代理配置"}),(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-red-500",children:f}),(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:k,className:"mt-2",children:"重试"})]})]}):(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-md font-medium",children:"MicroApp代理配置"}),(0,n.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:["为 ",t," - ",r," 环境配置微应用代理"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("div",{className:`w-2 h-2 rounded-full ${j?"bg-green-500":"bg-red-500"}`,title:j?"实时推送已连接":"实时推送断开"}),(0,n.jsx)("span",{className:"text-xs text-gray-500",children:j?"实时":"离线"})]}),(b||N)&&(0,n.jsx)("span",{className:`text-sm max-w-xs ${b&&b.includes("失败")||N?"text-red-600":b&&b.includes("但有")?"text-yellow-600":"text-green-600"}`,title:b||N||"",children:b||N}),(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:k,disabled:x,children:"刷新"}),(0,n.jsx)(s.Button,{variant:"default",size:"sm",onClick:I,disabled:x,children:x?"保存中...":"保存配置"})]})]}),(0,n.jsxs)("div",{className:"space-y-3 mb-4",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,n.jsx)(a.Input,{placeholder:"搜索项目名称、环境名称或Host...",value:g,onChange:e=>v(e.target.value),className:"pr-8"}),g&&(0,n.jsx)(s.Button,{variant:"ghost",size:"sm",onClick:()=>{v("")},className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-gray-100",children:"×"})]})}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)("span",{children:["显示 ",_.length," 个环境配置",g&&` (搜索: "${g}")`]}),D>0&&(0,n.jsxs)("span",{className:"text-blue-600 font-medium",children:["已选择 ",D," 项"]})]}),D>0&&(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:()=>{h(new Set)},children:"清空选择"})]})]}),_.length>0?(0,n.jsx)("div",{className:"border rounded-md",children:(0,n.jsxs)(i.Table,{children:[(0,n.jsx)(i.TableHeader,{children:(0,n.jsxs)(i.TableRow,{children:[(0,n.jsx)(i.TableHead,{className:"w-12",children:(0,n.jsx)("input",{type:"checkbox",checked:L,onChange:e=>A(e.target.checked),ref:e=>{e&&(e.indeterminate=F&&!L)},className:"rounded border-gray-300"})}),(0,n.jsx)(i.TableHead,{children:"环境名称"}),(0,n.jsx)(i.TableHead,{children:"项目名称"}),(0,n.jsx)(i.TableHead,{children:"Host地址"}),(0,n.jsx)(i.TableHead,{children:"当前代理"})]})}),(0,n.jsx)(i.TableBody,{children:_.map(e=>{let t=O(e),r=p.has(t);return(0,n.jsxs)(i.TableRow,{children:[(0,n.jsx)(i.TableCell,{children:(0,n.jsx)("input",{type:"checkbox",checked:r,onChange:e=>M(t,e.target.checked),className:"rounded border-gray-300"})}),(0,n.jsx)(i.TableCell,{children:(0,n.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800",children:e.envName})}),(0,n.jsx)(i.TableCell,{className:"font-medium",children:e.projectName}),(0,n.jsx)(i.TableCell,{className:"font-mono text-sm",children:e.host}),(0,n.jsxs)(i.TableCell,{className:"text-sm text-gray-600",children:[e.currentProxy,e.proxyEnv[e.currentProxy]&&(0,n.jsx)("div",{className:"text-xs text-gray-500",children:e.proxyEnv[e.currentProxy]})]})]},t)})})]})}):(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{className:"text-gray-500",children:g?"没有找到匹配的环境配置":"暂无环境配置"})}),D>0&&(0,n.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm text-blue-700",children:["已选择 ",D," 个环境配置将作为微应用代理"]}),(0,n.jsx)("span",{className:"text-xs text-blue-600",children:"点击上方“保存配置”按钮保存设置"})]})})]})}},94334:function(e){var{g:t,__dirname:r,m:n,e:o}=e},51904:function(e){var{g:t,__dirname:r,m:n,e:o}=e,i=e.i(47412);e.r(94334);var a=e.r(19886),s=a&&"object"==typeof a&&"default"in a?a:{default:a},l=void 0!==i.default&&i.default.env&&!0,c=function(e){return"[object String]"===Object.prototype.toString.call(e)},u=function(){function e(e){var t=void 0===e?{}:e,r=t.name,n=void 0===r?"stylesheet":r,o=t.optimizeForSpeed,i=void 0===o?l:o;d(c(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",d("boolean"==typeof i,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=i,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var a="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=a?a.getAttribute("content"):null}var t,r=e.prototype;return r.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},r.isOptimizeForSpeed=function(){return this._optimizeForSpeed},r.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(l||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,r){return"number"==typeof r?e._serverSheet.cssRules[r]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),r},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},r.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},r.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},r.insertRule=function(e,t){if(d(c(e),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var r=this.getSheet();"number"!=typeof t&&(t=r.cssRules.length);try{r.insertRule(e,t)}catch(t){return l||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},r.replaceRule=function(e,t){if(this._optimizeForSpeed||"undefined"==typeof window){var r="undefined"!=typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!r.cssRules[e])return e;r.deleteRule(e);try{r.insertRule(t,e)}catch(n){l||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),r.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];d(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},r.deleteRule=function(e){if("undefined"==typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},r.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},r.cssRules=function(){var e=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,r){return r?t=t.concat(Array.prototype.map.call(e.getSheetForTag(r).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},r.makeStyleTag=function(e,t,r){t&&d(c(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var o=document.head||document.getElementsByTagName("head")[0];return r?o.insertBefore(n,r):o.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var f=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},m={};function p(e,t){if(!t)return"jsx-"+e;var r=String(t),n=e+r;return m[n]||(m[n]="jsx-"+f(e+"-"+r)),m[n]}function h(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var r=e+t;return m[r]||(m[r]=t.replace(/__jsx-style-dynamic-selector/g,e)),m[r]}var g=function(){function e(e){var t=void 0===e?{}:e,r=t.styleSheet,n=void 0===r?null:r,o=t.optimizeForSpeed,i=void 0!==o&&o;this._sheet=n||new u({name:"styled-jsx",optimizeForSpeed:i}),this._sheet.inject(),n&&"boolean"==typeof i&&(this._sheet.setOptimizeForSpeed(i),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var r=this.getIdAndRules(e),n=r.styleId,o=r.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var i=o.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=i,this._instancesCounts[n]=1},t.remove=function(e){var t=this,r=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(r in this._instancesCounts,"styleId: `"+r+"` not found"),this._instancesCounts[r]-=1,this._instancesCounts[r]<1){var n=this._fromServer&&this._fromServer[r];n?(n.parentNode.removeChild(n),delete this._fromServer[r]):(this._indices[r].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[r]),delete this._instancesCounts[r]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],r=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return r[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,r;return t=this.cssRules(),void 0===(r=e)&&(r={}),t.map(function(e){var t=e[0],n=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:r.nonce?r.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,r=e.dynamic,n=e.id;if(r){var o=p(n,r);return{styleId:o,rules:Array.isArray(t)?t.map(function(e){return h(o,e)}):[h(o,t)]}}return{styleId:p(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),v=a.createContext(null);function x(){return new g}function y(){return a.useContext(v)}v.displayName="StyleSheetContext";var b=s.default.useInsertionEffect||s.default.useLayoutEffect,w="undefined"!=typeof window?x():void 0;function j(e){var t=w||y();return t&&("undefined"==typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}j.dynamic=function(e){return e.map(function(e){return p(e[0],e[1])}).join(" ")},o.StyleRegistry=function(e){var t=e.registry,r=e.children,n=a.useContext(v),o=a.useState(function(){return n||t||x()})[0];return s.default.createElement(v.Provider,{value:o},r)},o.createStyleRegistry=x,o.style=j,o.useStyleRegistry=y},56591:function(e){var{g:t,__dirname:r,m:n,e:o}=e;n.exports=e.r(51904).style},23619:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>a});var n=e.i(20393),o=e.i(56591),i=e.i(19886);function a({logs:e}){let t=(0,i.useRef)(null),r=(0,i.useRef)(!0),a=e=>e.replace(/\x1b\[[0-9;]*m/g,"").replace(/\x1b\[[0-9]*[A-Z]/g,"").replace(/\x1b\[K/g,"").replace(/\x1b\[2K/g,"").replace(/\x1b\[G/g,"").replace(/\x1b\[\d+A/g,"").replace(/\x1b\[\d+B/g,"").replace(/\x1b\[\d+C/g,"").replace(/\x1b\[\d+D/g,"").replace(/\[2K\[1A\[2K\[G/g,"").replace(/\[\d+[A-Z]/g,"").replace(/\[STDOUT\]/g,"[OUT]").replace(/\[STDERR\]/g,"[ERR]"),s=()=>{if(!t.current)return!0;let{scrollTop:e,scrollHeight:r,clientHeight:n}=t.current;return r-e-n<100},l=()=>{t.current&&r.current&&(t.current.scrollTop=t.current.scrollHeight)};return(0,i.useEffect)(()=>{setTimeout(l,10)},[e]),(0,n.jsxs)("div",{ref:t,onScroll:()=>{r.current=s()},style:{scrollBehavior:"smooth",maxHeight:"100%"},className:"jsx-b464fb0f479e34f5 h-full w-full overflow-y-auto overflow-x-hidden p-4 custom-scrollbar",children:[(0,n.jsx)(o.default,{id:"b464fb0f479e34f5",children:".custom-scrollbar.jsx-b464fb0f479e34f5{scrollbar-width:thin;scrollbar-color:#fff3 #0000001a}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar{width:10px;height:10px}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar-track{background:#0000001a;border-radius:5px}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar-thumb{background:#ffffff4d;border-radius:5px}.custom-scrollbar.jsx-b464fb0f479e34f5.jsx-b464fb0f479e34f5::-webkit-scrollbar-thumb:hover{background:#fff6}"}),(0,n.jsx)("div",{className:"jsx-b464fb0f479e34f5 space-y-0.5",children:e.length>0?e.map((e,t)=>{let r=a(e);if(!r.trim())return null;let o=e.includes("[STDERR]"),i=e.includes("[SYSTEM]"),s=r.match(/^\[([\d-T:.Z]+)\]/)?.[1],l=r.replace(/^\[[\d-T:.Z]+\]\s*/,"");return(0,n.jsxs)("div",{className:`jsx-b464fb0f479e34f5 font-mono text-xs leading-5 ${o?"text-red-400":i?"text-yellow-400":"text-gray-100"}`,children:[s&&(0,n.jsxs)("span",{className:"jsx-b464fb0f479e34f5 text-gray-500 mr-2",children:["[",new Date(s).toLocaleTimeString("zh-CN"),"]"]}),(0,n.jsx)("span",{className:"jsx-b464fb0f479e34f5 whitespace-pre-wrap break-all",children:l})]},t)}):(0,n.jsx)("div",{className:"jsx-b464fb0f479e34f5 text-center text-gray-500 mt-8",children:"等待日志输出..."})})]})}},40941:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>a});var n=e.i(20393),o=e.i(19886),i=e.i(86871);function a({projectName:e,className:t="",compact:r=!1}){let[a,s]=(0,o.useState)(null),[l,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(""),p=(0,o.useCallback)(async()=>{if(e){c(!0),d(null);try{let t=await fetch(`/api/current-branch?project=${encodeURIComponent(e)}`),r=await t.json();r.success?(s(r.data),m(new Date().toLocaleTimeString("zh-CN",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}))):d(r.error||"获取分支信息失败")}catch(e){d("网络请求失败"),console.error("获取分支信息失败:",e)}finally{c(!1)}}},[e]);(0,o.useEffect)(()=>{p()},[p]),(0,o.useEffect)(()=>{if(!e)return;let t=setInterval(()=>{p()},r?15e3:3e4);return()=>clearInterval(t)},[e,p,r]);let h=e=>0===e?"text-gray-500":"text-orange-600",g=()=>{if(!a)return null;let{ahead:e,behind:t}=a.status;return e>0&&t>0?(0,n.jsx)("span",{className:"text-yellow-500 text-xs",children:"↕"}):e>0?(0,n.jsx)("span",{className:"text-green-500 text-xs",children:"↑"}):t>0?(0,n.jsx)("span",{className:"text-red-500 text-xs",children:"↓"}):(0,n.jsx)("span",{className:"text-gray-400 text-xs",children:"✓"})};return l&&!a?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-gray-50 rounded-md ${t}`,children:[(0,n.jsx)("div",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"}),(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"加载中..."})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsx)("div",{className:"animate-spin w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full"})]}),(0,n.jsx)("div",{className:"text-sm text-gray-500",children:"正在加载分支信息..."})]}):u?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-red-50 rounded-md ${t}`,children:[(0,n.jsx)("span",{className:"text-xs text-red-500",children:"分支信息错误"}),(0,n.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:p,disabled:l,className:"h-5 w-5 p-0 text-red-500 hover:bg-red-100",children:"↻"})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsx)(i.Button,{variant:"outline",size:"sm",onClick:p,disabled:l,className:"h-6 px-2 text-xs",children:l?"刷新中...":"重试"})]}),(0,n.jsx)("div",{className:"text-sm text-red-500 bg-red-50 p-2 rounded",children:u})]}):a?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-blue-50 border border-blue-200 rounded-md ${t}`,children:[(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-blue-600",children:[(0,n.jsx)("polyline",{points:"6,3 6,15"}),(0,n.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("path",{d:"m18,9a9,9 0 0,1-9,9"})]}),(0,n.jsx)("span",{className:"text-sm font-medium text-blue-800",children:a.currentBranch}),g(),(0,n.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:p,disabled:l,className:"h-5 w-5 p-0 text-blue-600 hover:bg-blue-100",title:"刷新分支信息",children:l?(0,n.jsx)("div",{className:"animate-spin w-3 h-3 border-2 border-blue-600 border-t-transparent rounded-full"}):"↻"})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,n.jsx)("span",{className:"text-xs text-gray-400",children:f}),(0,n.jsx)(i.Button,{variant:"outline",size:"sm",onClick:p,disabled:l,className:"h-6 px-2 text-xs",children:l?"刷新中...":"刷新"})]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"分支:"}),(0,n.jsx)("span",{className:"text-sm font-medium text-blue-600 bg-blue-50 px-2 py-1 rounded",children:a.currentBranch}),g()]})}),(0,n.jsxs)("div",{className:"bg-gray-50 p-3 rounded text-xs space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"提交:"}),(0,n.jsx)("code",{className:"bg-gray-200 px-1 rounded font-mono text-xs",children:a.lastCommit.hash})]}),(0,n.jsx)("div",{className:"text-gray-700 font-medium line-clamp-2",children:a.lastCommit.message}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-gray-500",children:[(0,n.jsx)("span",{children:a.lastCommit.author}),(0,n.jsx)("span",{children:a.lastCommit.date})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"领先:"}),(0,n.jsx)("span",{className:h(a.status.ahead),children:a.status.ahead})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"落后:"}),(0,n.jsx)("span",{className:h(a.status.behind),children:a.status.behind})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"已修改:"}),(0,n.jsx)("span",{className:h(a.status.modified),children:a.status.modified})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"已暂存:"}),(0,n.jsx)("span",{className:h(a.status.staged),children:a.status.staged})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between col-span-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"未跟踪:"}),(0,n.jsx)("span",{className:h(a.status.untracked),children:a.status.untracked})]})]}),(a.status.ahead>0||a.status.behind>0)&&(0,n.jsxs)("div",{className:"text-xs p-2 rounded bg-yellow-50 border border-yellow-200",children:[a.status.ahead>0&&a.status.behind>0&&(0,n.jsxs)("span",{className:"text-yellow-700",children:["分支与远程不同步,有 ",a.status.ahead," 个本地提交,",a.status.behind," 个远程提交"]}),a.status.ahead>0&&0===a.status.behind&&(0,n.jsxs)("span",{className:"text-green-700",children:["本地领先远程 ",a.status.ahead," 个提交"]}),0===a.status.ahead&&a.status.behind>0&&(0,n.jsxs)("span",{className:"text-red-700",children:["本地落后远程 ",a.status.behind," 个提交"]})]})]})]}):r?(0,n.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 bg-gray-50 rounded-md ${t}`,children:(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"暂无分支信息"})}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"})}),(0,n.jsx)("div",{className:"text-sm text-gray-500",children:"暂无分支信息"})]})}},66445:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>w});var n=e.i(20393),o=e.i(19886),i=e.i(42152),a=e.i(86871),s=e.i(72242),l=e.i(40989),c=e.i(70599),u=e.i(80226),d=e.i(46284),f=e.i(9385),m=e.i(19579),p=e.i(42736);e.i(94087);var h=e.i(14991),g=e.i(20561),v=e.i(23619),x=e.i(40941),y=function(e){return e.PENDING="pending",e.EXISTING="existing",e.CLONING="cloning",e.SUCCESS="success",e.FAILED="failed",e.RETRYING="retrying",e}(y||{});function b(){let e=(0,i.useSearchParams)(),t=(0,i.useRouter)(),r=e.get("project"),[y,b]=(0,o.useState)(null),[w,j]=(0,o.useState)(!0),[S,N]=(0,o.useState)(null),[C,E]=(0,o.useState)({}),[k,R]=(0,o.useState)({mockingIntercept:!1,mockOpen:!1}),[T,P]=(0,o.useState)(!1),[O,_]=(0,o.useState)(null),[M,A]=(0,o.useState)(!1),[I,D]=(0,o.useState)(1),[L]=(0,o.useState)(10),[F,z]=(0,o.useState)(""),[H,B]=(0,o.useState)(null),[$,U]=(0,o.useState)(!1),[W,V]=(0,o.useState)(!1),[K,G]=(0,o.useState)(!1),[q,Y]=(0,o.useState)(!0),[X,J]=(0,o.useState)(null),[Z,Q]=(0,o.useState)([]),[ee,et]=(0,o.useState)(!1),[er,en]=(0,o.useState)(!1),[eo,ei]=(0,o.useState)(!1),[ea,es]=(0,o.useState)({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0}),[el,ec]=(0,o.useState)(null),[eu,ed]=(0,o.useState)(!1),[ef,em]=(0,o.useState)({open:!1,apiName:"",method:"",siteName:""}),[ep,eh]=(0,o.useState)({open:!1,apiName:"",apiPath:""}),[eg,ev]=(0,o.useState)({open:!1,type:"success",message:""}),[ex,ey]=(0,o.useState)(!1),[eb,ew]=(0,o.useState)([]),[ej,eS]=(0,o.useState)(!1),[eN,eC]=(0,o.useState)(""),[eE,ek]=(0,o.useState)({}),[eR,eT]=(0,o.useState)(!1),[eP,eO]=(0,o.useState)(""),[e_,eM]=(0,o.useState)([]),eA=(0,o.useCallback)(async()=>{X&&await eD(X)},[X]),eI=(0,o.useCallback)(async e=>{$&&(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),await eA())},[$,eA]);(0,o.useEffect)(()=>{if($)return document.addEventListener("keydown",eI),()=>{document.removeEventListener("keydown",eI)}},[$,X,eI]);let eD=async e=>{try{await new Promise(e=>setTimeout(e,200));let t=e.getModel();if(t){await e.getAction("editor.action.formatDocument")?.run();let r=t.getValue();if(r&&!r.includes("\n")&&r.length>50){let n=r.replace(/\{\s*/g,"{\n ").replace(/\}\s*/g,"\n}").replace(/;\s*/g,";\n ").replace(/,\s*/g,",\n ").replace(/\n\s*\n/g,"\n").trim();n!==r&&(t.setValue(n),setTimeout(()=>{e.getAction("editor.action.formatDocument")?.run()},100))}}}catch(e){console.log("自动格式化失败:",e)}},eL=()=>{t.push("/initialization")},eF=async()=>{et(!0);try{let e=await fetch("/api/check-workspace"),t=await e.json();if(t.success&&t.projects){let e=t.projects.map(e=>({name:e.name,status:e.status,message:e.message}));Q(e)}else console.error("获取项目列表失败:",t.error),Q([])}catch(e){console.error("获取项目列表失败:",e),Q([])}finally{et(!1)}},ez=async()=>{if(r){P(!0);try{let e=await fetch("/api/open-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})}),t=await e.json();t.success||(console.error("打开项目失败:",t.error),ts("error",`打开项目失败: ${t.error}`))}catch(e){console.error("打开项目失败:",e),ts("error","打开项目失败: 网络错误")}finally{P(!1)}}},eH=async()=>{if(0===eb.length)return void ts("error","请至少选择一个项目");eS(!0);try{let e=await fetch("/api/workspace/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:eb})}),t=await e.json();t.success?(ts("success",t.message||"工作区已在 Cursor 中打开"),ey(!1),ew([])):ts("error",`创建工作区失败: ${t.error}`)}catch(e){console.error("创建工作区失败:",e),ts("error","创建工作区失败: 网络错误")}finally{eS(!1)}},eB=e=>{ew(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};(0,o.useEffect)(()=>{if(!r){N("项目名称缺失"),j(!1);return}(async()=>{try{let e=await fetch(`/api/project-config?project=${encodeURIComponent(r)}`),t=await e.json();if(t.success){b(t.data);let e={};Object.keys(t.data.envs).forEach(r=>{let n=t.data.envs[r],o="";o=n.proxyEnv[n.currentProxy]?n.proxyEnv[n.currentProxy]:n.currentProxy;let i="";i=n.proxyEnv[n.currentProxy]?n.currentProxy:"custom",e[r]={selectedProxy:o||"",selectedOption:i}}),E(e),R({mockingIntercept:t.data.mockingIntercept||!1,mockOpen:t.data.mockOpen||!1})}else N(t.error)}catch(e){N("获取项目配置失败"),console.error("获取项目配置失败:",e)}finally{j(!1)}})()},[r]);let e$=(0,o.useCallback)(async()=>{if(r){A(!0);try{let e=await fetch(`/api/mock-file?project=${encodeURIComponent(r)}`),t=await e.json();t.success?_(t.data):console.error("获取Mock数据失败:",t.error)}catch(e){console.error("获取Mock数据失败:",e)}finally{A(!1)}}},[r]);(0,o.useEffect)(()=>{if(y&&r){let e=Object.keys(y.envs),t=new URLSearchParams(window.location.search).get("tab"),r="";(r=F&&("mock"===F||e.includes(F))?F:t&&("mock"===t||e.includes(t))?t:e.length>0?e[0]:"mock")!==F&&(z(r),"mock"===r&&e$())}},[y,r,F,e$]),(0,o.useEffect)(()=>{eF()},[]);let eU=(0,o.useCallback)(async()=>{if(!r||!y)return;let e={};for(let t of Object.keys(y.envs))e[`${t}`]={loading:!0,running:!1};ek(e);let t=Object.keys(y.envs).map(async e=>{try{let t=await fetch(`/api/process/status?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`),n=await t.json();if(n.success&&n.data)return{envName:e,status:n.data}}catch(t){console.error(`获取环境 ${e} 状态失败:`,t)}return{envName:e,status:{running:!1}}}),n=await Promise.all(t),o={};n.forEach(({envName:e,status:t})=>{o[e]={running:t.running||!1,pid:t.pid,startTime:t.startTime,port:t.port,loading:!1}}),ek(o)},[r,y]),eW=async e=>{if(!r||!y)return;let t=y.envs[e];if(!t.startCommand)return void ts("error","该环境未配置启动命令");ek(t=>({...t,[e]:{...t[e],loading:!0}}));try{let n=await fetch("/api/process/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,envName:e,startCommand:t.startCommand})}),o=await n.json();if(o.success)ek(t=>({...t,[e]:{running:!0,pid:o.data.pid,startTime:o.data.startTime,port:o.data.port,loading:!1}}));else throw Error(o.error||"启动失败")}catch(t){console.error("启动进程失败:",t),ts("error",`启动失败: ${t instanceof Error?t.message:"未知错误"}`),ek(t=>({...t,[e]:{...t[e],loading:!1}}))}},eV=async e=>{if(r){ek(t=>({...t,[e]:{...t[e],loading:!0}}));try{let t=await fetch(`/api/process/start?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`,{method:"DELETE"}),n=await t.json();if(n.success)ek(t=>({...t,[e]:{running:!1,loading:!1}}));else throw Error(n.error||"停止失败")}catch(t){console.error("停止进程失败:",t),ts("error",`停止失败: ${t instanceof Error?t.message:"未知错误"}`),ek(t=>({...t,[e]:{...t[e],loading:!1}}))}}},[eK,eG]=(0,o.useState)(null),eq=e=>{if(!r)return;eK&&eK.close(),eM([]);let t=new EventSource(`/api/process/logs/stream?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`);t.onmessage=e=>{try{let t=JSON.parse(e.data);"log"===t.type?eM(e=>{let r=[...e,t.content];return r.length>1e3?r.slice(-1e3):r}):"init"===t.type?eM([t.message]):"end"===t.type&&eM(e=>[...e,`[系统] ${t.message}`])}catch(e){console.error("解析日志数据失败:",e)}},t.onerror=e=>{console.error("日志流错误:",e),t.close(),eG(null)},eG(t)},eY=()=>{eK&&(eK.close(),eG(null))},eX=e=>{eO(e),eT(!0),eq(e)},eJ=()=>{eT(!1),eM([]),eO(""),eY()};(0,o.useEffect)(()=>{if(y&&r){eU();let e=setInterval(()=>{eU()},5e3);return()=>clearInterval(e)}},[y,r,eU]);let eZ=(e,t)=>{if(!y)return;let r=y.envs[e],n="";n="custom"===t?C[e]?.selectedOption==="custom"?C[e]?.selectedProxy||"":r.proxyEnv.custom||"":r.proxyEnv[t]||"",E(r=>({...r,[e]:{...r[e],selectedProxy:n,selectedOption:t,saveMessage:""}}))},eQ=(e,t)=>{E(r=>({...r,[e]:{...r[e],selectedProxy:t,saveMessage:""}}))},e0=async e=>{R(t=>({...t,mockingIntercept:e,saving:!0,saveMessage:""}));try{let t=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,projectConfig:{mockingIntercept:e,mockOpen:k.mockOpen}})}),n=await t.json();if(n.success)b(t=>t?{...t,mockingIntercept:e}:t),R(e=>({...e,saving:!1,saveMessage:"Mock拦截配置已保存"})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},2e3);else throw Error(n.error||"保存失败")}catch(t){console.error("保存Mock拦截配置失败:",t),R(r=>({...r,mockingIntercept:!e,saving:!1,saveMessage:`保存失败: ${t instanceof Error?t.message:"未知错误"}`})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},3e3)}},e1=async e=>{R(t=>({...t,mockOpen:e,saving:!0,saveMessage:""}));try{let t=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,projectConfig:{mockingIntercept:k.mockingIntercept,mockOpen:e}})}),n=await t.json();if(n.success)b(t=>t?{...t,mockOpen:e}:t),R(e=>({...e,saving:!1,saveMessage:"Mock开启配置已保存"})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},2e3);else throw Error(n.error||"保存失败")}catch(t){console.error("保存Mock开启配置失败:",t),R(r=>({...r,mockOpen:!e,saving:!1,saveMessage:`保存失败: ${t instanceof Error?t.message:"未知错误"}`})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},3e3)}},e2=async e=>{if(!y||!r)return;let t=C[e]?.selectedProxy?.trim();if(!t)return void E(t=>({...t,[e]:{...t[e],saveMessage:"请先选择或填写代理地址"}}));let n=C[e]?.selectedOption,o="custom"===n;E(t=>({...t,[e]:{...t[e],saving:!0,saveMessage:""}}));try{let i={projectName:r,envName:e,newProxy:o?"custom":n||""};o&&(i.customProxyUrl=t);let a=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),s=await a.json();s.success?(b(r=>{if(!r)return r;let n={...r.envs};return n[e]={...n[e],currentProxy:s.data.currentProxy},"custom"===s.data.currentProxy&&(n[e].proxyEnv={...n[e].proxyEnv,custom:t}),{...r,envs:n}}),E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:"保存成功"}}))):E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:`保存失败: ${s.error}`}}))}catch(t){console.error("保存配置失败:",t),E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:"保存失败: 网络错误"}}))}},e3=async()=>{if(window.confirm("确定要一键关闭所有Mock吗?"))try{let e=await fetch("/api/cleanup-mock",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})});(await e.json()).success&&await e$()}catch(e){console.error("清空Mock配置失败:",e)}},e4=async()=>{if(window.confirm("确定要一键开启所有Mock吗?"))try{let e=await fetch("/api/open-all-mock",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})});(await e.json()).success&&await e$()}catch(e){console.error("清空Mock配置失败:",e)}},e8=async(e,t,n)=>{if(r)try{let o=await fetch("/api/mock-setting",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,apiName:e,method:t,currentSite:n})}),i=await o.json();i.success?_(r=>r?{...r,mockFiles:r.mockFiles.map(r=>r.apiName===e?{...r,methods:r.methods.map(e=>e.method===t?{...e,setting:{...e.setting,currentSite:n}}:e)}:r)}:r):(console.error("更新场景失败:",i.error),ts("error",`更新场景失败: ${i.error}`))}catch(e){console.error("更新场景失败:",e),ts("error","更新场景失败: 网络错误")}},e9=async(e,t,n)=>{if(r){V(!0),Y(!0);try{let o=await fetch(`/api/mock-file-content?project=${encodeURIComponent(r)}&apiName=${encodeURIComponent(e)}&method=${encodeURIComponent(t)}&siteName=${encodeURIComponent(n)}`),i=await o.json();i.success?(B({projectName:r,apiName:e,method:t,siteName:n,content:i.data.content}),U(!0)):(console.error("获取文件内容失败:",i.error),ts("error",`获取文件内容失败: ${i.error}`))}catch(e){console.error("获取文件内容失败:",e),ts("error","获取文件内容失败: 网络错误")}finally{V(!1)}}},e5=async()=>{if(H){G(!0);try{let e=await fetch("/api/mock-file-content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),t=await e.json();t.success?(U(!1),B(null)):(console.error("保存文件失败:",t.error),ts("error",`保存文件失败: ${t.error}`))}catch(e){console.error("保存文件失败:",e),ts("error","保存文件失败: 网络错误")}finally{G(!1)}}},e6=()=>{U(!1),B(null),Y(!0)},e7=(e,t)=>{"siteName"===e&&er||es(r=>({...r,[e]:t}))},te=(e,t)=>{let r=e.toUpperCase(),n=t.replace(/\//g,"_").replace(/^_/,"");switch(r){case"GET":return`const Mock = require('mockjs');
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return(0,n.useEffect)(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},J=({contentRef:e,descriptionId:t})=>{let r=Y("DialogDescriptionWarning"),o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return(0,n.useEffect)(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Z=N,Q=E,ee=P,et=_,er=D,en=B,eo=U,ei=V},12610:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({__iconNode:()=>t,default:()=>r});var n=e.i(49770);let t=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],r=(0,n.default)("x",t)}},96758:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({XIcon:()=>n.default});var n=e.i(12610)},19579:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Dialog:()=>s,DialogClose:()=>u,DialogContent:()=>f,DialogDescription:()=>g,DialogFooter:()=>p,DialogHeader:()=>m,DialogOverlay:()=>d,DialogPortal:()=>c,DialogTitle:()=>h,DialogTrigger:()=>l});var n=e.i(20393),o=e.i(75267),i=e.i(96758),a=e.i(39037);function s({...e}){return(0,n.jsx)(o.Root,{"data-slot":"dialog",...e})}function l({...e}){return(0,n.jsx)(o.Trigger,{"data-slot":"dialog-trigger",...e})}function c({...e}){return(0,n.jsx)(o.Portal,{"data-slot":"dialog-portal",...e})}function u({...e}){return(0,n.jsx)(o.Close,{"data-slot":"dialog-close",...e})}function d({className:e,...t}){return(0,n.jsx)(o.Overlay,{"data-slot":"dialog-overlay",className:(0,a.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function f({className:e,children:t,showCloseButton:r=!0,...s}){return(0,n.jsxs)(c,{"data-slot":"dialog-portal",children:[(0,n.jsx)(d,{}),(0,n.jsxs)(o.Content,{"data-slot":"dialog-content",className:(0,a.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",e),...s,children:[t,r&&(0,n.jsxs)(o.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,n.jsx)(i.XIcon,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,a.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function p({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-footer",className:(0,a.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function h({className:e,...t}){return(0,n.jsx)(o.Title,{"data-slot":"dialog-title",className:(0,a.cn)("text-lg leading-none font-semibold",e),...t})}function g({className:e,...t}){return(0,n.jsx)(o.Description,{"data-slot":"dialog-description",className:(0,a.cn)("text-muted-foreground text-sm",e),...t})}},92391:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({canUseDOM:()=>n,composeEventHandlers:()=>o,getActiveElement:()=>function e(t,r=!1){let{activeElement:n}=a(t);if(!n?.nodeName)return null;if(s(n)&&n.contentDocument)return e(n.contentDocument.body,r);if(r){let e=n.getAttribute("aria-activedescendant");if(e){let t=a(n).getElementById(e);if(t)return t}}return n},getOwnerDocument:()=>a,getOwnerWindow:()=>i,isFrame:()=>s});var n=!!("undefined"!=typeof window&&window.document&&window.document.createElement);function o(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function i(e){if(!n)throw Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}function a(e){if(!n)throw Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function s(e){return"IFRAME"===e.tagName}},65113:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Presence:()=>a,Root:()=>l});var n=e.i(19886),o=e.i(28537),i=e.i(91327),a=e=>{let{present:t,children:r}=e,a=function(e){var t,r;let[o,a]=(0,n.useState)(),l=(0,n.useRef)(null),c=(0,n.useRef)(e),u=(0,n.useRef)("none"),[d,f]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},(0,n.useReducer)((e,t)=>r[e][t]??e,t));return(0,n.useEffect)(()=>{let e=s(l.current);u.current="mounted"===d?e:"none"},[d]),(0,i.useLayoutEffect)(()=>{let t=l.current,r=c.current;if(r!==e){let n=u.current,o=s(t);e?f("MOUNT"):"none"===o||t?.display==="none"?f("UNMOUNT"):r&&n!==o?f("ANIMATION_OUT"):f("UNMOUNT"),c.current=e}},[e,f]),(0,i.useLayoutEffect)(()=>{if(o){let e,t=o.ownerDocument.defaultView??window,r=r=>{let n=s(l.current).includes(CSS.escape(r.animationName));if(r.target===o&&n&&(f("ANIMATION_END"),!c.current)){let r=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=r)})}},n=e=>{e.target===o&&(u.current=s(l.current))};return o.addEventListener("animationstart",n),o.addEventListener("animationcancel",r),o.addEventListener("animationend",r),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",n),o.removeEventListener("animationcancel",r),o.removeEventListener("animationend",r)}}f("ANIMATION_END")},[o,f]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:(0,n.useCallback)(e=>{l.current=e?getComputedStyle(e):null,a(e)},[])}}(t),l="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),c=(0,o.useComposedRefs)(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(r=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}(l));return"function"==typeof r||a.isPresent?(0,n.cloneElement)(l,{ref:c}):null};function s(e){return e?.animationName||"none"}a.displayName="Presence";var l=a},45155:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Checkbox:()=>w,CheckboxIndicator:()=>S,Indicator:()=>S,Root:()=>w,createCheckboxScope:()=>h,unstable_BubbleInput:()=>C,unstable_CheckboxBubbleInput:()=>C,unstable_CheckboxProvider:()=>x,unstable_CheckboxTrigger:()=>b,unstable_Provider:()=>x,unstable_Trigger:()=>b});var n=e.i(19886),o=e.i(28537),i=e.i(15836),a=e.i(92391),s=e.i(98644),l=e.i(44916),c=e.i(30287),u=e.i(65113),d=e.i(21349),f=e.i(20393),m="Checkbox",[p,h]=(0,i.createContextScope)(m),[g,v]=p(m);function x(e){let{__scopeCheckbox:t,checked:r,children:o,defaultChecked:i,disabled:a,form:l,name:c,onCheckedChange:u,required:d,value:p="on",internal_do_not_use_render:h}=e,[v,x]=(0,s.useControllableState)({prop:r,defaultProp:i??!1,onChange:u,caller:m}),[y,b]=(0,n.useState)(null),[w,j]=(0,n.useState)(null),S=(0,n.useRef)(!1),N=!y||!!l||!!y.closest("form"),C={checked:v,disabled:a,setChecked:x,control:y,setControl:b,name:c,form:l,value:p,hasConsumerStoppedPropagationRef:S,required:d,defaultChecked:!E(i)&&i,isFormControl:N,bubbleInput:w,setBubbleInput:j};return(0,f.jsx)(g,{scope:t,...C,children:"function"==typeof h?h(C):o})}var y="CheckboxTrigger",b=(0,n.forwardRef)(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...i},s)=>{let{control:l,value:c,disabled:u,checked:m,required:p,setControl:h,setChecked:g,hasConsumerStoppedPropagationRef:x,isFormControl:b,bubbleInput:w}=v(y,e),j=(0,o.useComposedRefs)(s,h),S=(0,n.useRef)(m);return(0,n.useEffect)(()=>{let e=l?.form;if(e){let t=()=>g(S.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[l,g]),(0,f.jsx)(d.Primitive.button,{type:"button",role:"checkbox","aria-checked":E(m)?"mixed":m,"aria-required":p,"data-state":k(m),"data-disabled":u?"":void 0,disabled:u,value:c,...i,ref:j,onKeyDown:(0,a.composeEventHandlers)(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,a.composeEventHandlers)(r,e=>{g(e=>!!E(e)||!e),w&&b&&(x.current=e.isPropagationStopped(),x.current||e.stopPropagation())})})});b.displayName=y;var w=(0,n.forwardRef)((e,t)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:l,onCheckedChange:c,form:u,...d}=e;return(0,f.jsx)(x,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:c,name:n,form:u,value:l,internal_do_not_use_render:({isFormControl:e})=>(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(b,{...d,ref:t,__scopeCheckbox:r}),e&&(0,f.jsx)(C,{__scopeCheckbox:r})]})})});w.displayName=m;var j="CheckboxIndicator",S=(0,n.forwardRef)((e,t)=>{let{__scopeCheckbox:r,forceMount:n,...o}=e,i=v(j,r);return(0,f.jsx)(u.Presence,{present:n||E(i.checked)||!0===i.checked,children:(0,f.jsx)(d.Primitive.span,{"data-state":k(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});S.displayName=j;var N="CheckboxBubbleInput",C=(0,n.forwardRef)(({__scopeCheckbox:e,...t},r)=>{let{control:i,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:u,required:m,disabled:p,name:h,value:g,form:x,bubbleInput:y,setBubbleInput:b}=v(N,e),w=(0,o.useComposedRefs)(r,b),j=(0,l.usePrevious)(s),S=(0,c.useSize)(i);(0,n.useEffect)(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=!a.current;if(j!==s&&e){let r=new Event("click",{bubbles:t});y.indeterminate=E(s),e.call(y,!E(s)&&s),y.dispatchEvent(r)}},[y,j,s,a]);let C=(0,n.useRef)(!E(s)&&s);return(0,f.jsx)(d.Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:m,disabled:p,name:h,value:g,form:x,...t,tabIndex:-1,ref:w,style:{...t.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function E(e){return"indeterminate"===e}function k(e){return E(e)?"indeterminate":e?"checked":"unchecked"}C.displayName=N},46456:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({Check:()=>n.default});var n=e.i(64412)},42736:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({Checkbox:()=>t});var n=e.i(20393),o=e.i(19886),i=e.i(45155),a=e.i(46456),s=e.i(39037);let t=(0,o.forwardRef)(({className:e,...t},r)=>(0,n.jsx)(i.Root,{ref:r,className:(0,s.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-gray-300 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-900 data-[state=checked]:text-white dark:border-gray-800 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300 dark:data-[state=checked]:bg-gray-50 dark:data-[state=checked]:text-gray-900",e),...t,children:(0,n.jsx)(i.Indicator,{className:(0,s.cn)("flex items-center justify-center text-current"),children:(0,n.jsx)(a.Check,{className:"h-4 w-4"})})}));t.displayName=i.Root.displayName}},95113:e=>{"use strict";var{g:t,__dirname:r}=e;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function a(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function s(e,t){if(null==e)return{};var r,n,o=a(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function l(e,t){return c(e)||u(e,t)||d(e,t)||m()}function c(e){if(Array.isArray(e))return e}function u(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function m(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.s({arrayLikeToArray:()=>f,arrayWithHoles:()=>c,defineProperty:()=>n,iterableToArrayLimit:()=>u,nonIterableRest:()=>m,objectSpread2:()=>i,objectWithoutProperties:()=>s,objectWithoutPropertiesLoose:()=>a,slicedToArray:()=>l,unsupportedIterableToArray:()=>d})},85767:e=>{"use strict";var{g:t,__dirname:r}=e;{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e){return function t(){for(var r=this,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(o,n))}}}function a(e){return({}).toString.call(e).includes("Object")}function s(e){return"function"==typeof e}e.s({default:()=>t});var l=i(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),c={changes:function(e,t){return a(t)||l("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&l("changeField"),t},selector:function(e){s(e)||l("selectorType")},handler:function(e){s(e)||a(e)||l("handlerType"),a(e)&&Object.values(e).some(function(e){return!s(e)})&&l("handlersType")},initial:function(e){e||l("initialIsRequired"),a(e)||l("initialType"),Object.keys(e).length||l("initialContent")}};function u(e,t){return s(t)?t(e.current):t}function d(e,t){return e.current=o(o({},e.current),t),t}function f(e,t,r){return s(t)?t(e.current):Object.keys(r).forEach(function(r){var n;return null==(n=t[r])?void 0:n.call(t,e.current[r])}),r}let t={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c.initial(e),c.handler(t);var r={current:e},n=i(f)(r,t),o=i(d)(r),a=i(c.changes)(e),s=i(u)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return c.selector(e),e(r.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(n,o,a,s)(e)}]}}}},53120:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}}}},72460:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(e){return function t(){for(var r=this,n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(o,n))}}}}},63839:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(e){return({}).toString.call(e).includes("Object")}}},93408:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t,errorHandler:()=>a,errorMessages:()=>i});var n=e.i(72460),o=e.i(63839),i={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},a=(0,n.default)(function(e,t){throw Error(e[t]||e.default)})(i);let t={config:function(e){return(e||a("configIsRequired"),(0,o.default)(e)||a("configType"),e.urls)?(console.warn(i.deprecation),{paths:{vs:e.urls.monacoBase}}):e}}}},28295:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});let t=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}}},13614:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});var n=e.i(95113);let t=function e(t,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&t[n]&&Object.assign(r[n],e(t[n],r[n]))}),(0,n.objectSpread2)((0,n.objectSpread2)({},t),r)}}},28042:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({CANCELATION_MESSAGE:()=>n,default:()=>t});var n={type:"cancelation",msg:"operation is manually canceled"};let t=function(e){var t=!1,r=new Promise(function(r,o){e.then(function(e){return t?o(n):r(e)}),e.catch(o)});return r.cancel=function(){return t=!0},r}}},72189:e=>{"use strict";var{g:t,__dirname:r}=e;{e.s({default:()=>t});var n=e.i(95113),o=e.i(85767),i=e.i(53120),a=e.i(93408),s=e.i(28295),l=e.i(13614),c=e.i(28042),u=o.default.create({config:i.default,isInitialized:!1,resolve:null,reject:null,monaco:null}),d=(0,n.slicedToArray)(u,2),f=d[0],m=d[1];function p(e){return document.body.appendChild(e)}function h(e){var t,r,n=f(function(e){return{config:e.config,reject:e.reject}}),o=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return o.onload=function(){return e()},o.onerror=n.reject,o}function g(){var e=f(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){v(t),e.resolve(t)},function(t){e.reject(t)})}function v(e){f().monaco||m({monaco:e})}var x=new Promise(function(e,t){return m({resolve:e,reject:t})});let t={config:function(e){var t=a.default.config(e),r=t.monaco,o=(0,n.objectWithoutProperties)(t,["monaco"]);m(function(e){return{config:(0,l.default)(e.config,o),monaco:r}})},init:function(){var e=f(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(m({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),(0,c.default)(x);if(window.monaco&&window.monaco.editor)return v(window.monaco),e.resolve(window.monaco),(0,c.default)(x);(0,s.default)(p,h)(g)}return(0,c.default)(x)},__getMonacoInstance:function(){return f(function(e){return e.monaco})}}}},25799:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(72189)},30079:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(72189),e.i(25799)},14991:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({DiffEditor:()=>p,Editor:()=>x,default:()=>y,useMonaco:()=>h}),e.i(30079);var n=e.i(19886),o=e.i(72189),i={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},a={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},s=function({children:e}){return n.default.createElement("div",{style:a.container},e)},l=(0,n.memo)(function({width:e,height:t,isEditorReady:r,loading:o,_ref:a,className:l,wrapperProps:c}){return n.default.createElement("section",{style:{...i.wrapper,width:e,height:t},...c},!r&&n.default.createElement(s,null,o),n.default.createElement("div",{ref:a,style:{...i.fullWidth,...!r&&i.hide},className:l}))}),c=function(e){(0,n.useEffect)(e,[])},u=function(e,t,r=!0){let o=(0,n.useRef)(!0);(0,n.useEffect)(o.current||!r?()=>{o.current=!1}:e,t)};function d(){}function f(e,t,r,n){var o,i,a,s,l,c;return o=e,i=n,o.editor.getModel(m(o,i))||(a=e,s=t,l=r,c=n,a.editor.createModel(s,l,c?m(a,c):void 0))}function m(e,t){return e.Uri.parse(t)}var p=(0,n.memo)(function({original:e,modified:t,language:r,originalLanguage:i,modifiedLanguage:a,originalModelPath:s,modifiedModelPath:m,keepCurrentOriginalModel:p=!1,keepCurrentModifiedModel:h=!1,theme:g="light",loading:v="Loading...",options:x={},height:y="100%",width:b="100%",className:w,wrapperProps:j={},beforeMount:S=d,onMount:N=d}){let[C,E]=(0,n.useState)(!1),[k,R]=(0,n.useState)(!0),T=(0,n.useRef)(null),P=(0,n.useRef)(null),O=(0,n.useRef)(null),_=(0,n.useRef)(N),M=(0,n.useRef)(S),A=(0,n.useRef)(!1);c(()=>{let e=o.default.init();return e.then(e=>(P.current=e)&&R(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return T.current?(t=T.current?.getModel(),void(p||t?.original?.dispose(),h||t?.modified?.dispose(),T.current?.dispose())):e.cancel()}}),u(()=>{if(T.current&&P.current){let t=T.current.getOriginalEditor(),n=f(P.current,e||"",i||r||"text",s||"");n!==t.getModel()&&t.setModel(n)}},[s],C),u(()=>{if(T.current&&P.current){let e=T.current.getModifiedEditor(),n=f(P.current,t||"",a||r||"text",m||"");n!==e.getModel()&&e.setModel(n)}},[m],C),u(()=>{let e=T.current.getModifiedEditor();e.getOption(P.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],C),u(()=>{T.current?.getModel()?.original.setValue(e||"")},[e],C),u(()=>{let{original:e,modified:t}=T.current.getModel();P.current.editor.setModelLanguage(e,i||r||"text"),P.current.editor.setModelLanguage(t,a||r||"text")},[r,i,a],C),u(()=>{P.current?.editor.setTheme(g)},[g],C),u(()=>{T.current?.updateOptions(x)},[x],C);let I=(0,n.useCallback)(()=>{if(!P.current)return;M.current(P.current);let n=f(P.current,e||"",i||r||"text",s||""),o=f(P.current,t||"",a||r||"text",m||"");T.current?.setModel({original:n,modified:o})},[r,t,a,e,i,s,m]),D=(0,n.useCallback)(()=>{!A.current&&O.current&&(T.current=P.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...x}),I(),P.current?.editor.setTheme(g),E(!0),A.current=!0)},[x,g,I]);return(0,n.useEffect)(()=>{C&&_.current(T.current,P.current)},[C]),(0,n.useEffect)(()=>{k||C||D()},[k,C,D]),n.default.createElement(l,{width:b,height:y,isEditorReady:C,loading:v,_ref:O,className:w,wrapperProps:j})}),h=function(){let[e,t]=(0,n.useState)(o.default.__getMonacoInstance());return c(()=>{let r;return e||(r=o.default.init()).then(e=>{t(e)}),()=>r?.cancel()}),e},g=function(e){let t=(0,n.useRef)();return(0,n.useEffect)(()=>{t.current=e},[e]),t.current},v=new Map,x=(0,n.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:i,language:a,path:s,theme:m="light",line:p,loading:h="Loading...",options:x={},overrideServices:y={},saveViewState:b=!0,keepCurrentModel:w=!1,width:j="100%",height:S="100%",className:N,wrapperProps:C={},beforeMount:E=d,onMount:k=d,onChange:R,onValidate:T=d}){let[P,O]=(0,n.useState)(!1),[_,M]=(0,n.useState)(!0),A=(0,n.useRef)(null),I=(0,n.useRef)(null),D=(0,n.useRef)(null),L=(0,n.useRef)(k),F=(0,n.useRef)(E),z=(0,n.useRef)(),H=(0,n.useRef)(i),B=g(s),$=(0,n.useRef)(!1),U=(0,n.useRef)(!1);c(()=>{let e=o.default.init();return e.then(e=>(A.current=e)&&M(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>I.current?void(z.current?.dispose(),w?b&&v.set(s,I.current.saveViewState()):I.current.getModel()?.dispose(),I.current.dispose()):e.cancel()}),u(()=>{let n=f(A.current,e||i||"",t||a||"",s||r||"");n!==I.current?.getModel()&&(b&&v.set(B,I.current?.saveViewState()),I.current?.setModel(n),b&&I.current?.restoreViewState(v.get(s)))},[s],P),u(()=>{I.current?.updateOptions(x)},[x],P),u(()=>{I.current&&void 0!==i&&(I.current.getOption(A.current.editor.EditorOption.readOnly)?I.current.setValue(i):i!==I.current.getValue()&&(U.current=!0,I.current.executeEdits("",[{range:I.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),I.current.pushUndoStop(),U.current=!1))},[i],P),u(()=>{let e=I.current?.getModel();e&&a&&A.current?.editor.setModelLanguage(e,a)},[a],P),u(()=>{void 0!==p&&I.current?.revealLine(p)},[p],P),u(()=>{A.current?.editor.setTheme(m)},[m],P);let W=(0,n.useCallback)(()=>{if(!(!D.current||!A.current)&&!$.current){F.current(A.current);let n=s||r,o=f(A.current,i||e||"",t||a||"",n||"");I.current=A.current?.editor.create(D.current,{model:o,automaticLayout:!0,...x},y),b&&I.current.restoreViewState(v.get(n)),A.current.editor.setTheme(m),void 0!==p&&I.current.revealLine(p),O(!0),$.current=!0}},[e,t,r,i,a,s,x,y,b,m,p]);return(0,n.useEffect)(()=>{P&&L.current(I.current,A.current)},[P]),(0,n.useEffect)(()=>{_||P||W()},[_,P,W]),H.current=i,(0,n.useEffect)(()=>{P&&R&&(z.current?.dispose(),z.current=I.current?.onDidChangeModelContent(e=>{U.current||R(I.current.getValue(),e)}))},[P,R]),(0,n.useEffect)(()=>{if(P){let e=A.current.editor.onDidChangeMarkers(e=>{let t=I.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=A.current.editor.getModelMarkers({resource:t});T?.(e)}});return()=>{e?.dispose()}}return()=>{}},[P,T]),n.default.createElement(l,{width:j,height:S,isEditorReady:P,loading:h,_ref:D,className:N,wrapperProps:C})}),y=x},94087:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({}),e.i(30079),e.i(19886),e.i(14991)},20561:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>l});var n=e.i(20393),o=e.i(19886),i=e.i(9385),a=e.i(70599),s=e.i(86871);function l({className:e,currentProjectName:t,currentEnvName:r}){let[l,c]=(0,o.useState)([]),[u,d]=(0,o.useState)(!0),[f,m]=(0,o.useState)(null),[p,h]=(0,o.useState)(new Set),[g,v]=(0,o.useState)(""),[x,y]=(0,o.useState)(!1),[b,w]=(0,o.useState)(""),[j,S]=(0,o.useState)(!1),[N,C]=(0,o.useState)(null),E=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(l.length>0){let e=l.find(e=>e.projectName===t&&e.envName===r);if(e&&e.subApps.length>0){let t=new Set;e.subApps.forEach(e=>{l.forEach(r=>{r.envName===e&&t.add(O(r))})}),h(t)}}},[l,t,r]);let k=async()=>{d(!0),m(null);try{let e=await fetch("/api/all-projects-envs"),t=await e.json();t.success?c(t.data):m(t.error||"获取项目环境信息失败")}catch(e){console.error("获取项目环境信息失败:",e),m("获取项目环境信息失败: 网络错误")}finally{d(!1)}};(0,o.useEffect)(()=>(k(),R(),()=>{T()}),[r]);let R=()=>{E.current&&T();let e=`microapp-table-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,t=`/api/microapp-proxy-change-stream?env=${encodeURIComponent(r)}&clientId=${encodeURIComponent(e)}`;console.log(`[SSE] 建立连接到: ${t}`),C(null);try{let e=new EventSource(t);E.current=e,e.onopen=()=>{console.log(`[SSE] 连接已建立,环境: ${r}`),S(!0),C(null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);P(t)}catch(e){console.error("[SSE] 解析消息失败:",e)}},e.onerror=()=>{console.error(`[SSE] 连接错误,环境: ${r}`),S(!1),C("实时推送连接断开"),setTimeout(()=>{E.current&&E.current.readyState!==EventSource.CLOSED||(console.log("[SSE] 尝试重新连接..."),R())},3e3)}}catch(e){console.error("[SSE] 建立连接失败:",e),C("无法建立实时推送连接")}},T=()=>{E.current&&(console.log("[SSE] 关闭连接"),E.current.close(),E.current=null,S(!1))},P=e=>{switch(console.log("[SSE] 收到消息:",e),e.type){case"connection-established":console.log(`[SSE] 连接确认: ${e.message}`),S(!0),C(null);break;case"microapp-proxy-config-change":if(console.log(`[SSE] 配置变化通知: 环境=${e.envName}`),console.log(`[SSE] 变化详情:`,e.changes),e.changes){let{added:t,removed:r}=e.changes,n="";t.length>0&&(n+=`新增: ${t.join(", ")}`),r.length>0&&(n&&(n+="; "),n+=`移除: ${r.join(", ")}`),w(`配置已更新 (${n})`)}else w("配置已更新");k(),setTimeout(()=>w(""),3e3);break;case"heartbeat":S(!0),C(null);break;default:console.log("[SSE] 未知消息类型:",e.type)}},O=e=>`${e.projectName}-${e.envName}`,_=g.trim()?l.filter(e=>e.projectName.toLowerCase().includes(g.toLowerCase())||e.envName.toLowerCase().includes(g.toLowerCase())||e.host.toLowerCase().includes(g.toLowerCase())):l,M=(e,t)=>{let r=new Set(p);t?r.add(e):r.delete(e),h(r)},A=e=>{e?h(new Set(_.map(e=>O(e)))):h(new Set)},I=async()=>{y(!0),w("");try{let e=Array.from(p).map(e=>{let t=l.find(t=>O(t)===e);return t?t.envName:""}).filter(e=>""!==e),n=[...new Set(e)],o=await fetch("/api/microapp-proxy-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:t,envName:r,selectedItems:n})}),i=await o.json();i.success?(w(i.message||"保存成功"),await k()):w(`保存失败: ${i.error}`)}catch(e){console.error("保存MicroApp代理配置失败:",e),w("保存失败: 网络错误")}finally{y(!1),setTimeout(()=>{w("")},5e3)}},D=p.size,L=_.length>0&&_.every(e=>p.has(O(e))),F=_.some(e=>p.has(O(e)));return u?(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsx)("h4",{className:"text-md font-medium mb-4",children:"MicroApp代理配置"}),(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{className:"text-gray-500",children:"加载中..."})})]}):f?(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsx)("h4",{className:"text-md font-medium mb-4",children:"MicroApp代理配置"}),(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-red-500",children:f}),(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:k,className:"mt-2",children:"重试"})]})]}):(0,n.jsxs)("div",{className:`p-6 bg-gray-50 rounded-lg ${e}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-md font-medium",children:"MicroApp代理配置"}),(0,n.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:["为 ",t," - ",r," 环境配置微应用代理"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("div",{className:`w-2 h-2 rounded-full ${j?"bg-green-500":"bg-red-500"}`,title:j?"实时推送已连接":"实时推送断开"}),(0,n.jsx)("span",{className:"text-xs text-gray-500",children:j?"实时":"离线"})]}),(b||N)&&(0,n.jsx)("span",{className:`text-sm max-w-xs ${b&&b.includes("失败")||N?"text-red-600":b&&b.includes("但有")?"text-yellow-600":"text-green-600"}`,title:b||N||"",children:b||N}),(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:k,disabled:x,children:"刷新"}),(0,n.jsx)(s.Button,{variant:"default",size:"sm",onClick:I,disabled:x,children:x?"保存中...":"保存配置"})]})]}),(0,n.jsxs)("div",{className:"space-y-3 mb-4",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,n.jsx)(a.Input,{placeholder:"搜索项目名称、环境名称或Host...",value:g,onChange:e=>v(e.target.value),className:"pr-8"}),g&&(0,n.jsx)(s.Button,{variant:"ghost",size:"sm",onClick:()=>{v("")},className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-gray-100",children:"×"})]})}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)("span",{children:["显示 ",_.length," 个环境配置",g&&` (搜索: "${g}")`]}),D>0&&(0,n.jsxs)("span",{className:"text-blue-600 font-medium",children:["已选择 ",D," 项"]})]}),D>0&&(0,n.jsx)(s.Button,{variant:"outline",size:"sm",onClick:()=>{h(new Set)},children:"清空选择"})]})]}),_.length>0?(0,n.jsx)("div",{className:"border rounded-md",children:(0,n.jsxs)(i.Table,{children:[(0,n.jsx)(i.TableHeader,{children:(0,n.jsxs)(i.TableRow,{children:[(0,n.jsx)(i.TableHead,{className:"w-12",children:(0,n.jsx)("input",{type:"checkbox",checked:L,onChange:e=>A(e.target.checked),ref:e=>{e&&(e.indeterminate=F&&!L)},className:"rounded border-gray-300"})}),(0,n.jsx)(i.TableHead,{children:"环境名称"}),(0,n.jsx)(i.TableHead,{children:"项目名称"}),(0,n.jsx)(i.TableHead,{children:"Host地址"}),(0,n.jsx)(i.TableHead,{children:"当前代理"})]})}),(0,n.jsx)(i.TableBody,{children:_.map(e=>{let t=O(e),r=p.has(t);return(0,n.jsxs)(i.TableRow,{children:[(0,n.jsx)(i.TableCell,{children:(0,n.jsx)("input",{type:"checkbox",checked:r,onChange:e=>M(t,e.target.checked),className:"rounded border-gray-300"})}),(0,n.jsx)(i.TableCell,{children:(0,n.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800",children:e.envName})}),(0,n.jsx)(i.TableCell,{className:"font-medium",children:e.projectName}),(0,n.jsx)(i.TableCell,{className:"font-mono text-sm",children:e.host}),(0,n.jsxs)(i.TableCell,{className:"text-sm text-gray-600",children:[e.currentProxy,e.proxyEnv[e.currentProxy]&&(0,n.jsx)("div",{className:"text-xs text-gray-500",children:e.proxyEnv[e.currentProxy]})]})]},t)})})]})}):(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{className:"text-gray-500",children:g?"没有找到匹配的环境配置":"暂无环境配置"})}),D>0&&(0,n.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm text-blue-700",children:["已选择 ",D," 个环境配置将作为微应用代理"]}),(0,n.jsx)("span",{className:"text-xs text-blue-600",children:"点击上方“保存配置”按钮保存设置"})]})})]})}},94334:function(e){var{g:t,__dirname:r,m:n,e:o}=e},51904:function(e){var{g:t,__dirname:r,m:n,e:o}=e,i=e.i(47412);e.r(94334);var a=e.r(19886),s=a&&"object"==typeof a&&"default"in a?a:{default:a},l=void 0!==i.default&&i.default.env&&!0,c=function(e){return"[object String]"===Object.prototype.toString.call(e)},u=function(){function e(e){var t=void 0===e?{}:e,r=t.name,n=void 0===r?"stylesheet":r,o=t.optimizeForSpeed,i=void 0===o?l:o;d(c(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",d("boolean"==typeof i,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=i,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var a="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=a?a.getAttribute("content"):null}var t,r=e.prototype;return r.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},r.isOptimizeForSpeed=function(){return this._optimizeForSpeed},r.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(l||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,r){return"number"==typeof r?e._serverSheet.cssRules[r]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),r},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},r.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},r.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},r.insertRule=function(e,t){if(d(c(e),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var r=this.getSheet();"number"!=typeof t&&(t=r.cssRules.length);try{r.insertRule(e,t)}catch(t){return l||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},r.replaceRule=function(e,t){if(this._optimizeForSpeed||"undefined"==typeof window){var r="undefined"!=typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!r.cssRules[e])return e;r.deleteRule(e);try{r.insertRule(t,e)}catch(n){l||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),r.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];d(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},r.deleteRule=function(e){if("undefined"==typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},r.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},r.cssRules=function(){var e=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,r){return r?t=t.concat(Array.prototype.map.call(e.getSheetForTag(r).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},r.makeStyleTag=function(e,t,r){t&&d(c(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var o=document.head||document.getElementsByTagName("head")[0];return r?o.insertBefore(n,r):o.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var f=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},m={};function p(e,t){if(!t)return"jsx-"+e;var r=String(t),n=e+r;return m[n]||(m[n]="jsx-"+f(e+"-"+r)),m[n]}function h(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var r=e+t;return m[r]||(m[r]=t.replace(/__jsx-style-dynamic-selector/g,e)),m[r]}var g=function(){function e(e){var t=void 0===e?{}:e,r=t.styleSheet,n=void 0===r?null:r,o=t.optimizeForSpeed,i=void 0!==o&&o;this._sheet=n||new u({name:"styled-jsx",optimizeForSpeed:i}),this._sheet.inject(),n&&"boolean"==typeof i&&(this._sheet.setOptimizeForSpeed(i),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var r=this.getIdAndRules(e),n=r.styleId,o=r.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var i=o.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=i,this._instancesCounts[n]=1},t.remove=function(e){var t=this,r=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(r in this._instancesCounts,"styleId: `"+r+"` not found"),this._instancesCounts[r]-=1,this._instancesCounts[r]<1){var n=this._fromServer&&this._fromServer[r];n?(n.parentNode.removeChild(n),delete this._fromServer[r]):(this._indices[r].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[r]),delete this._instancesCounts[r]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],r=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return r[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,r;return t=this.cssRules(),void 0===(r=e)&&(r={}),t.map(function(e){var t=e[0],n=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:r.nonce?r.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,r=e.dynamic,n=e.id;if(r){var o=p(n,r);return{styleId:o,rules:Array.isArray(t)?t.map(function(e){return h(o,e)}):[h(o,t)]}}return{styleId:p(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),v=a.createContext(null);function x(){return new g}function y(){return a.useContext(v)}v.displayName="StyleSheetContext";var b=s.default.useInsertionEffect||s.default.useLayoutEffect,w="undefined"!=typeof window?x():void 0;function j(e){var t=w||y();return t&&("undefined"==typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}j.dynamic=function(e){return e.map(function(e){return p(e[0],e[1])}).join(" ")},o.StyleRegistry=function(e){var t=e.registry,r=e.children,n=a.useContext(v),o=a.useState(function(){return n||t||x()})[0];return s.default.createElement(v.Provider,{value:o},r)},o.createStyleRegistry=x,o.style=j,o.useStyleRegistry=y},56591:function(e){var{g:t,__dirname:r,m:n,e:o}=e;n.exports=e.r(51904).style},23619:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>a});var n=e.i(20393),o=e.i(56591),i=e.i(19886);function a({logs:e}){let t=(0,i.useRef)(null),r=(0,i.useRef)(!0),a=e=>e.replace(/\x1b\[[0-9;]*m/g,"").replace(/\x1b\[[0-9]*[A-Z]/g,"").replace(/\x1b\[K/g,"").replace(/\x1b\[2K/g,"").replace(/\x1b\[G/g,"").replace(/\x1b\[\d+A/g,"").replace(/\x1b\[\d+B/g,"").replace(/\x1b\[\d+C/g,"").replace(/\x1b\[\d+D/g,"").replace(/\[2K\[1A\[2K\[G/g,"").replace(/\[\d+[A-Z]/g,"").replace(/\[STDOUT\]/g,"[OUT]").replace(/\[STDERR\]/g,"[ERR]"),s=()=>{if(!t.current)return!0;let{scrollTop:e,scrollHeight:r,clientHeight:n}=t.current;return r-e-n<100},l=()=>{t.current&&r.current&&(t.current.scrollTop=t.current.scrollHeight)};return(0,i.useEffect)(()=>{setTimeout(l,10)},[e]),(0,n.jsxs)("div",{ref:t,onScroll:()=>{r.current=s()},style:{scrollBehavior:"smooth",maxHeight:"100%"},className:"jsx-b464fb0f479e34f5 h-full w-full overflow-y-auto overflow-x-hidden p-4 custom-scrollbar",children:[(0,n.jsx)(o.default,{id:"b464fb0f479e34f5",children:".custom-scrollbar.jsx-b464fb0f479e34f5{scrollbar-width:thin;scrollbar-color:#fff3 #0000001a}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar{width:10px;height:10px}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar-track{background:#0000001a;border-radius:5px}.custom-scrollbar.jsx-b464fb0f479e34f5::-webkit-scrollbar-thumb{background:#ffffff4d;border-radius:5px}.custom-scrollbar.jsx-b464fb0f479e34f5.jsx-b464fb0f479e34f5::-webkit-scrollbar-thumb:hover{background:#fff6}"}),(0,n.jsx)("div",{className:"jsx-b464fb0f479e34f5 space-y-0.5",children:e.length>0?e.map((e,t)=>{let r=a(e);if(!r.trim())return null;let o=e.includes("[STDERR]"),i=e.includes("[SYSTEM]"),s=r.match(/^\[([\d-T:.Z]+)\]/)?.[1],l=r.replace(/^\[[\d-T:.Z]+\]\s*/,"");return(0,n.jsxs)("div",{className:`jsx-b464fb0f479e34f5 font-mono text-xs leading-5 ${o?"text-red-400":i?"text-yellow-400":"text-gray-100"}`,children:[s&&(0,n.jsxs)("span",{className:"jsx-b464fb0f479e34f5 text-gray-500 mr-2",children:["[",new Date(s).toLocaleTimeString("zh-CN"),"]"]}),(0,n.jsx)("span",{className:"jsx-b464fb0f479e34f5 whitespace-pre-wrap break-all",children:l})]},t)}):(0,n.jsx)("div",{className:"jsx-b464fb0f479e34f5 text-center text-gray-500 mt-8",children:"等待日志输出..."})})]})}},40941:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>a});var n=e.i(20393),o=e.i(19886),i=e.i(86871);function a({projectName:e,className:t="",compact:r=!1}){let[a,s]=(0,o.useState)(null),[l,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(""),p=(0,o.useCallback)(async()=>{if(e){c(!0),d(null);try{let t=await fetch(`/api/current-branch?project=${encodeURIComponent(e)}`),r=await t.json();r.success?(s(r.data),m(new Date().toLocaleTimeString("zh-CN",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}))):d(r.error||"获取分支信息失败")}catch(e){d("网络请求失败"),console.error("获取分支信息失败:",e)}finally{c(!1)}}},[e]);(0,o.useEffect)(()=>{p()},[p]),(0,o.useEffect)(()=>{if(!e)return;let t=setInterval(()=>{p()},r?15e3:3e4);return()=>clearInterval(t)},[e,p,r]);let h=e=>0===e?"text-gray-500":"text-orange-600",g=()=>{if(!a)return null;let{ahead:e,behind:t}=a.status;return e>0&&t>0?(0,n.jsx)("span",{className:"text-yellow-500 text-xs",children:"↕"}):e>0?(0,n.jsx)("span",{className:"text-green-500 text-xs",children:"↑"}):t>0?(0,n.jsx)("span",{className:"text-red-500 text-xs",children:"↓"}):(0,n.jsx)("span",{className:"text-gray-400 text-xs",children:"✓"})};return l&&!a?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-gray-50 rounded-md ${t}`,children:[(0,n.jsx)("div",{className:"animate-spin w-3 h-3 border-2 border-blue-500 border-t-transparent rounded-full"}),(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"加载中..."})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsx)("div",{className:"animate-spin w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full"})]}),(0,n.jsx)("div",{className:"text-sm text-gray-500",children:"正在加载分支信息..."})]}):u?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-red-50 rounded-md ${t}`,children:[(0,n.jsx)("span",{className:"text-xs text-red-500",children:"分支信息错误"}),(0,n.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:p,disabled:l,className:"h-5 w-5 p-0 text-red-500 hover:bg-red-100",children:"↻"})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsx)(i.Button,{variant:"outline",size:"sm",onClick:p,disabled:l,className:"h-6 px-2 text-xs",children:l?"刷新中...":"重试"})]}),(0,n.jsx)("div",{className:"text-sm text-red-500 bg-red-50 p-2 rounded",children:u})]}):a?r?(0,n.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 bg-blue-50 border border-blue-200 rounded-md ${t}`,children:[(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-blue-600",children:[(0,n.jsx)("polyline",{points:"6,3 6,15"}),(0,n.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("path",{d:"m18,9a9,9 0 0,1-9,9"})]}),(0,n.jsx)("span",{className:"text-sm font-medium text-blue-800",children:a.currentBranch}),g(),(0,n.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:p,disabled:l,className:"h-5 w-5 p-0 text-blue-600 hover:bg-blue-100",title:"刷新分支信息",children:l?(0,n.jsx)("div",{className:"animate-spin w-3 h-3 border-2 border-blue-600 border-t-transparent rounded-full"}):"↻"})]}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,n.jsx)("span",{className:"text-xs text-gray-400",children:f}),(0,n.jsx)(i.Button,{variant:"outline",size:"sm",onClick:p,disabled:l,className:"h-6 px-2 text-xs",children:l?"刷新中...":"刷新"})]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"分支:"}),(0,n.jsx)("span",{className:"text-sm font-medium text-blue-600 bg-blue-50 px-2 py-1 rounded",children:a.currentBranch}),g()]})}),(0,n.jsxs)("div",{className:"bg-gray-50 p-3 rounded text-xs space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"提交:"}),(0,n.jsx)("code",{className:"bg-gray-200 px-1 rounded font-mono text-xs",children:a.lastCommit.hash})]}),(0,n.jsx)("div",{className:"text-gray-700 font-medium line-clamp-2",children:a.lastCommit.message}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-gray-500",children:[(0,n.jsx)("span",{children:a.lastCommit.author}),(0,n.jsx)("span",{children:a.lastCommit.date})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"领先:"}),(0,n.jsx)("span",{className:h(a.status.ahead),children:a.status.ahead})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"落后:"}),(0,n.jsx)("span",{className:h(a.status.behind),children:a.status.behind})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"已修改:"}),(0,n.jsx)("span",{className:h(a.status.modified),children:a.status.modified})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"已暂存:"}),(0,n.jsx)("span",{className:h(a.status.staged),children:a.status.staged})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between col-span-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"未跟踪:"}),(0,n.jsx)("span",{className:h(a.status.untracked),children:a.status.untracked})]})]}),(a.status.ahead>0||a.status.behind>0)&&(0,n.jsxs)("div",{className:"text-xs p-2 rounded bg-yellow-50 border border-yellow-200",children:[a.status.ahead>0&&a.status.behind>0&&(0,n.jsxs)("span",{className:"text-yellow-700",children:["分支与远程不同步,有 ",a.status.ahead," 个本地提交,",a.status.behind," 个远程提交"]}),a.status.ahead>0&&0===a.status.behind&&(0,n.jsxs)("span",{className:"text-green-700",children:["本地领先远程 ",a.status.ahead," 个提交"]}),0===a.status.ahead&&a.status.behind>0&&(0,n.jsxs)("span",{className:"text-red-700",children:["本地落后远程 ",a.status.behind," 个提交"]})]})]})]}):r?(0,n.jsx)("div",{className:`flex items-center gap-2 px-3 py-1 bg-gray-50 rounded-md ${t}`,children:(0,n.jsx)("span",{className:"text-xs text-gray-500",children:"暂无分支信息"})}):(0,n.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border p-4 ${t}`,children:[(0,n.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:"Git 分支信息"})}),(0,n.jsx)("div",{className:"text-sm text-gray-500",children:"暂无分支信息"})]})}},66445:e=>{"use strict";var{g:t,__dirname:r}=e;e.s({default:()=>w});var n=e.i(20393),o=e.i(19886),i=e.i(42152),a=e.i(86871),s=e.i(72242),l=e.i(40989),c=e.i(70599),u=e.i(80226),d=e.i(46284),f=e.i(9385),m=e.i(19579),p=e.i(42736);e.i(94087);var h=e.i(14991),g=e.i(20561),v=e.i(23619),x=e.i(40941),y=function(e){return e.PENDING="pending",e.EXISTING="existing",e.CLONING="cloning",e.SUCCESS="success",e.FAILED="failed",e.RETRYING="retrying",e}(y||{});function b(){let e=(0,i.useSearchParams)(),t=(0,i.useRouter)(),r=e.get("project"),[y,b]=(0,o.useState)(null),[w,j]=(0,o.useState)(!0),[S,N]=(0,o.useState)(null),[C,E]=(0,o.useState)({}),[k,R]=(0,o.useState)({mockingIntercept:!1,mockOpen:!1}),[T,P]=(0,o.useState)(!1),[O,_]=(0,o.useState)(null),[M,A]=(0,o.useState)(!1),[I,D]=(0,o.useState)(1),[L]=(0,o.useState)(10),[F,z]=(0,o.useState)(""),[H,B]=(0,o.useState)(null),[$,U]=(0,o.useState)(!1),[W,V]=(0,o.useState)(!1),[K,G]=(0,o.useState)(!1),[q,Y]=(0,o.useState)(!0),[X,J]=(0,o.useState)(null),[Z,Q]=(0,o.useState)([]),[ee,et]=(0,o.useState)(!1),[er,en]=(0,o.useState)(!1),[eo,ei]=(0,o.useState)(!1),[ea,es]=(0,o.useState)({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0}),[el,ec]=(0,o.useState)(null),[eu,ed]=(0,o.useState)(!1),[ef,em]=(0,o.useState)({open:!1,apiName:"",method:"",siteName:""}),[ep,eh]=(0,o.useState)({open:!1,apiName:"",apiPath:""}),[eg,ev]=(0,o.useState)({open:!1,type:"success",message:""}),[ex,ey]=(0,o.useState)(!1),[eb,ew]=(0,o.useState)([]),[ej,eS]=(0,o.useState)(!1),[eN,eC]=(0,o.useState)(""),[eE,ek]=(0,o.useState)({}),[eR,eT]=(0,o.useState)(!1),[eP,eO]=(0,o.useState)(""),[e_,eM]=(0,o.useState)([]),eA=(0,o.useCallback)(async()=>{X&&await eD(X)},[X]),eI=(0,o.useCallback)(async e=>{$&&(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),await eA())},[$,eA]);(0,o.useEffect)(()=>{if($)return document.addEventListener("keydown",eI),()=>{document.removeEventListener("keydown",eI)}},[$,X,eI]);let eD=async e=>{try{await new Promise(e=>setTimeout(e,200));let t=e.getModel();if(t){await e.getAction("editor.action.formatDocument")?.run();let r=t.getValue();if(r&&!r.includes("\n")&&r.length>50){let n=r.replace(/\{\s*/g,"{\n ").replace(/\}\s*/g,"\n}").replace(/;\s*/g,";\n ").replace(/,\s*/g,",\n ").replace(/\n\s*\n/g,"\n").trim();n!==r&&(t.setValue(n),setTimeout(()=>{e.getAction("editor.action.formatDocument")?.run()},100))}}}catch(e){console.log("自动格式化失败:",e)}},eL=()=>{t.push("/initialization")},eF=async()=>{et(!0);try{let e=await fetch("/api/check-workspace"),t=await e.json();if(t.success&&t.projects){let e=t.projects.map(e=>({name:e.name,status:e.status,message:e.message}));Q(e)}else console.error("获取项目列表失败:",t.error),Q([])}catch(e){console.error("获取项目列表失败:",e),Q([])}finally{et(!1)}},ez=async()=>{if(r){P(!0);try{let e=await fetch("/api/open-project",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})}),t=await e.json();if(t.success&&t.cursorUrl){let e=document.createElement("a");e.href=t.cursorUrl,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}else console.error("打开项目失败:",t.error),ts("error",`打开项目失败: ${t.error}`)}catch(e){console.error("打开项目失败:",e),ts("error","打开项目失败: 网络错误")}finally{P(!1)}}},eH=async()=>{if(0===eb.length)return void ts("error","请至少选择一个项目");eS(!0);try{let e=await fetch("/api/workspace/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:eb})}),t=await e.json();t.success?(ts("success",t.message||"工作区已在 Cursor 中打开"),ey(!1),ew([])):ts("error",`创建工作区失败: ${t.error}`)}catch(e){console.error("创建工作区失败:",e),ts("error","创建工作区失败: 网络错误")}finally{eS(!1)}},eB=e=>{ew(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};(0,o.useEffect)(()=>{if(!r){N("项目名称缺失"),j(!1);return}(async()=>{try{let e=await fetch(`/api/project-config?project=${encodeURIComponent(r)}`),t=await e.json();if(t.success){b(t.data);let e={};Object.keys(t.data.envs).forEach(r=>{let n=t.data.envs[r],o="";o=n.proxyEnv[n.currentProxy]?n.proxyEnv[n.currentProxy]:n.currentProxy;let i="";i=n.proxyEnv[n.currentProxy]?n.currentProxy:"custom",e[r]={selectedProxy:o||"",selectedOption:i}}),E(e),R({mockingIntercept:t.data.mockingIntercept||!1,mockOpen:t.data.mockOpen||!1})}else N(t.error)}catch(e){N("获取项目配置失败"),console.error("获取项目配置失败:",e)}finally{j(!1)}})()},[r]);let e$=(0,o.useCallback)(async()=>{if(r){A(!0);try{let e=await fetch(`/api/mock-file?project=${encodeURIComponent(r)}`),t=await e.json();t.success?_(t.data):console.error("获取Mock数据失败:",t.error)}catch(e){console.error("获取Mock数据失败:",e)}finally{A(!1)}}},[r]);(0,o.useEffect)(()=>{if(y&&r){let e=Object.keys(y.envs),t=new URLSearchParams(window.location.search).get("tab"),r="";(r=F&&("mock"===F||e.includes(F))?F:t&&("mock"===t||e.includes(t))?t:e.length>0?e[0]:"mock")!==F&&(z(r),"mock"===r&&e$())}},[y,r,F,e$]),(0,o.useEffect)(()=>{eF()},[]);let eU=(0,o.useCallback)(async()=>{if(!r||!y)return;let e={};for(let t of Object.keys(y.envs))e[`${t}`]={loading:!0,running:!1};ek(e);let t=Object.keys(y.envs).map(async e=>{try{let t=await fetch(`/api/process/status?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`),n=await t.json();if(n.success&&n.data)return{envName:e,status:n.data}}catch(t){console.error(`获取环境 ${e} 状态失败:`,t)}return{envName:e,status:{running:!1}}}),n=await Promise.all(t),o={};n.forEach(({envName:e,status:t})=>{o[e]={running:t.running||!1,pid:t.pid,startTime:t.startTime,port:t.port,loading:!1}}),ek(o)},[r,y]),eW=async e=>{if(!r||!y)return;let t=y.envs[e];if(!t.startCommand)return void ts("error","该环境未配置启动命令");ek(t=>({...t,[e]:{...t[e],loading:!0}}));try{let n=await fetch("/api/process/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,envName:e,startCommand:t.startCommand})}),o=await n.json();if(o.success)ek(t=>({...t,[e]:{running:!0,pid:o.data.pid,startTime:o.data.startTime,port:o.data.port,loading:!1}}));else throw Error(o.error||"启动失败")}catch(t){console.error("启动进程失败:",t),ts("error",`启动失败: ${t instanceof Error?t.message:"未知错误"}`),ek(t=>({...t,[e]:{...t[e],loading:!1}}))}},eV=async e=>{if(r){ek(t=>({...t,[e]:{...t[e],loading:!0}}));try{let t=await fetch(`/api/process/start?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`,{method:"DELETE"}),n=await t.json();if(n.success)ek(t=>({...t,[e]:{running:!1,loading:!1}}));else throw Error(n.error||"停止失败")}catch(t){console.error("停止进程失败:",t),ts("error",`停止失败: ${t instanceof Error?t.message:"未知错误"}`),ek(t=>({...t,[e]:{...t[e],loading:!1}}))}}},[eK,eG]=(0,o.useState)(null),eq=e=>{if(!r)return;eK&&eK.close(),eM([]);let t=new EventSource(`/api/process/logs/stream?projectName=${encodeURIComponent(r)}&envName=${encodeURIComponent(e)}`);t.onmessage=e=>{try{let t=JSON.parse(e.data);"log"===t.type?eM(e=>{let r=[...e,t.content];return r.length>1e3?r.slice(-1e3):r}):"init"===t.type?eM([t.message]):"end"===t.type&&eM(e=>[...e,`[系统] ${t.message}`])}catch(e){console.error("解析日志数据失败:",e)}},t.onerror=e=>{console.error("日志流错误:",e),t.close(),eG(null)},eG(t)},eY=()=>{eK&&(eK.close(),eG(null))},eX=e=>{eO(e),eT(!0),eq(e)},eJ=()=>{eT(!1),eM([]),eO(""),eY()};(0,o.useEffect)(()=>{if(y&&r){eU();let e=setInterval(()=>{eU()},5e3);return()=>clearInterval(e)}},[y,r,eU]);let eZ=(e,t)=>{if(!y)return;let r=y.envs[e],n="";n="custom"===t?C[e]?.selectedOption==="custom"?C[e]?.selectedProxy||"":r.proxyEnv.custom||"":r.proxyEnv[t]||"",E(r=>({...r,[e]:{...r[e],selectedProxy:n,selectedOption:t,saveMessage:""}}))},eQ=(e,t)=>{E(r=>({...r,[e]:{...r[e],selectedProxy:t,saveMessage:""}}))},e0=async e=>{R(t=>({...t,mockingIntercept:e,saving:!0,saveMessage:""}));try{let t=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,projectConfig:{mockingIntercept:e,mockOpen:k.mockOpen}})}),n=await t.json();if(n.success)b(t=>t?{...t,mockingIntercept:e}:t),R(e=>({...e,saving:!1,saveMessage:"Mock拦截配置已保存"})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},2e3);else throw Error(n.error||"保存失败")}catch(t){console.error("保存Mock拦截配置失败:",t),R(r=>({...r,mockingIntercept:!e,saving:!1,saveMessage:`保存失败: ${t instanceof Error?t.message:"未知错误"}`})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},3e3)}},e1=async e=>{R(t=>({...t,mockOpen:e,saving:!0,saveMessage:""}));try{let t=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,projectConfig:{mockingIntercept:k.mockingIntercept,mockOpen:e}})}),n=await t.json();if(n.success)b(t=>t?{...t,mockOpen:e}:t),R(e=>({...e,saving:!1,saveMessage:"Mock开启配置已保存"})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},2e3);else throw Error(n.error||"保存失败")}catch(t){console.error("保存Mock开启配置失败:",t),R(r=>({...r,mockOpen:!e,saving:!1,saveMessage:`保存失败: ${t instanceof Error?t.message:"未知错误"}`})),setTimeout(()=>{R(e=>({...e,saveMessage:""}))},3e3)}},e2=async e=>{if(!y||!r)return;let t=C[e]?.selectedProxy?.trim();if(!t)return void E(t=>({...t,[e]:{...t[e],saveMessage:"请先选择或填写代理地址"}}));let n=C[e]?.selectedOption,o="custom"===n;E(t=>({...t,[e]:{...t[e],saving:!0,saveMessage:""}}));try{let i={projectName:r,envName:e,newProxy:o?"custom":n||""};o&&(i.customProxyUrl=t);let a=await fetch("/api/project-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),s=await a.json();s.success?(b(r=>{if(!r)return r;let n={...r.envs};return n[e]={...n[e],currentProxy:s.data.currentProxy},"custom"===s.data.currentProxy&&(n[e].proxyEnv={...n[e].proxyEnv,custom:t}),{...r,envs:n}}),E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:"保存成功"}}))):E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:`保存失败: ${s.error}`}}))}catch(t){console.error("保存配置失败:",t),E(t=>({...t,[e]:{...t[e],saving:!1,saveMessage:"保存失败: 网络错误"}}))}},e3=async()=>{if(window.confirm("确定要一键关闭所有Mock吗?"))try{let e=await fetch("/api/cleanup-mock",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})});(await e.json()).success&&await e$()}catch(e){console.error("清空Mock配置失败:",e)}},e4=async()=>{if(window.confirm("确定要一键开启所有Mock吗?"))try{let e=await fetch("/api/open-all-mock",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r})});(await e.json()).success&&await e$()}catch(e){console.error("清空Mock配置失败:",e)}},e8=async(e,t,n)=>{if(r)try{let o=await fetch("/api/mock-setting",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,apiName:e,method:t,currentSite:n})}),i=await o.json();i.success?_(r=>r?{...r,mockFiles:r.mockFiles.map(r=>r.apiName===e?{...r,methods:r.methods.map(e=>e.method===t?{...e,setting:{...e.setting,currentSite:n}}:e)}:r)}:r):(console.error("更新场景失败:",i.error),ts("error",`更新场景失败: ${i.error}`))}catch(e){console.error("更新场景失败:",e),ts("error","更新场景失败: 网络错误")}},e9=async(e,t,n)=>{if(r){V(!0),Y(!0);try{let o=await fetch(`/api/mock-file-content?project=${encodeURIComponent(r)}&apiName=${encodeURIComponent(e)}&method=${encodeURIComponent(t)}&siteName=${encodeURIComponent(n)}`),i=await o.json();i.success?(B({projectName:r,apiName:e,method:t,siteName:n,content:i.data.content}),U(!0)):(console.error("获取文件内容失败:",i.error),ts("error",`获取文件内容失败: ${i.error}`))}catch(e){console.error("获取文件内容失败:",e),ts("error","获取文件内容失败: 网络错误")}finally{V(!1)}}},e5=async()=>{if(H){G(!0);try{let e=await fetch("/api/mock-file-content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),t=await e.json();t.success?(U(!1),B(null)):(console.error("保存文件失败:",t.error),ts("error",`保存文件失败: ${t.error}`))}catch(e){console.error("保存文件失败:",e),ts("error","保存文件失败: 网络错误")}finally{G(!1)}}},e6=()=>{U(!1),B(null),Y(!0)},e7=(e,t)=>{"siteName"===e&&er||es(r=>({...r,[e]:t}))},te=(e,t)=>{let r=e.toUpperCase(),n=t.replace(/\//g,"_").replace(/^_/,"");switch(r){case"GET":return`const Mock = require('mockjs');
|
|
6
6
|
|
|
7
7
|
module.exports = Mock.mock({
|
|
8
8
|
"code": 200,
|
|
@@ -58,4 +58,4 @@ module.exports = Mock.mock({
|
|
|
58
58
|
}
|
|
59
59
|
});`}},tt=(e,t,r)=>{if(!O)return!1;let n=e.replace(/\//g,"_").replace(/^_/,""),o=O.mockFiles.find(e=>e.apiName===n);if(!o)return!1;let i=o.methods.find(e=>e.method.toLowerCase()===t.toLowerCase());return!!i&&!!i.files.find(e=>e.siteName===r)},tr=async()=>{if(!ea.apiPath.trim())return void ts("error","请输入接口地址");if(tt(ea.apiPath,ea.method,ea.siteName))return void ts("error",`接口 ${ea.apiPath} [${ea.method.toUpperCase()}] 的场景 "${ea.siteName}" 已存在,不能重复创建`);ed(!0);try{let e=ea.apiPath.replace(/\//g,"_").replace(/^_/,""),t=H?.content??te(ea.method,ea.apiPath),n=await fetch("/api/mock-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,apiName:e,method:ea.method.toLowerCase(),siteName:ea.siteName,content:t})}),o=await n.json();if(o.success)ea.mockOpen&&await ta(e,ea.method.toLowerCase(),ea.siteName,!0),es({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0}),en(!1),await e$(),ts("success","Mock文件创建成功");else throw Error(o.error||"创建失败")}catch(e){console.error("创建Mock文件失败:",e),ts("error",`创建Mock文件失败: ${e instanceof Error?e.message:"未知错误"}`)}finally{ed(!1)}},tn=(e,t,n)=>{console.log("新增场景点击:",{apiName:e,method:t,apiPath:n}),ec({apiName:e,method:t,apiPath:n});let o={apiPath:n,method:t.toUpperCase(),siteName:"",mockOpen:!0};console.log("设置表单数据:",o),es(o),ei(!0);let i=te(o.method,o.apiPath);B({projectName:r||"",apiName:e,method:t.toLowerCase(),siteName:"",content:i||""})},to=(e,t,r)=>{if(!O)return!1;let n=O.mockFiles.find(t=>t.apiName===e);if(!n)return!1;let o=n.methods.find(e=>e.method.toLowerCase()===t.toLowerCase());return!!o&&!!o.files.find(e=>e.siteName===r)},ti=async()=>{if(!el||!ea.siteName.trim())return void ts("error","请输入场景名称");if(to(el.apiName,el.method,ea.siteName))return void ts("error",`接口 ${el.apiPath} [${el.method.toUpperCase()}] 的场景 "${ea.siteName}" 已存在`);ed(!0);try{let e=H?.content??te(el.method,el.apiPath);console.log("defaultContent",e,H);let t=await fetch("/api/mock-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:r,apiName:el.apiName,method:el.method.toLowerCase(),siteName:ea.siteName,content:e})}),n=await t.json();if(n.success){if(ea.mockOpen&&await ta(el.apiName,el.method,ea.siteName,!0),es({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0}),y)try{let e=await fetch("/api/mock-setting",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:y.projectName,apiName:el.apiName,method:el.method,currentSite:ea.siteName})}),t=await e.json();t.success||console.warn("切换到新场景失败:",t.error)}catch(e){console.warn("切换到新场景失败:",e)}try{await ta(el.apiName,el.method,ea.siteName,!0)}catch(e){console.warn("自动开启新场景失败:",e)}ei(!1),ec(null),await e$(),ts("success","场景创建成功")}else throw Error(n.error||"创建失败")}catch(e){console.error("创建场景失败:",e),ts("error",`创建场景失败: ${e instanceof Error?e.message:"未知错误"}`)}finally{ed(!1)}},ta=async(e,t,r,n)=>{if(y)try{let o=await fetch("/api/mock-open-status",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:y.projectName,apiName:e,method:t,siteName:r,isOpen:n})}),i=await o.json();i.success?await e$():console.error("更新Mock开启状态失败:",i.error)}catch(e){console.error("更新Mock开启状态失败:",e)}},ts=(e,t)=>{ev({open:!0,type:e,message:t}),setTimeout(()=>{ev({open:!1,type:"success",message:""})},3e3)},tl=(e,t,r)=>{em({open:!0,apiName:e,method:t,siteName:r})},tc=async()=>{if(!y)return;let{apiName:e,method:t,siteName:r}=ef;try{let n=await fetch(`/api/mock-file?project=${encodeURIComponent(y.projectName)}&apiName=${encodeURIComponent(e)}&method=${encodeURIComponent(t)}&siteName=${encodeURIComponent(r)}`,{method:"DELETE"}),o=await n.json();if(o.success){let e=window.scrollY;await e$(),window.scrollTo(0,e),ts("success","场景删除成功")}else console.error("删除场景失败:",o.error),ts("error",`删除场景失败: ${o.error}`)}catch(e){console.error("删除场景失败:",e),ts("error","删除场景失败: 网络错误")}finally{em({open:!1,apiName:"",method:"",siteName:""})}},tu=(e,t)=>{eh({open:!0,apiName:e,apiPath:t})},td=async()=>{if(!y)return;let{apiName:e}=ep;try{let t=await fetch(`/api/delete-mock-api?project=${encodeURIComponent(y.projectName)}&apiName=${encodeURIComponent(e)}`,{method:"DELETE"}),r=await t.json();if(r.success){let e=window.scrollY;await e$(),window.scrollTo(0,e),ts("success","接口删除成功")}else console.error("删除接口失败:",r.error),ts("error",`删除接口失败: ${r.error}`)}catch(e){console.error("删除接口失败:",e),ts("error","删除接口失败: 网络错误")}finally{eh({open:!1,apiName:"",apiPath:""})}},tf=e=>{eC(e),D(1)};if(w)return(0,n.jsx)("main",{className:"container mx-auto p-4 sm:p-6 md:p-8",children:(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{children:"加载中..."})})});if(S||!y)return(0,n.jsxs)("main",{className:"container mx-auto p-4 sm:p-6 md:p-8",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold",children:"项目配置"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[r&&(0,n.jsx)(a.Button,{variant:"default",onClick:ez,disabled:T,children:T?"打开中...":"在 Cursor 中打开"}),(0,n.jsx)(a.Button,{variant:"outline",onClick:eL,children:"返回初始化页面"})]})]}),(0,n.jsx)("div",{className:"text-center text-red-500 py-8",children:(0,n.jsx)("p",{children:S||"未找到项目配置"})})]});let tm=Object.keys(y.envs);return(0,n.jsxs)("main",{className:"container mx-auto p-4 sm:p-6 md:p-8",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)("h1",{className:"text-2xl font-bold",children:[y.projectName," - 项目配置"]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.Label,{className:"text-sm font-medium text-gray-600",children:"切换项目:"}),(0,n.jsxs)(l.Select,{value:r||"",onValueChange:n=>{if(n===r)return;let o=e.get("tab"),i=`/configuration?project=${encodeURIComponent(n)}${o?`&tab=${o}`:""}`;t.push(i)},disabled:ee,children:[(0,n.jsx)(l.SelectTrigger,{className:"w-40",children:(0,n.jsx)(l.SelectValue,{placeholder:ee?"加载中...":"选择项目"})}),(0,n.jsx)(l.SelectContent,{children:Z.map(e=>(0,n.jsx)(l.SelectItem,{value:e.name,children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:`w-2 h-2 rounded-full ${"existing"===e.status?"bg-green-500":"failed"===e.status?"bg-red-500":"bg-yellow-500"}`}),(0,n.jsx)("span",{children:e.name})]})},e.name))})]})]}),(0,n.jsx)("div",{className:"ml-4",children:(0,n.jsx)(x.default,{projectName:r||"",compact:!0})})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>ey(!0),children:"创建工作区"}),(0,n.jsx)(a.Button,{variant:"default",onClick:ez,disabled:T,children:T?"打开中...":"在 Cursor 中打开"}),(0,n.jsx)(a.Button,{variant:"outline",onClick:eL,children:"返回初始化页面"})]})]}),tm.length>0?(0,n.jsxs)(s.Tabs,{value:F||tm[0],onValueChange:e=>{z(e),"mock"===e&&e$()},className:"w-full",children:[(0,n.jsxs)(s.TabsList,{className:"grid w-full",style:{gridTemplateColumns:`repeat(${tm.length+1}, 1fr)`},children:[tm.map(e=>(0,n.jsx)(s.TabsTrigger,{value:e,className:"capitalize relative",children:(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[e,eE[e]?.running&&(0,n.jsx)("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse",title:"运行中"})]})},e)),(0,n.jsx)(s.TabsTrigger,{value:"mock",className:"capitalize",children:"Mock配置"})]}),tm.map(e=>{let t=y.envs[e],r=Object.entries(t.proxyEnv),o=C[e]?.selectedProxy||"",i=C[e]?.selectedOption||"",d=t.currentProxy,f=t.proxyEnv[d]||d,m=t.proxyEnv[d]?d:"custom";return(0,n.jsxs)(s.TabsContent,{value:e,className:"space-y-6",children:[(0,n.jsxs)("div",{className:"p-6 bg-gray-50 rounded-lg",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"开发服务器控制"}),(0,n.jsx)("div",{className:"flex items-center gap-4",children:eE[e]?.running?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,n.jsx)("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"运行中 (PID: ",eE[e]?.pid,")"]}),(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>eX(e),children:"查看日志"}),(0,n.jsx)(a.Button,{variant:"destructive",size:"sm",onClick:()=>eV(e),disabled:eE[e]?.loading,children:eE[e]?.loading?"处理中...":"停止"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,n.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full"}),"未运行"]}),(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>eX(e),children:"查看日志"}),(0,n.jsx)(a.Button,{variant:"default",size:"sm",onClick:()=>eW(e),disabled:eE[e]?.loading||!t.startCommand,children:eE[e]?.loading?"处理中...":"启动"})]})})]}),t.startCommand?(0,n.jsxs)("div",{className:"text-sm text-gray-600",children:[(0,n.jsx)("span",{className:"font-medium",children:"启动命令:"})," ",(0,n.jsx)("code",{className:"px-2 py-1 bg-gray-200 rounded",children:t.startCommand})]}):(0,n.jsx)("div",{className:"text-sm text-yellow-600",children:"⚠️ 该环境未配置启动命令"}),t.host&&(0,n.jsxs)("div",{className:"text-sm text-gray-600 mt-2",children:[(0,n.jsx)("span",{className:"font-medium",children:"访问地址:"}),eE[e]?.running?(0,n.jsx)("a",{href:t.host,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-blue-600 hover:underline",children:t.host}):(0,n.jsx)("span",{className:"ml-2",children:t.host})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,n.jsxs)("div",{className:"p-6 bg-gray-50 rounded-lg",children:[(0,n.jsxs)("h3",{className:"text-lg font-semibold mb-4",children:[e," 环境配置"]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(u.Label,{className:"block text-sm font-medium mb-2",children:"接口代理环境切换"}),(0,n.jsxs)(l.Select,{value:i,onValueChange:t=>eZ(e,t),children:[(0,n.jsx)(l.SelectTrigger,{className:"w-full",children:(0,n.jsx)(l.SelectValue,{placeholder:"选择代理环境"})}),(0,n.jsx)(l.SelectContent,{children:r.map(([e,t])=>(0,n.jsxs)(l.SelectItem,{value:e,children:[e,"(",t,")"]},e))})]})]}),f&&(0,n.jsxs)("div",{className:"p-3 bg-blue-50 rounded-md",children:[(0,n.jsxs)("p",{className:"text-sm text-blue-700",children:["当前项目接口已代理至:",m," 环境"]}),(0,n.jsxs)("p",{className:"text-sm text-blue-600",children:["代理地址为:",f]})]}),"custom"===i&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.Label,{className:"block text-sm font-medium",children:"自定义代理地址"}),(0,n.jsx)(c.Input,{type:"url",placeholder:"请输入自定义代理地址 (如: http://localhost:52741)",value:o,onChange:t=>eQ(e,t.target.value),className:"w-full"}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:"请输入完整的代理地址,包括协议 (http:// 或 https://)"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(a.Button,{onClick:()=>e2(e),disabled:C[e]?.saving,className:"w-full sm:w-auto",children:C[e]?.saving?"保存中...":"保存配置"}),C[e]?.saveMessage&&(0,n.jsx)("span",{className:`text-sm ml-3 ${C[e]?.saveMessage==="保存成功"?"text-green-600":"text-red-600"}`,children:C[e]?.saveMessage})]})]})]}),(0,n.jsx)(g.default,{currentProjectName:y.projectName,currentEnvName:e})]})]},e)}),(0,n.jsx)(s.TabsContent,{value:"mock",className:"space-y-6",children:(0,n.jsxs)("div",{className:"p-6 bg-gray-50 rounded-lg",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Mock配置"}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(u.Label,{className:"text-sm font-medium",children:"Mock拦截"}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:"启用或禁用Mock拦截功能"})]}),(0,n.jsx)(d.Switch,{checked:k.mockingIntercept,onCheckedChange:e0})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(u.Label,{className:"text-sm font-medium",children:"Mock开启"}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:"启用或禁用Mock功能"})]}),(0,n.jsx)(d.Switch,{checked:k.mockOpen,onCheckedChange:e1})]})]}),k.saveMessage&&(0,n.jsx)("div",{className:"mb-6",children:(0,n.jsx)("span",{className:`text-sm ${k.saveMessage.includes("已保存")?"text-green-600":"text-red-600"}`,children:k.saveMessage})}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h4",{className:"text-md font-medium",children:"Mock接口列表"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(a.Button,{onClick:()=>{en(!0);let e=te(ea.method,ea.apiPath);B({projectName:r||"",apiName:ea.apiPath,method:ea.method.toLowerCase(),siteName:"",content:e||""})},variant:"default",size:"sm",children:"新建"}),(0,n.jsx)(a.Button,{onClick:e$,disabled:M,variant:"outline",size:"sm",children:M?"加载中...":"刷新"}),(0,n.jsx)(a.Button,{onClick:e3,variant:"outline",size:"sm",children:"一键关闭"}),(0,n.jsx)(a.Button,{onClick:e4,variant:"outline",size:"sm",children:"一键开启"})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,n.jsx)(c.Input,{placeholder:"搜索接口地址...",value:eN,onChange:e=>tf(e.target.value),className:"pr-8"}),eN&&(0,n.jsx)(a.Button,{variant:"ghost",size:"sm",onClick:()=>{eC(""),D(1)},className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-gray-100",children:"×"})]}),eN&&(0,n.jsxs)("span",{className:"text-sm text-gray-500",children:['搜索关键词: "',eN,'"']})]}),M?(0,n.jsx)("div",{className:"text-center py-8",children:(0,n.jsx)("p",{className:"text-gray-500",children:"加载Mock数据中..."})}):O&&O.mockFiles.length>0?(()=>{let e=[];O.mockFiles.forEach(t=>{t.methods.forEach(r=>{let n=t.apiName.replace(/_/g,"/"),o=r.files.map(e=>e.siteName),i=r.setting?.currentSite||o[0]||"",a=r.setting?.open||[],s=a.includes(i);e.push({apiPath:n,method:r.method.toUpperCase(),currentSite:i,availableSites:o,apiName:t.apiName,isOpen:s,openSites:a})})});let t=eN.trim()?e.filter(e=>e.apiPath.toLowerCase().includes(eN.toLowerCase())):e,r=t.length,o=Math.ceil(r/L),i=(I-1)*L,s=i+L,c=t.slice(i,s);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)(f.Table,{children:[(0,n.jsx)(f.TableHeader,{children:(0,n.jsxs)(f.TableRow,{children:[(0,n.jsx)(f.TableHead,{children:"接口地址"}),(0,n.jsx)(f.TableHead,{children:"请求方法"}),(0,n.jsx)(f.TableHead,{children:"当前场景"}),(0,n.jsx)(f.TableHead,{children:"开启mock"}),(0,n.jsx)(f.TableHead,{children:"操作"})]})}),(0,n.jsx)(f.TableBody,{children:c.map((e,t)=>(0,n.jsxs)(f.TableRow,{children:[(0,n.jsx)(f.TableCell,{className:"font-medium",children:e.apiPath}),(0,n.jsx)(f.TableCell,{children:(0,n.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${"GET"===e.method?"bg-green-100 text-green-800":"POST"===e.method?"bg-blue-100 text-blue-800":"PUT"===e.method?"bg-yellow-100 text-yellow-800":"DELETE"===e.method?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:e.method})}),(0,n.jsx)(f.TableCell,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)(l.Select,{value:e.currentSite,onValueChange:t=>e8(e.apiName,e.method.toLowerCase(),t),children:[(0,n.jsx)(l.SelectTrigger,{className:"w-32",children:(0,n.jsx)(l.SelectValue,{})}),(0,n.jsx)(l.SelectContent,{children:e.availableSites.map(e=>(0,n.jsx)(l.SelectItem,{value:e,children:e},e))})]}),e.availableSites.length>1&&(0,n.jsx)(a.Button,{variant:"ghost",size:"sm",onClick:()=>tl(e.apiName,e.method.toLowerCase(),e.currentSite),className:"h-8 w-8 p-0 text-red-500 hover:text-red-700 hover:bg-red-50",title:"删除当前场景",children:(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M3 6h18"}),(0,n.jsx)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,n.jsx)("path",{d:"M8 6V4c0-1 1-2 2-2h4c0 1 1 2 2 2v2"})]})})]})}),(0,n.jsx)(f.TableCell,{children:(0,n.jsx)(d.Switch,{checked:e.isOpen,onCheckedChange:t=>ta(e.apiName,e.method.toLowerCase(),e.currentSite,t)})}),(0,n.jsx)(f.TableCell,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>e9(e.apiName,e.method.toLowerCase(),e.currentSite),disabled:W,children:W?"加载中...":"编辑"}),(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>tn(e.apiName,e.method.toLowerCase(),e.apiPath),disabled:eu,children:"新增场景"}),(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>tu(e.apiName,e.apiPath),className:"text-red-500 hover:text-red-700 hover:border-red-300",children:"删除接口"})]})})]},`${e.apiName}-${e.method}-${t}`))})]}),o>1&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"text-sm text-gray-500",children:["显示 ",i+1,"-",Math.min(s,r)," 条,共 ",r," 条"]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>D(e=>Math.max(1,e-1)),disabled:1===I,children:"上一页"}),(0,n.jsxs)("span",{className:"text-sm",children:[I," / ",o]}),(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:()=>D(e=>Math.min(o,e+1)),disabled:I===o,children:"下一页"})]})]})]})})():(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-gray-500",children:"暂无Mock接口数据"}),(0,n.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"请先创建Mock文件"})]})]})]})})]}):(0,n.jsx)("div",{className:"text-center text-gray-500 py-8",children:(0,n.jsx)("p",{children:"该项目没有配置环境信息"})}),(0,n.jsx)(m.Dialog,{open:$||er||eo,onOpenChange:e=>{e||(U(!1),en(!1),ei(!1),ec(null))},children:(0,n.jsxs)(m.DialogContent,{className:"w-screen h-screen max-w-none max-h-none m-0 rounded-none overflow-hidden flex flex-col",children:[(0,n.jsxs)(m.DialogHeader,{className:"flex-shrink-0 border-b pb-4",children:[(0,n.jsx)(m.DialogTitle,{children:er?"新建Mock文件":eo?"新增场景":"编辑Mock文件"}),(0,n.jsx)(m.DialogDescription,{children:er?"创建一个新的Mock接口文件":eo&&el?(0,n.jsxs)(n.Fragment,{children:["为接口 ",el.apiPath," [",el.method.toUpperCase(),"] 新增场景"]}):H?(0,n.jsxs)(n.Fragment,{children:["编辑 ",H.apiName.replace(/_/g,"/")," - ",H.method.toUpperCase()," - ",H.siteName,".cjs"]}):null})]}),(er||eo)&&(0,n.jsxs)("div",{className:"flex-shrink-0 border-b pb-4",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.Label,{htmlFor:"apiPath",className:"text-sm font-medium",children:"接口地址"}),eo?(0,n.jsx)("div",{className:"px-3 py-2 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-600",children:ea.apiPath}):(0,n.jsx)(c.Input,{id:"apiPath",placeholder:"/api/user/info",value:ea.apiPath,onChange:e=>e7("apiPath",e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.Label,{htmlFor:"method",className:"text-sm font-medium",children:"请求方法"}),eo?(0,n.jsx)("div",{className:"px-3 py-2 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-600",children:ea.method}):(0,n.jsxs)(l.Select,{value:ea.method,onValueChange:e=>e7("method",e),children:[(0,n.jsx)(l.SelectTrigger,{children:(0,n.jsx)(l.SelectValue,{})}),(0,n.jsxs)(l.SelectContent,{children:[(0,n.jsx)(l.SelectItem,{value:"GET",children:"GET"}),(0,n.jsx)(l.SelectItem,{value:"POST",children:"POST"}),(0,n.jsx)(l.SelectItem,{value:"PUT",children:"PUT"}),(0,n.jsx)(l.SelectItem,{value:"DELETE",children:"DELETE"}),(0,n.jsx)(l.SelectItem,{value:"PATCH",children:"PATCH"})]})]})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.Label,{htmlFor:"siteName",className:"text-sm font-medium",children:"场景名称"}),er?(0,n.jsx)("div",{className:"px-3 py-2 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-600",children:"默认场景"}):(0,n.jsx)(c.Input,{id:"siteName",placeholder:"请输入场景名称",value:ea.siteName,onChange:e=>e7("siteName",e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u.Label,{htmlFor:"mockOpen",className:"text-sm font-medium",children:"开启Mock"}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(d.Switch,{id:"mockOpen",checked:ea.mockOpen,onCheckedChange:e=>e7("mockOpen",e)}),(0,n.jsx)("span",{className:"text-sm text-gray-600",children:ea.mockOpen?"开启":"关闭"})]})]})]}),er&&ea.apiPath.trim()&&ea.siteName.trim()&&tt(ea.apiPath,ea.method,ea.siteName)&&(0,n.jsx)("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsxs)("span",{className:"text-red-600 text-sm",children:["⚠️ 接口 ",ea.apiPath," [",ea.method.toUpperCase(),'] 的场景 "',ea.siteName,'" 已存在']})})}),eo&&el&&ea.siteName.trim()&&to(el.apiName,el.method,ea.siteName)&&(0,n.jsx)("div",{className:"mt-4 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsxs)("span",{className:"text-red-600 text-sm",children:['⚠️ 场景 "',ea.siteName,'" 已存在']})})})]}),(0,n.jsx)("div",{className:"flex-1 flex flex-col space-y-4 py-4",children:(0,n.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,n.jsx)(u.Label,{className:"text-sm font-medium mb-2",children:"文件内容"}),(0,n.jsxs)("div",{className:"flex-1 border rounded-md overflow-hidden relative",children:[q&&(0,n.jsx)("div",{className:"absolute inset-0 bg-gray-50 flex items-center justify-center z-10",children:(0,n.jsx)("p",{className:"text-gray-500",children:"编辑器加载中..."})}),(0,n.jsx)(h.default,{height:"100%",defaultLanguage:"javascript",value:H?.content||"",onChange:e=>{B(t=>t?{...t,content:e||""}:null)},onMount:async e=>{console.log("编辑器挂载,模式:",{isCreateMode:er,isAddSceneMode:eo,createFormData:ea}),J(e),Y(!1),setTimeout(()=>eD(e),500)},loading:(0,n.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,n.jsx)("p",{className:"text-gray-500",children:"编辑器加载中..."})}),options:{minimap:{enabled:!1},fontSize:14,lineNumbers:"on",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",theme:"vs-dark",bracketPairColorization:{enabled:!0},quickSuggestions:{other:!0,comments:!0,strings:!0},formatOnPaste:!0,formatOnType:!0,readOnly:!1}},er?"create":eo?"addscene":"edit")]})]})}),(0,n.jsxs)(m.DialogFooter,{className:"flex justify-between flex-shrink-0 border-t pt-4",children:[(0,n.jsx)(a.Button,{variant:"secondary",onClick:eA,disabled:!X||q,children:"格式化代码"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>{er?(en(!1),es({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0})):eo?(ei(!1),ec(null),es({apiPath:"",method:"GET",siteName:"默认场景",mockOpen:!0})):e6()},children:"取消"}),er?(0,n.jsx)(a.Button,{onClick:tr,disabled:eu||!ea.apiPath.trim()||!ea.siteName.trim()||tt(ea.apiPath,ea.method,ea.siteName),children:eu?"创建中...":"创建"}):eo?(0,n.jsx)(a.Button,{onClick:ti,disabled:eu||!ea.siteName.trim()||!!el&&to(el.apiName,el.method,ea.siteName),children:eu?"创建中...":"创建"}):(0,n.jsx)(a.Button,{onClick:e5,disabled:K,children:K?"保存中...":"保存"})]})]})]})}),(0,n.jsx)(m.Dialog,{open:eR,onOpenChange:e=>{e||eJ()},children:(0,n.jsxs)(m.DialogContent,{className:"max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0",children:[(0,n.jsxs)(m.DialogHeader,{className:"px-6 pt-6 pb-4",children:[(0,n.jsxs)(m.DialogTitle,{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{children:["进程日志 - ",r," - ",eP]}),(0,n.jsx)("span",{className:"flex items-center gap-2 text-sm font-normal",children:eK&&(0,n.jsxs)("span",{className:"flex items-center gap-1 text-green-600",children:[(0,n.jsx)("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"实时连接"]})})]}),(0,n.jsx)(m.DialogDescription,{children:"实时显示进程输出日志"})]}),(0,n.jsx)("div",{className:"flex-1 min-h-0 bg-gray-900 mx-6 rounded-md overflow-hidden",children:(0,n.jsx)(v.default,{logs:e_})}),(0,n.jsxs)(m.DialogFooter,{className:"flex items-center justify-between px-6 pb-6 pt-4",children:[(0,n.jsxs)("div",{className:"text-sm text-gray-500",children:["共 ",e_.length," 条日志"]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>{eP&&(eY(),eq(eP))},disabled:!!eK,children:"重新连接"}),(0,n.jsx)(a.Button,{variant:"default",onClick:eJ,children:"关闭"})]})]})]})}),(0,n.jsx)(m.Dialog,{open:ef.open,onOpenChange:e=>{e||em({open:!1,apiName:"",method:"",siteName:""})},children:(0,n.jsxs)(m.DialogContent,{className:"max-w-md",children:[(0,n.jsxs)(m.DialogHeader,{children:[(0,n.jsxs)(m.DialogTitle,{className:"flex items-center gap-2 text-red-600",children:[(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M3 6h18"}),(0,n.jsx)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,n.jsx)("path",{d:"M8 6V4c0-1 1-2 2-2h4c0 1 1 2 2 2v2"})]}),"确认删除场景"]}),(0,n.jsxs)(m.DialogDescription,{children:["确定要删除场景 ",(0,n.jsxs)("span",{className:"font-medium text-gray-900",children:['"',ef.siteName,'"']})," 吗?",(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-red-500 text-sm mt-2 block",children:"此操作不可撤销"})]})]}),(0,n.jsxs)(m.DialogFooter,{className:"flex gap-2 justify-end",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>em({open:!1,apiName:"",method:"",siteName:""}),children:"取消"}),(0,n.jsx)(a.Button,{variant:"destructive",onClick:tc,children:"删除"})]})]})}),(0,n.jsx)(m.Dialog,{open:ep.open,onOpenChange:e=>{e||eh({open:!1,apiName:"",apiPath:""})},children:(0,n.jsxs)(m.DialogContent,{className:"max-w-md",children:[(0,n.jsxs)(m.DialogHeader,{children:[(0,n.jsxs)(m.DialogTitle,{className:"flex items-center gap-2 text-red-600",children:[(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M3 6h18"}),(0,n.jsx)("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),(0,n.jsx)("path",{d:"M8 6V4c0-1 1-2 2-2h4c0 1 1 2 2 2v2"})]}),"确认删除接口"]}),(0,n.jsxs)(m.DialogDescription,{children:["确定要删除整个接口 ",(0,n.jsxs)("span",{className:"font-medium text-gray-900",children:['"',ep.apiPath,'"']})," 吗?",(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-red-500 text-sm mt-2 block font-medium",children:"⚠️ 这将删除该接口的所有场景和相关文件,此操作不可撤销"})]})]}),(0,n.jsxs)(m.DialogFooter,{className:"flex gap-2 justify-end",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>eh({open:!1,apiName:"",apiPath:""}),children:"取消"}),(0,n.jsx)(a.Button,{variant:"destructive",onClick:td,children:"删除整个接口"})]})]})}),(0,n.jsx)(m.Dialog,{open:ex,onOpenChange:ey,children:(0,n.jsxs)(m.DialogContent,{className:"max-w-md",children:[(0,n.jsxs)(m.DialogHeader,{children:[(0,n.jsx)(m.DialogTitle,{children:"创建工作区"}),(0,n.jsx)(m.DialogDescription,{children:"选择要包含在工作区中的项目"})]}),(0,n.jsxs)("div",{className:"py-4 max-h-96 overflow-y-auto",children:[(0,n.jsx)("div",{className:"space-y-3",children:Z.filter(e=>"existing"===e.status).map(e=>(0,n.jsxs)("div",{className:"flex items-center space-x-3 p-3 rounded-lg border border-gray-200 hover:bg-gray-50 transition-colors",children:[(0,n.jsx)(p.Checkbox,{id:`workspace-${e.name}`,checked:eb.includes(e.name),onCheckedChange:()=>eB(e.name)}),(0,n.jsx)("label",{htmlFor:`workspace-${e.name}`,className:"flex-1 cursor-pointer text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e.name})]},e.name))}),0===Z.filter(e=>"existing"===e.status).length&&(0,n.jsx)("div",{className:"text-center py-8 text-gray-500",children:"没有可用的项目"})]}),(0,n.jsxs)(m.DialogFooter,{className:"flex gap-2 justify-end",children:[(0,n.jsx)(a.Button,{variant:"outline",onClick:()=>{ey(!1),ew([])},children:"取消"}),(0,n.jsx)(a.Button,{variant:"default",onClick:eH,disabled:ej||0===eb.length,children:ej?"创建中...":"确认创建"})]})]})}),eg.open&&(0,n.jsx)("div",{className:"fixed top-4 right-4 z-50 animate-in slide-in-from-top-2 duration-300",children:(0,n.jsxs)("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg border max-w-sm ${"success"===eg.type?"bg-green-50 border-green-200 text-green-800":"bg-red-50 border-red-200 text-red-800"}`,children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:"success"===eg.type?(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-green-600",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-red-600",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,n.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),(0,n.jsx)("p",{className:"text-sm font-medium",children:eg.message}),(0,n.jsx)("button",{onClick:()=>ev({open:!1,type:"success",message:""}),className:"flex-shrink-0 ml-auto",children:(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-60 hover:opacity-100",children:[(0,n.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,n.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})]})}function w(){return(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,n.jsxs)("div",{className:"text-center space-y-4",children:[(0,n.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,n.jsx)("p",{className:"text-gray-600",children:"正在加载配置页面..."})]})}),children:(0,n.jsx)(b,{})})}}}]);
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=7e0a49ac2b139df9.js.map
|