@jonathanleelx/meddle 0.3.0 → 0.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/bin/commands/update.js +187 -0
  2. package/bin/index.js +4 -0
  3. package/bin/lib/update-check.js +438 -0
  4. package/index.js +3 -0
  5. package/package.json +1 -1
  6. package/web/dist/assets/{checkbox-D0y07vOb.js → checkbox-BWULYytd.js} +1 -1
  7. package/web/dist/assets/{code-fixer-DOrMk-4V.js → code-fixer-5eQnwT8X.js} +2 -2
  8. package/web/dist/assets/{detail-panel-CGfKk7-i.js → detail-panel-BpOhMCBc.js} +1 -1
  9. package/web/dist/assets/{global-panel-shell-COyDpKbS.js → global-panel-shell-BAYOGxQQ.js} +1 -1
  10. package/web/dist/assets/{health-panel-CgEmCIeC.js → health-panel-kmPJnyYQ.js} +1 -1
  11. package/web/dist/assets/{index-DTeCUv1G.js → index-DboWpNx1.js} +2 -2
  12. package/web/dist/assets/{mobile-proxy-panel-BCUn96iR.js → mobile-proxy-panel-DmB_Xpfw.js} +1 -1
  13. package/web/dist/assets/mock-config-iBp0BDov.js +1 -0
  14. package/web/dist/assets/{mock-editor-panel-Ctf1EX-d.js → mock-editor-panel-CXXDTlEW.js} +1 -1
  15. package/web/dist/assets/{monaco-editor-DboIGERI.js → monaco-editor-Z1BRT9kx.js} +2 -2
  16. package/web/dist/assets/{plugin-code-editor-DuaSNWGF.js → plugin-code-editor-BlDjbDTI.js} +1 -1
  17. package/web/dist/assets/{plugin-config-D7H47wsJ.js → plugin-config-CAt68TW2.js} +1 -1
  18. package/web/dist/assets/{plugin-generator-xGpWo1Fc.js → plugin-generator-DQPeKPiv.js} +1 -1
  19. package/web/dist/assets/{plugin-test-dialog-BfxPpCfE.js → plugin-test-dialog-DzxpHPhR.js} +1 -1
  20. package/web/dist/assets/{route-preview-CvoRZiwx.js → route-preview-DE5VQpeQ.js} +1 -1
  21. package/web/dist/assets/{rule-ai-assistant-panel-B0UlJVO3.js → rule-ai-assistant-panel-CzFwse2h.js} +1 -1
  22. package/web/dist/assets/rule-config-CSjkrM2g.js +15 -0
  23. package/web/dist/assets/{select-CH0aJ3Dd.js → select-DOK-k_l8.js} +1 -1
  24. package/web/dist/assets/{settings-panel-BvaGZmBw.js → settings-panel-Ccdeqa9n.js} +1 -1
  25. package/web/dist/index.html +1 -1
  26. package/web/dist/assets/mock-config-DNMSOrLv.js +0 -1
  27. package/web/dist/assets/rule-config-BmrlYakh.js +0 -15
@@ -1 +1 @@
1
- import{a as e,f as t,i as n,s as r,u as i}from"./button-BTToMaBW.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./dist-C6eaYCUo.js";import{t as d}from"./chevron-down-CPngAx4M.js";import{n as f,t as p}from"./dist-Cn0y0IRn.js";import{n as m,t as h}from"./dist-Bb9TeEub.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./es2015-CfXu88Y7.js";import{n as S,t as C}from"./dist-D5Dj17P8.js";import{t as w}from"./dist-DZJ9SMlJ.js";import{mt as T}from"./index-DTeCUv1G.js";var E=t(i(),1),D=e(),O=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),k=`VisuallyHidden`,A=E.forwardRef((e,t)=>(0,D.jsx)(c.span,{...e,ref:t,style:{...O,...e.style}}));A.displayName=k;var j=[`top`,`right`,`bottom`,`left`],M=Math.min,N=Math.max,P=Math.round,F=Math.floor,I=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`},te={start:`end`,end:`start`};function ne(e,t,n){return N(e,M(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function B(e){return e===`x`?`y`:`x`}function V(e){return e===`y`?`height`:`width`}var re=new Set([`top`,`bottom`]);function H(e){return re.has(R(e))?`y`:`x`}function ie(e){return B(H(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=z(e),i=ie(e),a=V(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.replace(/start|end/g,e=>te[e])}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=z(e),a=fe(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){return e.replace(/left|right|bottom|top/g,e=>ee[e])}function he(e){return{top:0,right:0,bottom:0,left:0,...e}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ve(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=ie(t),s=V(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(z(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ye(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ye},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=V(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=M(d[_],T),D=M(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ne(O,A,k),N=!c.arrow&&z(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=N?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...N&&{alignmentOffset:P}},reset:N}}}),Se=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=H(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=H(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function we(e){return j.some(t=>e[t]>=0)}var Te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=L(e,t);switch(i){case`referenceHidden`:{let e=Ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:we(e)}}}case`escaped`:{let e=Ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:we(e)}}}default:return{}}}}},Ee=new Set([`left`,`top`]);async function De(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=H(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Oe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await De(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=L(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(R(i)),p=B(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ne(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ne(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ae=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=L(e,t),u={x:n,y:r},d=H(i),f=B(d),p=u[f],m=u[d],h=L(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ee.has(R(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=L(e,t),u=await o.detectOverflow(t,l),d=R(i),f=z(i),p=H(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=M(h-u[g],v),x=M(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=N(u.left,0),t=N(u.right,0),n=N(u.top,0),r=N(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:N(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:N(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Me(){return typeof window<`u`}function Ne(e){return Pe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Me()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Me()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}var Ie=new Set([`inline`,`contents`]);function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ie.has(i)}var Re=new Set([`table`,`td`,`th`]);function ze(e){return Re.has(Ne(e))}var Be=[`:popover-open`,`:modal`];function Ve(e){return Be.some(t=>{try{return e.matches(t)}catch{return!1}})}var He=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Ue=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],We=[`paint`,`layout`,`strict`,`content`];function Ge(e){let t=qe(),n=G(e)?q(e):e;return He.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Ue.some(e=>(n.willChange||``).includes(e))||We.some(e=>(n.contain||``).includes(e))}function Ke(e){let t=J(e);for(;K(t)&&!Ye(t);){if(Ge(t))return t;if(Ve(t))return null;t=J(t)}return null}function qe(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Je=new Set([`html`,`body`,`#document`]);function Ye(e){return Je.has(Ne(e))}function q(e){return U(e).getComputedStyle(e)}function Xe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||W(e);return Fe(t)?t.host:t}function Ze(e){let t=J(e);return Ye(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function et(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=P(n)!==a||P(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tt(e){return G(e)?e:e.contextElement}function nt(e){let t=tt(e);if(!K(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=et(t),o=(a?P(n.width):n.width)/r,s=(a?P(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rt=I(0);function it(e){let t=U(e);return!qe()||!t.visualViewport?rt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function at(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tt(e),o=I(1);t&&(r?G(r)&&(o=nt(r)):o=nt(e));let s=at(a,n,r)?it(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=nt(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=$e(n)}}return _e({width:u,height:d,x:c,y:l})}function ot(e,t){let n=Xe(e).scrollLeft;return t?t.left+n:Y(W(e)).left+n}function st(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ot(e,n),y:n.top+t.scrollTop}}function ct(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Ve(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=K(r);if((d||!d&&!a)&&((Ne(r)!==`body`||Le(o))&&(c=Xe(r)),K(r))){let e=Y(r);l=nt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?st(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function lt(e){return Array.from(e.getClientRects())}function ut(e){let t=W(e),n=Xe(e),r=e.ownerDocument.body,i=N(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=N(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ot(e),s=-n.scrollTop;return q(r).direction===`rtl`&&(o+=N(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dt=25;function ft(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=qe();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ot(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=dt&&(a-=o)}else l<=dt&&(a+=l);return{width:a,height:o,x:s,y:c}}var pt=new Set([`absolute`,`fixed`]);function mt(e,t){let n=Y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?nt(e):I(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ht(e,t,n){let r;if(t===`viewport`)r=ft(e,n);else if(t===`document`)r=ut(W(e));else if(G(t))r=mt(t,n);else{let n=it(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function gt(e,t){let n=J(e);return n===t||!G(n)||Ye(n)?!1:q(n).position===`fixed`||gt(n,t)}function _t(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>G(e)&&Ne(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;G(o)&&!Ye(o);){let t=q(o),n=Ge(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&pt.has(i.position)||Le(o)&&!n&&gt(e,o))?r=r.filter(e=>e!==o):i=t,o=J(o)}return t.set(e,r),r}function vt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ve(t)?[]:_t(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=ht(t,n,i);return e.top=N(r.top,e.top),e.right=M(r.right,e.right),e.bottom=M(r.bottom,e.bottom),e.left=N(r.left,e.left),e},ht(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function yt(e){let{width:t,height:n}=et(e);return{width:t,height:n}}function bt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);function l(){c.x=ot(i)}if(r||!r&&!a)if((Ne(t)!==`body`||Le(i))&&(s=Xe(t)),r){let e=Y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?st(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xt(e){return q(e).position===`static`}function St(e,t){if(!K(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Ct(e,t){let n=U(e);if(Ve(e))return n;if(!K(e)){let t=J(e);for(;t&&!Ye(t);){if(G(t)&&!xt(t))return t;t=J(t)}return n}let r=St(e,t);for(;r&&ze(r)&&xt(r);)r=St(r,t);return r&&Ye(r)&&xt(r)&&!Ge(r)?n:r||Ke(e)||n}var wt=async function(e){let t=this.getOffsetParent||Ct,n=this.getDimensions,r=await n(e.floating);return{reference:bt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tt(e){return q(e).direction===`rtl`}var Et={convertOffsetParentRelativeRectToViewportRelativeRect:ct,getDocumentElement:W,getClippingRect:vt,getOffsetParent:Ct,getElementRects:wt,getClientRects:lt,getDimensions:yt,getScale:nt,isElement:G,isRTL:Tt};function Dt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ot(e,t){let n=null,r,i=W(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=F(d),h=F(i.clientWidth-(u+f)),g=F(i.clientHeight-(d+p)),_=F(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:N(0,M(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tt(e),u=i||a?[...l?Qe(l):[],...Qe(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ot(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Y(e):null;c&&g();function g(){let t=Y(e);h&&!Dt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var At=Oe,jt=ke,Mt=Se,Nt=je,Pt=Te,Ft=xe,It=Ae,Lt=(e,t,n)=>{let r=new Map,i={platform:Et,...n},a={...i.platform,_c:r};return be(e,t,{...i,platform:a})},Rt=t(o(),1),zt=typeof document<`u`?E.useLayoutEffect:function(){};function Bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Vt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ht(e,t){let n=Vt(e);return Math.round(t*n)/n}function Ut(e){let t=E.useRef(e);return zt(()=>{t.current=e}),t}function Wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Bt(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Ut(c),O=Ut(i),k=Ut(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Lt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Bt(w.current,t)&&(w.current=t,Rt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);zt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=E.useRef(!1);zt(()=>(j.current=!0,()=>{j.current=!1}),[]),zt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let M=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=E.useMemo(()=>({reference:b,floating:x}),[b,x]),P=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ht(N.floating,u.x),r=Ht(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Vt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ft({element:r.current,padding:i}).fn(n):r?Ft({element:r,padding:i}).fn(n):{}}}},Kt=(e,t)=>({...At(e),options:[e,t]}),qt=(e,t)=>({...jt(e),options:[e,t]}),Jt=(e,t)=>({...It(e),options:[e,t]}),Yt=(e,t)=>({...Mt(e),options:[e,t]}),Xt=(e,t)=>({...Nt(e),options:[e,t]}),Zt=(e,t)=>({...Pt(e),options:[e,t]}),Qt=(e,t)=>({...Gt(e),options:[e,t]}),$t=`Arrow`,en=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});en.displayName=$t;var tn=en,nn=`Popper`,[rn,an]=a(nn),[on,sn]=rn(nn),cn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null);return(0,D.jsx)(on,{scope:t,anchor:r,onAnchorChange:i,children:n})};cn.displayName=nn;var ln=`PopperAnchor`,un=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=sn(ln,n),s=E.useRef(null),l=r(t,s),u=E.useRef(null);return E.useEffect(()=>{let e=u.current;u.current=i?.current||s.current,e!==u.current&&o.onAnchorChange(u.current)}),i?null:(0,D.jsx)(c.div,{...a,ref:l})});un.displayName=ln;var dn=`PopperContent`,[fn,pn]=rn(dn),mn=E.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=sn(dn,n),[x,S]=E.useState(null),w=r(t,e=>S(e)),[T,O]=E.useState(null),k=C(T),A=k?.width??0,j=k?.height??0,M=i+(o===`center`?``:`-`+o),N=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},P=Array.isArray(f)?f:[f],F=P.length>0,I={padding:N,boundary:P.filter(vn),altBoundary:F},{refs:ee,floatingStyles:te,placement:ne,isPositioned:L,middlewareData:R}=Wt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>kt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[Kt({mainAxis:a+j,alignmentAxis:l}),d&&qt({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?Jt():void 0,...I}),d&&Yt({...I}),Xt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Qt({element:T,padding:u}),yn({arrowWidth:A,arrowHeight:j}),g&&Zt({strategy:`referenceHidden`,...I})]}),[z,B]=bn(ne),V=h(v);s(()=>{L&&V?.()},[L,V]);let re=R.arrow?.x,H=R.arrow?.y,ie=R.arrow?.centerOffset!==0,[ae,oe]=E.useState();return s(()=>{x&&oe(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:L?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(fn,{scope:n,placedSide:z,onArrowChange:O,arrowX:re,arrowY:H,shouldHideArrow:ie,children:(0,D.jsx)(c.div,{"data-side":z,"data-align":B,...y,ref:w,style:{...y.style,animation:L?void 0:`none`}})})})});mn.displayName=dn;var hn=`PopperArrow`,gn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_n=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pn(hn,n),a=gn[i.placedSide];return(0,D.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,D.jsx)(tn,{...r,ref:t,style:{...r.style,display:`block`}})})});_n.displayName=hn;function vn(e){return e!==null}var yn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xn=cn,Sn=un,Cn=mn,wn=_n,Tn=[` `,`Enter`,`ArrowUp`,`ArrowDown`],En=[` `,`Enter`],X=`Select`,[Dn,On,kn]=f(X),[An,jn]=a(X,[kn,an]),Mn=an(),[Nn,Z]=An(X),[Pn,Fn]=An(X),In=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:h,required:g,form:_}=e,v=Mn(t),[y,b]=E.useState(null),[x,S]=E.useState(null),[C,w]=E.useState(!1),T=p(l),[O,k]=u({prop:r,defaultProp:i??!1,onChange:a,caller:X}),[A,j]=u({prop:o,defaultProp:s,onChange:c,caller:X}),M=E.useRef(null),N=y?_||!!y.closest(`form`):!0,[P,F]=E.useState(new Set),I=Array.from(P).map(e=>e.props.value).join(`;`);return(0,D.jsx)(xn,{...v,children:(0,D.jsxs)(Nn,{required:g,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:A,onValueChange:j,open:O,onOpenChange:k,dir:T,triggerPointerDownPosRef:M,disabled:h,children:[(0,D.jsx)(Dn.Provider,{scope:t,children:(0,D.jsx)(Pn,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(e=>{F(t=>new Set(t).add(e))},[]),onNativeOptionRemove:E.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),N?(0,D.jsxs)(kr,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:e=>j(e.target.value),disabled:h,form:_,children:[A===void 0?(0,D.jsx)(`option`,{value:``}):null,Array.from(P)]},I):null]})})};In.displayName=X;var Ln=`SelectTrigger`,Rn=E.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...a}=e,o=Mn(n),s=Z(Ln,n),u=s.disabled||i,d=r(t,s.onTriggerChange),f=On(n),p=E.useRef(`touch`),[m,h,g]=jr(e=>{let t=f().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=e=>{u||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,D.jsx)(Sn,{asChild:!0,...o,children:(0,D.jsx)(c.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:u,"data-disabled":u?``:void 0,"data-placeholder":Ar(s.value)?``:void 0,...a,ref:d,onClick:l(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:l(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&Tn.includes(e.key)&&(_(),e.preventDefault())})})})});Rn.displayName=Ln;var zn=`SelectValue`,Bn=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:l=``,...u}=e,d=Z(zn,n),{onValueNodeHasChildrenChange:f}=d,p=o!==void 0,m=r(t,d.onValueNodeChange);return s(()=>{f(p)},[f,p]),(0,D.jsx)(c.span,{...u,ref:m,style:{pointerEvents:`none`},children:Ar(d.value)?(0,D.jsx)(D.Fragment,{children:l}):o})});Bn.displayName=zn;var Vn=`SelectIcon`,Hn=E.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,D.jsx)(c.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Hn.displayName=Vn;var Un=`SelectPortal`,Wn=e=>(0,D.jsx)(_,{asChild:!0,...e});Wn.displayName=Un;var Gn=`SelectContent`,Kn=E.forwardRef((e,t)=>{let n=Z(Gn,e.__scopeSelect),[r,i]=E.useState();if(s(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Rt.createPortal((0,D.jsx)(qn,{scope:e.__scopeSelect,children:(0,D.jsx)(Dn.Slot,{scope:e.__scopeSelect,children:(0,D.jsx)(`div`,{children:e.children})})}),t):null}return(0,D.jsx)(Xn,{...e,ref:t})});Kn.displayName=Gn;var Q=10,[qn,$]=An(Gn),Jn=`SelectContentImpl`,Yn=n(`SelectContent.RemoveScroll`),Xn=E.forwardRef((e,t)=>{let{__scopeSelect:n,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=Z(Gn,n),[O,k]=E.useState(null),[A,j]=E.useState(null),M=r(t,e=>k(e)),[N,P]=E.useState(null),[F,I]=E.useState(null),ee=On(n),[te,ne]=E.useState(!1),L=E.useRef(!1);E.useEffect(()=>{if(O)return x(O)},[O]),b();let R=E.useCallback(e=>{let[t,...n]=ee().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&A&&(A.scrollTop=0),n===r&&A&&(A.scrollTop=A.scrollHeight),n?.focus(),document.activeElement!==i))return},[ee,A]),z=E.useCallback(()=>R([N,O]),[R,N,O]);E.useEffect(()=>{te&&z()},[te,z]);let{onOpenChange:B,triggerPointerDownPosRef:V}=T;E.useEffect(()=>{if(O){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(V.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():O.contains(n.target)||B(!1),document.removeEventListener(`pointermove`,t),V.current=null};return V.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[O,B,V]),E.useEffect(()=>{let e=()=>B(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[B]);let[re,H]=jr(e=>{let t=ee().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(P(e),r&&(L.current=!0))},[T.value]),ae=E.useCallback(()=>O?.focus(),[O]),oe=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&I(e)},[T.value]),se=i===`popper`?er:Qn,ce=se===er?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C}:{};return(0,D.jsx)(qn,{scope:n,content:O,viewport:A,onViewportChange:j,itemRefCallback:ie,selectedItem:N,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:z,selectedItemText:F,position:i,isPositioned:te,searchRef:re,children:(0,D.jsx)(v,{as:Yn,allowPinchZoom:!0,children:(0,D.jsx)(g,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,D.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,D.jsx)(se,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ce,onPlaced:()=>ne(!0),ref:M,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:l(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&H(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=ee().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})});Xn.displayName=Jn;var Zn=`SelectItemAlignedPosition`,Qn=E.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,o=Z(Gn,n),l=$(Gn,n),[u,d]=E.useState(null),[f,p]=E.useState(null),m=r(t,e=>p(e)),h=On(n),g=E.useRef(!1),_=E.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,S=E.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&f&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.right=d+`px`}let a=h(),s=window.innerHeight-Q*2,c=v.scrollHeight,l=window.getComputedStyle(f),d=parseInt(l.borderTopWidth,10),p=parseInt(l.paddingTop,10),m=parseInt(l.borderBottomWidth,10),_=parseInt(l.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),T=parseInt(C.paddingTop,10),E=parseInt(C.paddingBottom,10),D=e.top+e.height/2-Q,O=s-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;u.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);u.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;u.style.top=`0px`;let t=Math.max(D,d+v.offsetTop+(e?T:0)+k)+M;u.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}u.style.margin=`${Q}px 0`,u.style.minHeight=S+`px`,u.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,u,f,v,y,b,o.dir,i]);s(()=>S(),[S]);let[C,T]=E.useState();return s(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]),(0,D.jsx)(tr,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:E.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,D.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,D.jsx)(c.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Qn.displayName=Zn;var $n=`SelectPopperPosition`,er=E.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Q,...a}=e,o=Mn(n);return(0,D.jsx)(Cn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});er.displayName=$n;var[tr,nr]=An(Gn,{}),rr=`SelectViewport`,ir=E.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:i,...a}=e,o=$(rr,n),s=nr(rr,n),u=r(t,o.onViewportChange),d=E.useRef(0);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,D.jsx)(Dn.Slot,{scope:n,children:(0,D.jsx)(c.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:u,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:l(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(d.current-t.scrollTop);if(e>0){let r=window.innerHeight-Q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}d.current=t.scrollTop})})})]})});ir.displayName=rr;var ar=`SelectGroup`,[or,sr]=An(ar),cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=m();return(0,D.jsx)(or,{scope:n,id:i,children:(0,D.jsx)(c.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});cr.displayName=ar;var lr=`SelectLabel`,ur=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=sr(lr,n);return(0,D.jsx)(c.div,{id:i.id,...r,ref:t})});ur.displayName=lr;var dr=`SelectItem`,[fr,pr]=An(dr),mr=E.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:a=!1,textValue:o,...s}=e,u=Z(dr,n),d=$(dr,n),f=u.value===i,[p,h]=E.useState(o??``),[g,_]=E.useState(!1),v=r(t,e=>d.itemRefCallback?.(e,i,a)),y=m(),b=E.useRef(`touch`),x=()=>{a||(u.onValueChange(i),u.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,D.jsx)(fr,{scope:n,value:i,disabled:a,textId:y,isSelected:f,onItemTextChange:E.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,D.jsx)(Dn.ItemSlot,{scope:n,value:i,disabled:a,textValue:p,children:(0,D.jsx)(c.div,{role:`option`,"aria-labelledby":y,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>_(!0)),onBlur:l(s.onBlur,()=>_(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,a?d.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{d.searchRef?.current!==``&&e.key===` `||(En.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});mr.displayName=dr;var hr=`SelectItemText`,gr=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...o}=e,l=Z(hr,n),u=$(hr,n),d=pr(hr,n),f=Fn(hr,n),[p,m]=E.useState(null),h=r(t,e=>m(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,_=E.useMemo(()=>(0,D.jsx)(`option`,{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=f;return s(()=>(v(_),()=>y(_)),[v,y,_]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c.span,{id:d.textId,...o,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Rt.createPortal(o.children,l.valueNode):null]})});gr.displayName=hr;var _r=`SelectItemIndicator`,vr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return pr(_r,n).isSelected?(0,D.jsx)(c.span,{"aria-hidden":!0,...r,ref:t}):null});vr.displayName=_r;var yr=`SelectScrollUpButton`,br=E.forwardRef((e,t)=>{let n=$(yr,e.__scopeSelect),i=nr(yr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});br.displayName=yr;var xr=`SelectScrollDownButton`,Sr=E.forwardRef((e,t)=>{let n=$(xr,e.__scopeSelect),i=nr(xr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Sr.displayName=xr;var Cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$(`SelectScrollButton`,n),o=E.useRef(null),u=On(n),d=E.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),s(()=>{u().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[u]),(0,D.jsx)(c.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:l(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:l(i.onPointerLeave,()=>{d()})})}),wr=`SelectSeparator`,Tr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,D.jsx)(c.div,{"aria-hidden":!0,...r,ref:t})});Tr.displayName=wr;var Er=`SelectArrow`,Dr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Mn(n),a=Z(Er,n),o=$(Er,n);return a.open&&o.position===`popper`?(0,D.jsx)(wn,{...i,...r,ref:t}):null});Dr.displayName=Er;var Or=`SelectBubbleInput`,kr=E.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let a=E.useRef(null),o=r(i,a),s=S(t);return E.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,D.jsx)(c.select,{...n,style:{...O,...n.style},ref:o,defaultValue:t})});kr.displayName=Or;function Ar(e){return e===``||e===void 0}function jr(e){let t=h(e),n=E.useRef(``),r=E.useRef(0),i=E.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=E.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Mr(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Nr(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Nr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Pr=In,Fr=Rn,Ir=Bn,Lr=Hn,Rr=Wn,zr=Kn,Br=ir,Vr=cr,Hr=mr,Ur=gr,Wr=vr,Gr=Pr,Kr=Vr,qr=Ir,Jr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Fr,{ref:r,className:Zr(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,D.jsx)(Lr,{asChild:!0,children:(0,D.jsx)(d,{className:`h-4 w-4 opacity-50`})})]}));Jr.displayName=Fr.displayName;var Yr=E.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,D.jsx)(Rr,{children:(0,D.jsx)(zr,{ref:i,className:Zr(`relative z-[100] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:(0,D.jsx)(Br,{className:Zr(`p-1`,n===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));Yr.displayName=zr.displayName;var Xr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Hr,{ref:r,className:Zr(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,D.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,D.jsx)(Wr,{children:(0,D.jsx)(T,{className:`h-4 w-4`})})}),(0,D.jsx)(Ur,{children:t})]}));Xr.displayName=Hr.displayName;function Zr(...e){return e.filter(Boolean).join(` `)}export{Jr as a,Xr as i,Yr as n,qr as o,Kr as r,Gr as t};
1
+ import{a as e,f as t,i as n,s as r,u as i}from"./button-BTToMaBW.js";import{a,c as o,n as s,o as c,r as l,t as u}from"./dist-C6eaYCUo.js";import{t as d}from"./chevron-down-CPngAx4M.js";import{n as f,t as p}from"./dist-Cn0y0IRn.js";import{n as m,t as h}from"./dist-Bb9TeEub.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./es2015-CfXu88Y7.js";import{n as S,t as C}from"./dist-D5Dj17P8.js";import{t as w}from"./dist-DZJ9SMlJ.js";import{mt as T}from"./index-DboWpNx1.js";var E=t(i(),1),D=e(),O=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),k=`VisuallyHidden`,A=E.forwardRef((e,t)=>(0,D.jsx)(c.span,{...e,ref:t,style:{...O,...e.style}}));A.displayName=k;var j=[`top`,`right`,`bottom`,`left`],M=Math.min,N=Math.max,P=Math.round,F=Math.floor,I=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`},te={start:`end`,end:`start`};function ne(e,t,n){return N(e,M(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function B(e){return e===`x`?`y`:`x`}function V(e){return e===`y`?`height`:`width`}var re=new Set([`top`,`bottom`]);function H(e){return re.has(R(e))?`y`:`x`}function ie(e){return B(H(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=z(e),i=ie(e),a=V(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.replace(/start|end/g,e=>te[e])}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=z(e),a=fe(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){return e.replace(/left|right|bottom|top/g,e=>ee[e])}function he(e){return{top:0,right:0,bottom:0,left:0,...e}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ve(e,t,n){let{reference:r,floating:i}=e,a=H(t),o=ie(t),s=V(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(z(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ye(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ye},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=V(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=M(d[_],T),D=M(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ne(O,A,k),N=!c.arrow&&z(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=N?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...N&&{alignmentOffset:P}},reset:N}}}),Se=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=H(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==H(t))||T.every(e=>H(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=H(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function we(e){return j.some(t=>e[t]>=0)}var Te=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=L(e,t);switch(i){case`referenceHidden`:{let e=Ce(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:we(e)}}}case`escaped`:{let e=Ce(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:we(e)}}}default:return{}}}}},Ee=new Set([`left`,`top`]);async function De(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=H(n)===`y`,l=Ee.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Oe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await De(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=L(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=H(R(i)),p=B(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ne(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ne(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ae=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=L(e,t),u={x:n,y:r},d=H(i),f=B(d),p=u[f],m=u[d],h=L(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ee.has(R(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=L(e,t),u=await o.detectOverflow(t,l),d=R(i),f=z(i),p=H(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=M(h-u[g],v),x=M(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=N(u.left,0),t=N(u.right,0),n=N(u.top,0),r=N(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:N(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:N(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Me(){return typeof window<`u`}function Ne(e){return Pe(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((Pe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Pe(e){return Me()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return Me()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return Me()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function Fe(e){return!Me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}var Ie=new Set([`inline`,`contents`]);function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ie.has(i)}var Re=new Set([`table`,`td`,`th`]);function ze(e){return Re.has(Ne(e))}var Be=[`:popover-open`,`:modal`];function Ve(e){return Be.some(t=>{try{return e.matches(t)}catch{return!1}})}var He=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Ue=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],We=[`paint`,`layout`,`strict`,`content`];function Ge(e){let t=qe(),n=G(e)?q(e):e;return He.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Ue.some(e=>(n.willChange||``).includes(e))||We.some(e=>(n.contain||``).includes(e))}function Ke(e){let t=J(e);for(;K(t)&&!Ye(t);){if(Ge(t))return t;if(Ve(t))return null;t=J(t)}return null}function qe(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Je=new Set([`html`,`body`,`#document`]);function Ye(e){return Je.has(Ne(e))}function q(e){return U(e).getComputedStyle(e)}function Xe(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Ne(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fe(e)&&e.host||W(e);return Fe(t)?t.host:t}function Ze(e){let t=J(e);return Ye(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&Le(t)?t:Ze(t)}function Qe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ze(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=$e(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Qe(e):[])}return t.concat(r,Qe(r,[],n))}function $e(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function et(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=P(n)!==a||P(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tt(e){return G(e)?e:e.contextElement}function nt(e){let t=tt(e);if(!K(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=et(t),o=(a?P(n.width):n.width)/r,s=(a?P(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rt=I(0);function it(e){let t=U(e);return!qe()||!t.visualViewport?rt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function at(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function Y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tt(e),o=I(1);t&&(r?G(r)&&(o=nt(r)):o=nt(e));let s=at(a,n,r)?it(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=$e(n);for(;i&&r&&t!==n;){let e=nt(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=$e(n)}}return _e({width:u,height:d,x:c,y:l})}function ot(e,t){let n=Xe(e).scrollLeft;return t?t.left+n:Y(W(e)).left+n}function st(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ot(e,n),y:n.top+t.scrollTop}}function ct(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?Ve(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=K(r);if((d||!d&&!a)&&((Ne(r)!==`body`||Le(o))&&(c=Xe(r)),K(r))){let e=Y(r);l=nt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?st(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function lt(e){return Array.from(e.getClientRects())}function ut(e){let t=W(e),n=Xe(e),r=e.ownerDocument.body,i=N(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=N(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+ot(e),s=-n.scrollTop;return q(r).direction===`rtl`&&(o+=N(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var dt=25;function ft(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=qe();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=ot(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=dt&&(a-=o)}else l<=dt&&(a+=l);return{width:a,height:o,x:s,y:c}}var pt=new Set([`absolute`,`fixed`]);function mt(e,t){let n=Y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?nt(e):I(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ht(e,t,n){let r;if(t===`viewport`)r=ft(e,n);else if(t===`document`)r=ut(W(e));else if(G(t))r=mt(t,n);else{let n=it(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function gt(e,t){let n=J(e);return n===t||!G(n)||Ye(n)?!1:q(n).position===`fixed`||gt(n,t)}function _t(e,t){let n=t.get(e);if(n)return n;let r=Qe(e,[],!1).filter(e=>G(e)&&Ne(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;G(o)&&!Ye(o);){let t=q(o),n=Ge(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&pt.has(i.position)||Le(o)&&!n&&gt(e,o))?r=r.filter(e=>e!==o):i=t,o=J(o)}return t.set(e,r),r}function vt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ve(t)?[]:_t(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=ht(t,n,i);return e.top=N(r.top,e.top),e.right=M(r.right,e.right),e.bottom=M(r.bottom,e.bottom),e.left=N(r.left,e.left),e},ht(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function yt(e){let{width:t,height:n}=et(e);return{width:t,height:n}}function bt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);function l(){c.x=ot(i)}if(r||!r&&!a)if((Ne(t)!==`body`||Le(i))&&(s=Xe(t)),r){let e=Y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?st(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xt(e){return q(e).position===`static`}function St(e,t){if(!K(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Ct(e,t){let n=U(e);if(Ve(e))return n;if(!K(e)){let t=J(e);for(;t&&!Ye(t);){if(G(t)&&!xt(t))return t;t=J(t)}return n}let r=St(e,t);for(;r&&ze(r)&&xt(r);)r=St(r,t);return r&&Ye(r)&&xt(r)&&!Ge(r)?n:r||Ke(e)||n}var wt=async function(e){let t=this.getOffsetParent||Ct,n=this.getDimensions,r=await n(e.floating);return{reference:bt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tt(e){return q(e).direction===`rtl`}var Et={convertOffsetParentRelativeRectToViewportRelativeRect:ct,getDocumentElement:W,getClippingRect:vt,getOffsetParent:Ct,getElementRects:wt,getClientRects:lt,getDimensions:yt,getScale:nt,isElement:G,isRTL:Tt};function Dt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ot(e,t){let n=null,r,i=W(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=F(d),h=F(i.clientWidth-(u+f)),g=F(i.clientHeight-(d+p)),_=F(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:N(0,M(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tt(e),u=i||a?[...l?Qe(l):[],...Qe(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ot(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Y(e):null;c&&g();function g(){let t=Y(e);h&&!Dt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var At=Oe,jt=ke,Mt=Se,Nt=je,Pt=Te,Ft=xe,It=Ae,Lt=(e,t,n)=>{let r=new Map,i={platform:Et,...n},a={...i.platform,_c:r};return be(e,t,{...i,platform:a})},Rt=t(o(),1),zt=typeof document<`u`?E.useLayoutEffect:function(){};function Bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Vt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ht(e,t){let n=Vt(e);return Math.round(t*n)/n}function Ut(e){let t=E.useRef(e);return zt(()=>{t.current=e}),t}function Wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=E.useState(r);Bt(f,r)||p(r);let[m,h]=E.useState(null),[g,_]=E.useState(null),v=E.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=E.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=E.useRef(null),C=E.useRef(null),w=E.useRef(u),T=c!=null,D=Ut(c),O=Ut(i),k=Ut(l),A=E.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Lt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Bt(w.current,t)&&(w.current=t,Rt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);zt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=E.useRef(!1);zt(()=>(j.current=!0,()=>{j.current=!1}),[]),zt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,T]);let M=E.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=E.useMemo(()=>({reference:b,floating:x}),[b,x]),P=E.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ht(N.floating,u.x),r=Ht(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Vt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ft({element:r.current,padding:i}).fn(n):r?Ft({element:r,padding:i}).fn(n):{}}}},Kt=(e,t)=>({...At(e),options:[e,t]}),qt=(e,t)=>({...jt(e),options:[e,t]}),Jt=(e,t)=>({...It(e),options:[e,t]}),Yt=(e,t)=>({...Mt(e),options:[e,t]}),Xt=(e,t)=>({...Nt(e),options:[e,t]}),Zt=(e,t)=>({...Pt(e),options:[e,t]}),Qt=(e,t)=>({...Gt(e),options:[e,t]}),$t=`Arrow`,en=E.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,D.jsx)(c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,D.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});en.displayName=$t;var tn=en,nn=`Popper`,[rn,an]=a(nn),[on,sn]=rn(nn),cn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=E.useState(null);return(0,D.jsx)(on,{scope:t,anchor:r,onAnchorChange:i,children:n})};cn.displayName=nn;var ln=`PopperAnchor`,un=E.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=sn(ln,n),s=E.useRef(null),l=r(t,s),u=E.useRef(null);return E.useEffect(()=>{let e=u.current;u.current=i?.current||s.current,e!==u.current&&o.onAnchorChange(u.current)}),i?null:(0,D.jsx)(c.div,{...a,ref:l})});un.displayName=ln;var dn=`PopperContent`,[fn,pn]=rn(dn),mn=E.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=sn(dn,n),[x,S]=E.useState(null),w=r(t,e=>S(e)),[T,O]=E.useState(null),k=C(T),A=k?.width??0,j=k?.height??0,M=i+(o===`center`?``:`-`+o),N=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},P=Array.isArray(f)?f:[f],F=P.length>0,I={padding:N,boundary:P.filter(vn),altBoundary:F},{refs:ee,floatingStyles:te,placement:ne,isPositioned:L,middlewareData:R}=Wt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>kt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[Kt({mainAxis:a+j,alignmentAxis:l}),d&&qt({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?Jt():void 0,...I}),d&&Yt({...I}),Xt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Qt({element:T,padding:u}),yn({arrowWidth:A,arrowHeight:j}),g&&Zt({strategy:`referenceHidden`,...I})]}),[z,B]=bn(ne),V=h(v);s(()=>{L&&V?.()},[L,V]);let re=R.arrow?.x,H=R.arrow?.y,ie=R.arrow?.centerOffset!==0,[ae,oe]=E.useState();return s(()=>{x&&oe(window.getComputedStyle(x).zIndex)},[x]),(0,D.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:L?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,D.jsx)(fn,{scope:n,placedSide:z,onArrowChange:O,arrowX:re,arrowY:H,shouldHideArrow:ie,children:(0,D.jsx)(c.div,{"data-side":z,"data-align":B,...y,ref:w,style:{...y.style,animation:L?void 0:`none`}})})})});mn.displayName=dn;var hn=`PopperArrow`,gn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_n=E.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pn(hn,n),a=gn[i.placedSide];return(0,D.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,D.jsx)(tn,{...r,ref:t,style:{...r.style,display:`block`}})})});_n.displayName=hn;function vn(e){return e!==null}var yn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xn=cn,Sn=un,Cn=mn,wn=_n,Tn=[` `,`Enter`,`ArrowUp`,`ArrowDown`],En=[` `,`Enter`],X=`Select`,[Dn,On,kn]=f(X),[An,jn]=a(X,[kn,an]),Mn=an(),[Nn,Z]=An(X),[Pn,Fn]=An(X),In=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:h,required:g,form:_}=e,v=Mn(t),[y,b]=E.useState(null),[x,S]=E.useState(null),[C,w]=E.useState(!1),T=p(l),[O,k]=u({prop:r,defaultProp:i??!1,onChange:a,caller:X}),[A,j]=u({prop:o,defaultProp:s,onChange:c,caller:X}),M=E.useRef(null),N=y?_||!!y.closest(`form`):!0,[P,F]=E.useState(new Set),I=Array.from(P).map(e=>e.props.value).join(`;`);return(0,D.jsx)(xn,{...v,children:(0,D.jsxs)(Nn,{required:g,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:A,onValueChange:j,open:O,onOpenChange:k,dir:T,triggerPointerDownPosRef:M,disabled:h,children:[(0,D.jsx)(Dn.Provider,{scope:t,children:(0,D.jsx)(Pn,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(e=>{F(t=>new Set(t).add(e))},[]),onNativeOptionRemove:E.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),N?(0,D.jsxs)(kr,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:e=>j(e.target.value),disabled:h,form:_,children:[A===void 0?(0,D.jsx)(`option`,{value:``}):null,Array.from(P)]},I):null]})})};In.displayName=X;var Ln=`SelectTrigger`,Rn=E.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...a}=e,o=Mn(n),s=Z(Ln,n),u=s.disabled||i,d=r(t,s.onTriggerChange),f=On(n),p=E.useRef(`touch`),[m,h,g]=jr(e=>{let t=f().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),_=e=>{u||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,D.jsx)(Sn,{asChild:!0,...o,children:(0,D.jsx)(c.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:u,"data-disabled":u?``:void 0,"data-placeholder":Ar(s.value)?``:void 0,...a,ref:d,onClick:l(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:l(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:l(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&Tn.includes(e.key)&&(_(),e.preventDefault())})})})});Rn.displayName=Ln;var zn=`SelectValue`,Bn=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:l=``,...u}=e,d=Z(zn,n),{onValueNodeHasChildrenChange:f}=d,p=o!==void 0,m=r(t,d.onValueNodeChange);return s(()=>{f(p)},[f,p]),(0,D.jsx)(c.span,{...u,ref:m,style:{pointerEvents:`none`},children:Ar(d.value)?(0,D.jsx)(D.Fragment,{children:l}):o})});Bn.displayName=zn;var Vn=`SelectIcon`,Hn=E.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,D.jsx)(c.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Hn.displayName=Vn;var Un=`SelectPortal`,Wn=e=>(0,D.jsx)(_,{asChild:!0,...e});Wn.displayName=Un;var Gn=`SelectContent`,Kn=E.forwardRef((e,t)=>{let n=Z(Gn,e.__scopeSelect),[r,i]=E.useState();if(s(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Rt.createPortal((0,D.jsx)(qn,{scope:e.__scopeSelect,children:(0,D.jsx)(Dn.Slot,{scope:e.__scopeSelect,children:(0,D.jsx)(`div`,{children:e.children})})}),t):null}return(0,D.jsx)(Xn,{...e,ref:t})});Kn.displayName=Gn;var Q=10,[qn,$]=An(Gn),Jn=`SelectContentImpl`,Yn=n(`SelectContent.RemoveScroll`),Xn=E.forwardRef((e,t)=>{let{__scopeSelect:n,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=Z(Gn,n),[O,k]=E.useState(null),[A,j]=E.useState(null),M=r(t,e=>k(e)),[N,P]=E.useState(null),[F,I]=E.useState(null),ee=On(n),[te,ne]=E.useState(!1),L=E.useRef(!1);E.useEffect(()=>{if(O)return x(O)},[O]),b();let R=E.useCallback(e=>{let[t,...n]=ee().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&A&&(A.scrollTop=0),n===r&&A&&(A.scrollTop=A.scrollHeight),n?.focus(),document.activeElement!==i))return},[ee,A]),z=E.useCallback(()=>R([N,O]),[R,N,O]);E.useEffect(()=>{te&&z()},[te,z]);let{onOpenChange:B,triggerPointerDownPosRef:V}=T;E.useEffect(()=>{if(O){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(V.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():O.contains(n.target)||B(!1),document.removeEventListener(`pointermove`,t),V.current=null};return V.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[O,B,V]),E.useEffect(()=>{let e=()=>B(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[B]);let[re,H]=jr(e=>{let t=ee().filter(e=>!e.disabled),n=Mr(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(P(e),r&&(L.current=!0))},[T.value]),ae=E.useCallback(()=>O?.focus(),[O]),oe=E.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&I(e)},[T.value]),se=i===`popper`?er:Qn,ce=se===er?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:S,avoidCollisions:C}:{};return(0,D.jsx)(qn,{scope:n,content:O,viewport:A,onViewportChange:j,itemRefCallback:ie,selectedItem:N,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:z,selectedItemText:F,position:i,isPositioned:te,searchRef:re,children:(0,D.jsx)(v,{as:Yn,allowPinchZoom:!0,children:(0,D.jsx)(g,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,D.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,D.jsx)(se,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ce,onPlaced:()=>ne(!0),ref:M,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:l(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&H(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=ee().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})});Xn.displayName=Jn;var Zn=`SelectItemAlignedPosition`,Qn=E.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,o=Z(Gn,n),l=$(Gn,n),[u,d]=E.useState(null),[f,p]=E.useState(null),m=r(t,e=>p(e)),h=On(n),g=E.useRef(!1),_=E.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,S=E.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&f&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-Q,d=w(a,[Q,Math.max(Q,l-c)]);u.style.minWidth=s+`px`,u.style.right=d+`px`}let a=h(),s=window.innerHeight-Q*2,c=v.scrollHeight,l=window.getComputedStyle(f),d=parseInt(l.borderTopWidth,10),p=parseInt(l.paddingTop,10),m=parseInt(l.borderBottomWidth,10),_=parseInt(l.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),T=parseInt(C.paddingTop,10),E=parseInt(C.paddingBottom,10),D=e.top+e.height/2-Q,O=s-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;u.style.bottom=`0px`;let t=f.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);u.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;u.style.top=`0px`;let t=Math.max(D,d+v.offsetTop+(e?T:0)+k)+M;u.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}u.style.margin=`${Q}px 0`,u.style.minHeight=S+`px`,u.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,u,f,v,y,b,o.dir,i]);s(()=>S(),[S]);let[C,T]=E.useState();return s(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]),(0,D.jsx)(tr,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:E.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,D.jsx)(`div`,{ref:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,D.jsx)(c.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Qn.displayName=Zn;var $n=`SelectPopperPosition`,er=E.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Q,...a}=e,o=Mn(n);return(0,D.jsx)(Cn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});er.displayName=$n;var[tr,nr]=An(Gn,{}),rr=`SelectViewport`,ir=E.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:i,...a}=e,o=$(rr,n),s=nr(rr,n),u=r(t,o.onViewportChange),d=E.useRef(0);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,D.jsx)(Dn.Slot,{scope:n,children:(0,D.jsx)(c.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:u,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:l(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(d.current-t.scrollTop);if(e>0){let r=window.innerHeight-Q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}d.current=t.scrollTop})})})]})});ir.displayName=rr;var ar=`SelectGroup`,[or,sr]=An(ar),cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=m();return(0,D.jsx)(or,{scope:n,id:i,children:(0,D.jsx)(c.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});cr.displayName=ar;var lr=`SelectLabel`,ur=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=sr(lr,n);return(0,D.jsx)(c.div,{id:i.id,...r,ref:t})});ur.displayName=lr;var dr=`SelectItem`,[fr,pr]=An(dr),mr=E.forwardRef((e,t)=>{let{__scopeSelect:n,value:i,disabled:a=!1,textValue:o,...s}=e,u=Z(dr,n),d=$(dr,n),f=u.value===i,[p,h]=E.useState(o??``),[g,_]=E.useState(!1),v=r(t,e=>d.itemRefCallback?.(e,i,a)),y=m(),b=E.useRef(`touch`),x=()=>{a||(u.onValueChange(i),u.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,D.jsx)(fr,{scope:n,value:i,disabled:a,textId:y,isSelected:f,onItemTextChange:E.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,D.jsx)(Dn.ItemSlot,{scope:n,value:i,disabled:a,textValue:p,children:(0,D.jsx)(c.div,{role:`option`,"aria-labelledby":y,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:l(s.onFocus,()=>_(!0)),onBlur:l(s.onBlur,()=>_(!1)),onClick:l(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:l(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:l(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:l(s.onPointerMove,e=>{b.current=e.pointerType,a?d.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:l(s.onKeyDown,e=>{d.searchRef?.current!==``&&e.key===` `||(En.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});mr.displayName=dr;var hr=`SelectItemText`,gr=E.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...o}=e,l=Z(hr,n),u=$(hr,n),d=pr(hr,n),f=Fn(hr,n),[p,m]=E.useState(null),h=r(t,e=>m(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,_=E.useMemo(()=>(0,D.jsx)(`option`,{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=f;return s(()=>(v(_),()=>y(_)),[v,y,_]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c.span,{id:d.textId,...o,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Rt.createPortal(o.children,l.valueNode):null]})});gr.displayName=hr;var _r=`SelectItemIndicator`,vr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return pr(_r,n).isSelected?(0,D.jsx)(c.span,{"aria-hidden":!0,...r,ref:t}):null});vr.displayName=_r;var yr=`SelectScrollUpButton`,br=E.forwardRef((e,t)=>{let n=$(yr,e.__scopeSelect),i=nr(yr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});br.displayName=yr;var xr=`SelectScrollDownButton`,Sr=E.forwardRef((e,t)=>{let n=$(xr,e.__scopeSelect),i=nr(xr,e.__scopeSelect),[a,o]=E.useState(!1),c=r(t,i.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,D.jsx)(Cr,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Sr.displayName=xr;var Cr=E.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$(`SelectScrollButton`,n),o=E.useRef(null),u=On(n),d=E.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),s(()=>{u().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[u]),(0,D.jsx)(c.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:l(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:l(i.onPointerLeave,()=>{d()})})}),wr=`SelectSeparator`,Tr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,D.jsx)(c.div,{"aria-hidden":!0,...r,ref:t})});Tr.displayName=wr;var Er=`SelectArrow`,Dr=E.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Mn(n),a=Z(Er,n),o=$(Er,n);return a.open&&o.position===`popper`?(0,D.jsx)(wn,{...i,...r,ref:t}):null});Dr.displayName=Er;var Or=`SelectBubbleInput`,kr=E.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let a=E.useRef(null),o=r(i,a),s=S(t);return E.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,D.jsx)(c.select,{...n,style:{...O,...n.style},ref:o,defaultValue:t})});kr.displayName=Or;function Ar(e){return e===``||e===void 0}function jr(e){let t=h(e),n=E.useRef(``),r=E.useRef(0),i=E.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=E.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Mr(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Nr(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Nr(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Pr=In,Fr=Rn,Ir=Bn,Lr=Hn,Rr=Wn,zr=Kn,Br=ir,Vr=cr,Hr=mr,Ur=gr,Wr=vr,Gr=Pr,Kr=Vr,qr=Ir,Jr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Fr,{ref:r,className:Zr(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,D.jsx)(Lr,{asChild:!0,children:(0,D.jsx)(d,{className:`h-4 w-4 opacity-50`})})]}));Jr.displayName=Fr.displayName;var Yr=E.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,D.jsx)(Rr,{children:(0,D.jsx)(zr,{ref:i,className:Zr(`relative z-[100] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:(0,D.jsx)(Br,{className:Zr(`p-1`,n===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));Yr.displayName=zr.displayName;var Xr=E.forwardRef(({className:e,children:t,...n},r)=>(0,D.jsxs)(Hr,{ref:r,className:Zr(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,D.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,D.jsx)(Wr,{children:(0,D.jsx)(T,{className:`h-4 w-4`})})}),(0,D.jsx)(Ur,{children:t})]}));Xr.displayName=Hr.displayName;function Zr(...e){return e.filter(Boolean).join(` `)}export{Jr as a,Xr as i,Yr as n,qr as o,Kr as r,Gr as t};
@@ -1 +1 @@
1
- import{a as e,f as t,l as n,t as r,u as i}from"./button-BTToMaBW.js";import"./dist-C6eaYCUo.js";import{t as a}from"./circle-alert-Q8cZk9Rv.js";import{t as o}from"./circle-x-C9USji_R.js";import{t as s}from"./plus-tVxSydJ8.js";import{t as ee}from"./refresh-cw-CG3HaiQT.js";import{t as te}from"./rotate-ccw-CAYM6Vv0.js";import{t as c}from"./smartphone-DKeDuJTU.js";import{a as ne,i as l,n as re,o as ie,r as ae,t as oe}from"./select-CH0aJ3Dd.js";import"./es2015-CfXu88Y7.js";import{t as se}from"./switch-C-Xk56TK.js";import{a as u,c as ce,l as le,n as ue,o as d,r as f,s as de,t as fe}from"./ai-config-store-DQXVJVn_.js";import{$ as p,A as m,B as pe,G as me,H as he,J as ge,O as h,U as g,V as _,X as _e,Z as ve,_ as ye,at as be,b as v,c as xe,d as Se,f as Ce,g as we,h as Te,it as Ee,k as y,l as b,lt as x,m as S,mt as De,o as Oe,p as C,pt as w,s as ke,u as T,v as Ae,y as je,z as E}from"./index-DTeCUv1G.js";import{n as Me,r as Ne,t as Pe}from"./alert-COF-DIAE.js";var Fe=n(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ie=n(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Le=n(`stethoscope`,[[`path`,{d:`M11 2v2`,key:`1539x4`}],[`path`,{d:`M5 2v2`,key:`1yf1q8`}],[`path`,{d:`M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1`,key:`rb5t3r`}],[`path`,{d:`M8 15a6 6 0 0 0 12 0v-3`,key:`x18d4x`}],[`circle`,{cx:`20`,cy:`10`,r:`2`,key:`ts1r5v`}]]),D=t(i(),1),O=e(),Re=[{value:`75`,label:`75%`,scale:.75},{value:`90`,label:`90%`,scale:.9},{value:`100`,label:`100%`,scale:1},{value:`110`,label:`110%`,scale:1.1},{value:`125`,label:`125%`,scale:1.25},{value:`150`,label:`150%`,scale:1.5}],ze=[{value:`auto`,label:`自动`,color:`linear-gradient(135deg, oklch(0.623 0.214 259.815), oklch(0.606 0.25 292.717))`},{value:`neutral`,label:`中性`,color:`oklch(0.556 0 0)`},{value:`blue`,label:`蓝色`,color:`oklch(0.623 0.214 259.815)`},{value:`violet`,label:`紫色`,color:`oklch(0.606 0.25 292.717)`},{value:`green`,label:`绿色`,color:`oklch(0.627 0.194 149.214)`},{value:`orange`,label:`橙色`,color:`oklch(0.646 0.222 41.116)`},{value:`rose`,label:`玫红`,color:`oklch(0.645 0.246 16.439)`}],k=`app-panel-content mt-0`,A=`app-field-group`,j=`app-section`,M=e=>{if(!e)return`100`;let t={small:`90`,medium:`100`,large:`110`};return e in t?t[e]:Re.some(t=>t.value===e)?e:`100`};function Be({open:e=!1,onOpenChange:t,embedded:n=!1}){let{theme:i,accentColor:Be,setTheme:Ve,setAccentColor:He,setZoom:N}=Oe(),[P,Ue]=(0,D.useState)(`preferences`),[F,I]=(0,D.useState)(()=>f()),[L,We]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(null),[Ge,H]=(0,D.useState)(``),[U,W]=(0,D.useState)(null),[G,Ke]=(0,D.useState)(``),[qe,Je]=(0,D.useState)([]),[K,q]=(0,D.useState)({}),[J,Ye]=(0,D.useState)(``),[Y,Xe]=(0,D.useState)(``),[X,Z]=(0,D.useState)(null),[Ze,Qe]=(0,D.useState)(!1),[Q,$e]=(0,D.useState)(()=>M(ke().fontSize)),[et,tt]=(0,D.useState)(!1);(0,D.useEffect)(()=>{xe().then(e=>{let t=M(e.fontSize);$e(t),N(parseInt(t,10)/100),tt(!0)}).catch(()=>{tt(!0)})},[N]),(0,D.useEffect)(()=>{if(!et)return;let e=M(Q);N(parseInt(e,10)/100),b({fontSize:e}).catch(console.error)},[N,et,Q]),(0,D.useEffect)(()=>{(e||n)&&(xe().then(e=>{I(e.aiConfig),Ke(e.mocksFilePath||``),q(e.clientAliases||{})}).catch(()=>{I(f())}),V(null),H(``),fetch(`/api/rule-files`).then(e=>e.json()).then(e=>{Array.isArray(e)&&Je(e)}).catch(()=>{}))},[e,n]);let nt=e=>{let t=u(e);I({...F,provider:e,baseUrl:t.baseUrl,model:t.model})},rt=async()=>{z(!0);try{await b({aiConfig:F}),ce(F),V(`success`),H(`AI 配置保存成功`),T.success(`AI 配置保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},it=()=>{de(),I(f()),V(null),H(``)},at=async()=>{if(!d(F)){V(`error`),H(`请填写完整的配置信息`);return}z(!0),V(null),H(`测试中...`);try{let e=F.baseUrl,t={"Content-Type":`application/json`},n;F.provider===`anthropic`?(t[`x-api-key`]=F.apiKey,t[`anthropic-version`]=`2023-06-01`,n={model:F.model,max_tokens:100,system:`You are a helpful assistant.`,messages:[{role:`user`,content:`Say "test successful"`}],temperature:.3}):(t.Authorization=`Bearer ${F.apiKey}`,n={model:F.model,messages:[{role:`system`,content:`You are a helpful assistant.`},{role:`user`,content:`Say "test successful"`}],temperature:.3,max_tokens:100});let r=await fetch(e,{method:`POST`,headers:t,body:JSON.stringify(n)});if(!r.ok){let e=await r.text();throw Error(`API错误 (${r.status}): ${e}`)}let i=await r.json();if(F.provider===`anthropic`){if(!i.content?.[0]?.text)throw Error(`API响应格式不正确`)}else if(!i.choices?.[0]?.message?.content)throw Error(`API响应格式不正确`);V(`success`),H(`连接测试成功! API配置正常`)}catch(e){V(`error`),H(e instanceof Error?e.message:`测试失败`)}finally{z(!1)}},ot=(0,D.useCallback)(async()=>{try{let e=await fetch(`/api/refresh-config`,{method:`POST`});if(e.ok){let t=await e.json();V(`success`),H(t.message||`配置已刷新`),setTimeout(()=>{V(null),H(``)},2e3)}else{let t=await e.json();V(`error`),H(t.error||`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}}catch(e){console.error(`刷新配置失败:`,e),V(`error`),H(`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}},[]),st=(0,D.useCallback)(async()=>{Qe(!0),Z(null);try{let e=await fetch(`/api/config-doctor`);e.ok?Z(await e.json()):(V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3))}catch(e){console.error(`诊断失败:`,e),V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3)}finally{Qe(!1)}},[]),ct=()=>{let e=J.trim(),t=Y.trim();!e||!t||(q(n=>({...n,[e]:t})),Ye(``),Xe(``))},lt=async()=>{z(!0);try{await b({clientAliases:K}),V(`success`),H(`客户端名称已保存,新请求立即生效`),T.success(`客户端名称保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},ut=async()=>{z(!0);try{await b({mocksFilePath:G}),V(`success`),H(`Mock 文件路径已更新,刷新页面后生效`),T.success(`Mock 文件路径保存成功`),setTimeout(()=>{V(null),H(``)},3e3)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}};Se({active:(e||n)&&P!==`preferences`,enabled:!R,priority:Ce.panel,onSave:()=>{if(P===`config`)return ut();if(P===`clients`)return lt();if(P===`ai`)return rt()}});let $=(0,O.jsxs)(O.Fragment,{children:[!n&&(0,O.jsxs)(Ae,{className:`px-6 pt-6 pb-4`,children:[(0,O.jsxs)(je,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ve,{className:`h-5 w-5`}),`系统设置`]}),(0,O.jsx)(ye,{children:`管理系统偏好、配置和 AI 功能`})]}),(0,O.jsxs)(pe,{value:P,onValueChange:e=>Ue(e),orientation:`vertical`,className:`min-h-0 flex-1 gap-0`,children:[(0,O.jsxs)(he,{"aria-label":`设置分类`,className:`h-full w-14 shrink-0 self-stretch justify-start gap-1 rounded-none border-r bg-muted/25 p-2 group-data-[orientation=vertical]/tabs:!h-full sm:w-44 sm:p-3`,children:[(0,O.jsxs)(g,{value:`preferences`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(ve,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`偏好设置`})]}),(0,O.jsxs)(g,{value:`config`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(x,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`配置文件`})]}),(0,O.jsxs)(g,{value:`clients`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(c,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`客户端`})]}),(0,O.jsxs)(g,{value:`ai`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(_e,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`AI 配置`})]})]}),(0,O.jsxs)(_,{value:`preferences`,className:k,children:[(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`主题`}),(0,O.jsxs)(oe,{value:i,onValueChange:e=>Ve(e),children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择主题`})}),(0,O.jsx)(re,{children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(l,{value:`system`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(be,{className:`size-4`}),`跟随系统`]})}),(0,O.jsx)(l,{value:`light`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ge,{className:`size-4`}),`浅色模式`]})}),(0,O.jsx)(l,{value:`dark`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(Ee,{className:`size-4`}),`深色模式`]})})]})})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`强调色`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`统一按钮、状态、选中项和焦点样式。自动模式会根据明暗主题选择合适的颜色。`})]}),(0,O.jsx)(h,{type:`single`,value:Be,onValueChange:e=>{e&&He(e)},variant:`outline`,spacing:1,className:`flex-wrap justify-start`,"aria-label":`强调色`,children:ze.map(e=>(0,O.jsxs)(y,{value:e.value,"aria-label":e.label,children:[e.value===`auto`?(0,O.jsx)(_e,{"data-icon":`inline-start`}):(0,O.jsx)(`span`,{className:`size-3 rounded-full border border-foreground/10`,style:{background:e.color}}),e.label]},e.value))})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`缩放比例`}),(0,O.jsxs)(oe,{value:Q,onValueChange:$e,children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择缩放比例`})}),(0,O.jsx)(re,{children:(0,O.jsx)(ae,{children:Re.map(e=>(0,O.jsx)(l,{value:e.value,children:e.label},e.value))})})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`关于`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Meddle - HTTP 调试代理工具`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`版本: 1.0.0`})]})]}),(0,O.jsxs)(_,{value:`config`,className:k,children:[(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`路由规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(x,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:`~/.meddle/route-rules/`})]}),qe.length>0?(0,O.jsx)(`div`,{className:`space-y-2`,children:qe.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-sm`,children:[(0,O.jsx)(E,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.enabled?`已启用`:`未启用`}),(0,O.jsxs)(`span`,{className:`flex-1 truncate text-xs`,children:[e.name,`.txt`]}),(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.ruleCount,` 条规则`]})]},e.name))}):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`暂无规则文件`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`规则文件存放于 ~/.meddle/route-rules/ 目录,纯文本格式。在"路由规则"页面管理。`})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`Mock 规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(x,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:G||`默认: ~/.meddle/mocks.json`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`mocksPath`,className:`text-xs text-muted-foreground`,children:`自定义 Mock 规则文件路径(留空使用默认)`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{id:`mocksPath`,value:G,onChange:e=>Ke(e.target.value),placeholder:`如: /path/to/my-mocks.json`,className:`flex-1 h-8 text-sm font-mono`}),(0,O.jsxs)(C,{variant:`outline`,size:`sm`,onClick:ut,disabled:R,className:`h-8`,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-3 w-3`}),`应用`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`必须是 JSON 格式的 Mock 规则文件`})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`操作`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:ot,children:[(0,O.jsx)(ee,{className:`h-4 w-4 mr-1`}),`重新加载配置`]}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:st,disabled:Ze,children:[(0,O.jsx)(Le,{className:`h-4 w-4 mr-1`}),Ze?`诊断中...`:`诊断配置`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`点击重新加载可应用修改后的配置文件,点击诊断配置可检查配置有效性`})]}),X&&(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h3`,{className:`mb-4 flex items-center gap-2 text-sm font-medium`,children:[(0,O.jsx)(Le,{className:`h-4 w-4`}),`诊断结果`]}),(0,O.jsxs)(`div`,{className:`mb-3 p-3 rounded-md border ${X.status===`ok`?`bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900`:X.status===`warning`?`bg-yellow-50 dark:bg-yellow-950/20 border-yellow-200 dark:border-yellow-900`:`bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900`}`,children:[X.status===`ok`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(w,{className:`h-5 w-5 text-green-600 dark:text-green-400`}),(0,O.jsx)(`span`,{className:`text-sm font-medium text-green-700 dark:text-green-300`,children:`所有检查通过!配置正常。`})]}),X.status===`warning`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(a,{className:`h-5 w-5 text-yellow-600 dark:text-yellow-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-300`,children:[`发现 `,X.warnings.length,` 个警告`]})]}),X.status===`error`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(o,{className:`h-5 w-5 text-red-600 dark:text-red-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-red-700 dark:text-red-300`,children:[`发现 `,X.errors.length,` 个错误`]})]})]}),(0,O.jsx)(`div`,{className:A,children:X.checks.map((e,t)=>(0,O.jsx)(`div`,{className:`p-2 rounded border bg-card`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(w,{className:`h-4 w-4 text-green-600 dark:text-green-400 mt-0.5 shrink-0`}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.path}),e.details&&(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.details.totalFiles!==void 0&&`${e.details.enabledFiles}/${e.details.totalFiles} 个文件已启用`,e.details.totalRules!==void 0&&` · ${e.details.totalRules} 条规则`,e.details.rules!==void 0&&`${e.details.rules} 条规则`,e.details.total!==void 0&&`${e.details.total} 条规则 (${e.details.enabled} 已启用)`,e.details.size!==void 0&&` · ${e.details.size} bytes`]})]})]})},t))}),X.warnings&&X.warnings.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-yellow-700 dark:text-yellow-300`,children:`警告:`}),X.warnings.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-yellow-600 dark:text-yellow-400`,children:[(0,O.jsx)(a,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]}),X.errors&&X.errors.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-red-700 dark:text-red-300`,children:`错误:`}),X.errors.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-red-600 dark:text-red-400`,children:[(0,O.jsx)(o,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]})]})]})]}),(0,O.jsxs)(_,{value:`clients`,className:k,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,O.jsx)(c,{className:`h-4 w-4`}),`远程客户端名称`]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`将日志中的客户端 IP 映射为设备名称。保存后新请求立即生效,无需重启代理。`})]}),(0,O.jsx)(`div`,{className:A,children:Object.entries(K).length===0?(0,O.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-center text-xs text-muted-foreground`,children:`尚未配置设备名称`}):Object.entries(K).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{value:e,readOnly:!0,className:`h-8 flex-1 font-mono text-xs bg-muted/40`,"aria-label":`客户端 IP ${e}`}),(0,O.jsx)(m,{value:t,onChange:t=>{let n=t.target.value;q(t=>({...t,[e]:n}))},className:`h-8 flex-1 text-sm`,"aria-label":`${e} 的设备名称`}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>{q(t=>{let n={...t};return delete n[e],n})},title:`删除设备名称`,children:(0,O.jsx)(me,{className:`h-4 w-4`})})]},e))}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`添加设备`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{value:J,onChange:e=>Ye(e.target.value),placeholder:`客户端 IP,例如 10.13.232.187`,className:`h-8 flex-1 font-mono text-xs`}),(0,O.jsx)(m,{value:Y,onChange:e=>Xe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ct()},placeholder:`设备名称,例如 iPhone`,className:`h-8 flex-1 text-sm`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-8`,onClick:ct,disabled:!J.trim()||!Y.trim(),children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加`]})]})]}),(0,O.jsxs)(C,{onClick:lt,disabled:R,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存客户端名称`]})]}),(0,O.jsxs)(_,{value:`ai`,className:k,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`启用 AI 功能`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`启用智能代码修复功能`})]}),(0,O.jsx)(se,{checked:F.enabled,onCheckedChange:e=>I({...F,enabled:e}),"aria-label":`启用 AI 功能`})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`AI 模型配置`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>{W({name:``,provider:`openai`,apiKey:``,baseUrl:`https://api.openai.com/v1/chat/completions`,model:`gpt-4o-mini`})},children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加模型`]})]}),(0,O.jsx)(`div`,{className:A,children:F.models&&F.models.length>0?F.models.map(e=>(0,O.jsx)(`div`,{className:`p-3 rounded-md border ${F.activeModelId===e.id?`border-primary bg-primary/5`:`border-border`}`,children:(0,O.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),F.activeModelId===e.id&&(0,O.jsx)(E,{variant:`default`,className:`text-xs`,children:`当前使用`})]}),(0,O.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.provider===`openai`?`OpenAI`:`Anthropic`,` - `,e.model]})]}),(0,O.jsxs)(`div`,{className:`flex gap-1`,children:[F.activeModelId!==e.id&&(0,O.jsxs)(r,{variant:`ghost`,size:`sm`,onClick:()=>I(le(F,e.id)),className:`h-7 text-xs`,children:[(0,O.jsx)(De,{className:`h-3 w-3 mr-1`}),`使用`]}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>I(ue(F,e.id)),className:`h-7 w-7 p-0 text-destructive`,children:(0,O.jsx)(me,{className:`h-3 w-3`})})]})]})},e.id)):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground italic py-4 text-center`,children:`暂无模型配置,点击"添加模型"创建`})}),U&&(0,O.jsxs)(`div`,{className:`space-y-5 rounded-md border border-primary bg-primary/5 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`新增模型`}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>W(null),className:`h-6 w-6 p-0`,children:(0,O.jsx)(o,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelName`,className:`text-xs`,children:`模型名称`}),(0,O.jsx)(m,{id:`newModelName`,value:U.name||``,onChange:e=>W({...U,name:e.target.value}),placeholder:`如:GPT-4o Mini`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-xs`,children:`服务商`}),(0,O.jsxs)(h,{type:`single`,value:U.provider,onValueChange:e=>{if(e===`openai`){let e=u(`openai`);W({...U,provider:`openai`,baseUrl:e.baseUrl,model:e.model})}else if(e===`anthropic`){let e=u(`anthropic`);W({...U,provider:`anthropic`,baseUrl:e.baseUrl,model:e.model})}},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(y,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(y,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelApiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsx)(m,{id:`newModelApiKey`,type:L?`text`:`password`,value:U.apiKey||``,onChange:e=>W({...U,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelModel`,className:`text-xs`,children:`模型`}),(0,O.jsx)(m,{id:`newModelModel`,value:U.model||``,onChange:e=>W({...U,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelBaseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(m,{id:`newModelBaseUrl`,value:U.baseUrl||``,onChange:e=>W({...U,baseUrl:e.target.value}),placeholder:`API 端点`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>W(null),className:`h-7 text-xs`,children:`取消`}),(0,O.jsxs)(r,{size:`sm`,onClick:()=>{U.name&&U.apiKey&&U.model&&U.baseUrl&&(I(fe(F,U)),W(null))},disabled:!U.name||!U.apiKey||!U.model||!U.baseUrl,className:`h-7 text-xs`,children:[(0,O.jsx)(s,{className:`h-3 w-3 mr-1`}),`添加`]})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`传统配置(向后兼容)`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`如果未配置多模型,将使用此配置`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-xs`,children:`AI 服务商`}),(0,O.jsxs)(h,{type:`single`,value:F.provider,onValueChange:e=>{(e===`openai`||e===`anthropic`)&&nt(e)},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(y,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(y,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`apiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{id:`apiKey`,type:L?`text`:`password`,value:F.apiKey,onChange:e=>I({...F,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`flex-1 h-8 text-sm`}),(0,O.jsx)(r,{variant:`outline`,size:`icon`,onClick:()=>We(!L),className:`h-8 w-8`,children:L?(0,O.jsx)(Fe,{className:`h-4 w-4`}):(0,O.jsx)(Ie,{className:`h-4 w-4`})})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`model`,className:`text-xs`,children:`模型`}),(0,O.jsx)(m,{id:`model`,value:F.model,onChange:e=>I({...F,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`baseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(m,{id:`baseUrl`,value:F.baseUrl,onChange:e=>I({...F,baseUrl:e.target.value}),placeholder:F.provider===`openai`?`https://api.openai.com/v1/chat/completions`:`https://api.anthropic.com/v1/messages`,className:`h-8 text-sm`})]}),Ge&&(0,O.jsxs)(Pe,{variant:B===`error`?`destructive`:`default`,children:[B===`success`?(0,O.jsx)(w,{}):B===`error`?(0,O.jsx)(o,{}):(0,O.jsx)(a,{}),(0,O.jsx)(Ne,{children:B===`success`?`操作成功`:B===`error`?`操作失败`:`处理中`}),(0,O.jsx)(Me,{children:Ge})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`flex justify-between`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:it,children:[(0,O.jsx)(te,{className:`h-4 w-4 mr-1`}),`重置`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`sm`,onClick:at,disabled:!d(F)||R,children:`测试连接`}),(0,O.jsxs)(C,{size:`sm`,onClick:rt,disabled:R,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存`]})]})]})]})]})]});return n?(0,O.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:$}):(0,O.jsx)(Te,{open:e,onOpenChange:t,children:(0,O.jsx)(we,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:600,storageKey:`settings-panel`,children:$})})}export{Be as SettingsPanel};
1
+ import{a as e,f as t,l as n,t as r,u as i}from"./button-BTToMaBW.js";import"./dist-C6eaYCUo.js";import{t as a}from"./circle-alert-Q8cZk9Rv.js";import{t as o}from"./circle-x-C9USji_R.js";import{t as s}from"./plus-tVxSydJ8.js";import{t as ee}from"./refresh-cw-CG3HaiQT.js";import{t as te}from"./rotate-ccw-CAYM6Vv0.js";import{t as c}from"./smartphone-DKeDuJTU.js";import{a as ne,i as l,n as re,o as ie,r as ae,t as oe}from"./select-DOK-k_l8.js";import"./es2015-CfXu88Y7.js";import{t as se}from"./switch-C-Xk56TK.js";import{a as u,c as ce,l as le,n as ue,o as d,r as f,s as de,t as fe}from"./ai-config-store-DQXVJVn_.js";import{$ as p,A as m,B as pe,G as me,H as he,J as ge,O as h,U as g,V as _,X as _e,Z as ve,_ as ye,at as be,b as v,c as xe,d as Se,f as Ce,g as we,h as Te,it as Ee,k as y,l as b,lt as x,m as S,mt as De,o as Oe,p as C,pt as w,s as ke,u as T,v as Ae,y as je,z as E}from"./index-DboWpNx1.js";import{n as Me,r as Ne,t as Pe}from"./alert-COF-DIAE.js";var Fe=n(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ie=n(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Le=n(`stethoscope`,[[`path`,{d:`M11 2v2`,key:`1539x4`}],[`path`,{d:`M5 2v2`,key:`1yf1q8`}],[`path`,{d:`M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1`,key:`rb5t3r`}],[`path`,{d:`M8 15a6 6 0 0 0 12 0v-3`,key:`x18d4x`}],[`circle`,{cx:`20`,cy:`10`,r:`2`,key:`ts1r5v`}]]),D=t(i(),1),O=e(),Re=[{value:`75`,label:`75%`,scale:.75},{value:`90`,label:`90%`,scale:.9},{value:`100`,label:`100%`,scale:1},{value:`110`,label:`110%`,scale:1.1},{value:`125`,label:`125%`,scale:1.25},{value:`150`,label:`150%`,scale:1.5}],ze=[{value:`auto`,label:`自动`,color:`linear-gradient(135deg, oklch(0.623 0.214 259.815), oklch(0.606 0.25 292.717))`},{value:`neutral`,label:`中性`,color:`oklch(0.556 0 0)`},{value:`blue`,label:`蓝色`,color:`oklch(0.623 0.214 259.815)`},{value:`violet`,label:`紫色`,color:`oklch(0.606 0.25 292.717)`},{value:`green`,label:`绿色`,color:`oklch(0.627 0.194 149.214)`},{value:`orange`,label:`橙色`,color:`oklch(0.646 0.222 41.116)`},{value:`rose`,label:`玫红`,color:`oklch(0.645 0.246 16.439)`}],k=`app-panel-content mt-0`,A=`app-field-group`,j=`app-section`,M=e=>{if(!e)return`100`;let t={small:`90`,medium:`100`,large:`110`};return e in t?t[e]:Re.some(t=>t.value===e)?e:`100`};function Be({open:e=!1,onOpenChange:t,embedded:n=!1}){let{theme:i,accentColor:Be,setTheme:Ve,setAccentColor:He,setZoom:N}=Oe(),[P,Ue]=(0,D.useState)(`preferences`),[F,I]=(0,D.useState)(()=>f()),[L,We]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(null),[Ge,H]=(0,D.useState)(``),[U,W]=(0,D.useState)(null),[G,Ke]=(0,D.useState)(``),[qe,Je]=(0,D.useState)([]),[K,q]=(0,D.useState)({}),[J,Ye]=(0,D.useState)(``),[Y,Xe]=(0,D.useState)(``),[X,Z]=(0,D.useState)(null),[Ze,Qe]=(0,D.useState)(!1),[Q,$e]=(0,D.useState)(()=>M(ke().fontSize)),[et,tt]=(0,D.useState)(!1);(0,D.useEffect)(()=>{xe().then(e=>{let t=M(e.fontSize);$e(t),N(parseInt(t,10)/100),tt(!0)}).catch(()=>{tt(!0)})},[N]),(0,D.useEffect)(()=>{if(!et)return;let e=M(Q);N(parseInt(e,10)/100),b({fontSize:e}).catch(console.error)},[N,et,Q]),(0,D.useEffect)(()=>{(e||n)&&(xe().then(e=>{I(e.aiConfig),Ke(e.mocksFilePath||``),q(e.clientAliases||{})}).catch(()=>{I(f())}),V(null),H(``),fetch(`/api/rule-files`).then(e=>e.json()).then(e=>{Array.isArray(e)&&Je(e)}).catch(()=>{}))},[e,n]);let nt=e=>{let t=u(e);I({...F,provider:e,baseUrl:t.baseUrl,model:t.model})},rt=async()=>{z(!0);try{await b({aiConfig:F}),ce(F),V(`success`),H(`AI 配置保存成功`),T.success(`AI 配置保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},it=()=>{de(),I(f()),V(null),H(``)},at=async()=>{if(!d(F)){V(`error`),H(`请填写完整的配置信息`);return}z(!0),V(null),H(`测试中...`);try{let e=F.baseUrl,t={"Content-Type":`application/json`},n;F.provider===`anthropic`?(t[`x-api-key`]=F.apiKey,t[`anthropic-version`]=`2023-06-01`,n={model:F.model,max_tokens:100,system:`You are a helpful assistant.`,messages:[{role:`user`,content:`Say "test successful"`}],temperature:.3}):(t.Authorization=`Bearer ${F.apiKey}`,n={model:F.model,messages:[{role:`system`,content:`You are a helpful assistant.`},{role:`user`,content:`Say "test successful"`}],temperature:.3,max_tokens:100});let r=await fetch(e,{method:`POST`,headers:t,body:JSON.stringify(n)});if(!r.ok){let e=await r.text();throw Error(`API错误 (${r.status}): ${e}`)}let i=await r.json();if(F.provider===`anthropic`){if(!i.content?.[0]?.text)throw Error(`API响应格式不正确`)}else if(!i.choices?.[0]?.message?.content)throw Error(`API响应格式不正确`);V(`success`),H(`连接测试成功! API配置正常`)}catch(e){V(`error`),H(e instanceof Error?e.message:`测试失败`)}finally{z(!1)}},ot=(0,D.useCallback)(async()=>{try{let e=await fetch(`/api/refresh-config`,{method:`POST`});if(e.ok){let t=await e.json();V(`success`),H(t.message||`配置已刷新`),setTimeout(()=>{V(null),H(``)},2e3)}else{let t=await e.json();V(`error`),H(t.error||`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}}catch(e){console.error(`刷新配置失败:`,e),V(`error`),H(`刷新配置失败`),setTimeout(()=>{V(null),H(``)},2e3)}},[]),st=(0,D.useCallback)(async()=>{Qe(!0),Z(null);try{let e=await fetch(`/api/config-doctor`);e.ok?Z(await e.json()):(V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3))}catch(e){console.error(`诊断失败:`,e),V(`error`),H(`诊断失败`),setTimeout(()=>{V(null),H(``)},2e3)}finally{Qe(!1)}},[]),ct=()=>{let e=J.trim(),t=Y.trim();!e||!t||(q(n=>({...n,[e]:t})),Ye(``),Xe(``))},lt=async()=>{z(!0);try{await b({clientAliases:K}),V(`success`),H(`客户端名称已保存,新请求立即生效`),T.success(`客户端名称保存成功`)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}},ut=async()=>{z(!0);try{await b({mocksFilePath:G}),V(`success`),H(`Mock 文件路径已更新,刷新页面后生效`),T.success(`Mock 文件路径保存成功`),setTimeout(()=>{V(null),H(``)},3e3)}catch(e){let t=e instanceof Error?e.message:`保存失败`;V(`error`),H(t),T.error(t)}finally{z(!1)}};Se({active:(e||n)&&P!==`preferences`,enabled:!R,priority:Ce.panel,onSave:()=>{if(P===`config`)return ut();if(P===`clients`)return lt();if(P===`ai`)return rt()}});let $=(0,O.jsxs)(O.Fragment,{children:[!n&&(0,O.jsxs)(Ae,{className:`px-6 pt-6 pb-4`,children:[(0,O.jsxs)(je,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ve,{className:`h-5 w-5`}),`系统设置`]}),(0,O.jsx)(ye,{children:`管理系统偏好、配置和 AI 功能`})]}),(0,O.jsxs)(pe,{value:P,onValueChange:e=>Ue(e),orientation:`vertical`,className:`min-h-0 flex-1 gap-0`,children:[(0,O.jsxs)(he,{"aria-label":`设置分类`,className:`h-full w-14 shrink-0 self-stretch justify-start gap-1 rounded-none border-r bg-muted/25 p-2 group-data-[orientation=vertical]/tabs:!h-full sm:w-44 sm:p-3`,children:[(0,O.jsxs)(g,{value:`preferences`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(ve,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`偏好设置`})]}),(0,O.jsxs)(g,{value:`config`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(x,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`配置文件`})]}),(0,O.jsxs)(g,{value:`clients`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(c,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`客户端`})]}),(0,O.jsxs)(g,{value:`ai`,className:`h-9 w-full flex-none justify-start px-2.5 sm:px-3`,children:[(0,O.jsx)(_e,{}),(0,O.jsx)(`span`,{className:`hidden sm:inline`,children:`AI 配置`})]})]}),(0,O.jsxs)(_,{value:`preferences`,className:k,children:[(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`主题`}),(0,O.jsxs)(oe,{value:i,onValueChange:e=>Ve(e),children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择主题`})}),(0,O.jsx)(re,{children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(l,{value:`system`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(be,{className:`size-4`}),`跟随系统`]})}),(0,O.jsx)(l,{value:`light`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(ge,{className:`size-4`}),`浅色模式`]})}),(0,O.jsx)(l,{value:`dark`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(Ee,{className:`size-4`}),`深色模式`]})})]})})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`强调色`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`统一按钮、状态、选中项和焦点样式。自动模式会根据明暗主题选择合适的颜色。`})]}),(0,O.jsx)(h,{type:`single`,value:Be,onValueChange:e=>{e&&He(e)},variant:`outline`,spacing:1,className:`flex-wrap justify-start`,"aria-label":`强调色`,children:ze.map(e=>(0,O.jsxs)(y,{value:e.value,"aria-label":e.label,children:[e.value===`auto`?(0,O.jsx)(_e,{"data-icon":`inline-start`}):(0,O.jsx)(`span`,{className:`size-3 rounded-full border border-foreground/10`,style:{background:e.color}}),e.label]},e.value))})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`缩放比例`}),(0,O.jsxs)(oe,{value:Q,onValueChange:$e,children:[(0,O.jsx)(ne,{children:(0,O.jsx)(ie,{placeholder:`选择缩放比例`})}),(0,O.jsx)(re,{children:(0,O.jsx)(ae,{children:Re.map(e=>(0,O.jsx)(l,{value:e.value,children:e.label},e.value))})})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`关于`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Meddle - HTTP 调试代理工具`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`版本: 1.0.0`})]})]}),(0,O.jsxs)(_,{value:`config`,className:k,children:[(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`路由规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(x,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:`~/.meddle/route-rules/`})]}),qe.length>0?(0,O.jsx)(`div`,{className:`space-y-2`,children:qe.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-sm`,children:[(0,O.jsx)(E,{variant:e.enabled?`default`:`secondary`,className:`text-[10px]`,children:e.enabled?`已启用`:`未启用`}),(0,O.jsxs)(`span`,{className:`flex-1 truncate text-xs`,children:[e.name,`.txt`]}),(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.ruleCount,` 条规则`]})]},e.name))}):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`暂无规则文件`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`规则文件存放于 ~/.meddle/route-rules/ 目录,纯文本格式。在"路由规则"页面管理。`})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`Mock 规则文件`}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-muted rounded-md`,children:[(0,O.jsx)(x,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,O.jsx)(`span`,{className:`text-xs font-mono truncate flex-1`,children:G||`默认: ~/.meddle/mocks.json`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`mocksPath`,className:`text-xs text-muted-foreground`,children:`自定义 Mock 规则文件路径(留空使用默认)`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{id:`mocksPath`,value:G,onChange:e=>Ke(e.target.value),placeholder:`如: /path/to/my-mocks.json`,className:`flex-1 h-8 text-sm font-mono`}),(0,O.jsxs)(C,{variant:`outline`,size:`sm`,onClick:ut,disabled:R,className:`h-8`,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-3 w-3`}),`应用`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`必须是 JSON 格式的 Mock 规则文件`})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(`h3`,{className:`text-sm font-medium`,children:`操作`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:ot,children:[(0,O.jsx)(ee,{className:`h-4 w-4 mr-1`}),`重新加载配置`]}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:st,disabled:Ze,children:[(0,O.jsx)(Le,{className:`h-4 w-4 mr-1`}),Ze?`诊断中...`:`诊断配置`]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`点击重新加载可应用修改后的配置文件,点击诊断配置可检查配置有效性`})]}),X&&(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`h3`,{className:`mb-4 flex items-center gap-2 text-sm font-medium`,children:[(0,O.jsx)(Le,{className:`h-4 w-4`}),`诊断结果`]}),(0,O.jsxs)(`div`,{className:`mb-3 p-3 rounded-md border ${X.status===`ok`?`bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900`:X.status===`warning`?`bg-yellow-50 dark:bg-yellow-950/20 border-yellow-200 dark:border-yellow-900`:`bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900`}`,children:[X.status===`ok`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(w,{className:`h-5 w-5 text-green-600 dark:text-green-400`}),(0,O.jsx)(`span`,{className:`text-sm font-medium text-green-700 dark:text-green-300`,children:`所有检查通过!配置正常。`})]}),X.status===`warning`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(a,{className:`h-5 w-5 text-yellow-600 dark:text-yellow-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-300`,children:[`发现 `,X.warnings.length,` 个警告`]})]}),X.status===`error`&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(o,{className:`h-5 w-5 text-red-600 dark:text-red-400`}),(0,O.jsxs)(`span`,{className:`text-sm font-medium text-red-700 dark:text-red-300`,children:[`发现 `,X.errors.length,` 个错误`]})]})]}),(0,O.jsx)(`div`,{className:A,children:X.checks.map((e,t)=>(0,O.jsx)(`div`,{className:`p-2 rounded border bg-card`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(w,{className:`h-4 w-4 text-green-600 dark:text-green-400 mt-0.5 shrink-0`}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground font-mono truncate`,children:e.path}),e.details&&(0,O.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.details.totalFiles!==void 0&&`${e.details.enabledFiles}/${e.details.totalFiles} 个文件已启用`,e.details.totalRules!==void 0&&` · ${e.details.totalRules} 条规则`,e.details.rules!==void 0&&`${e.details.rules} 条规则`,e.details.total!==void 0&&`${e.details.total} 条规则 (${e.details.enabled} 已启用)`,e.details.size!==void 0&&` · ${e.details.size} bytes`]})]})]})},t))}),X.warnings&&X.warnings.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-yellow-700 dark:text-yellow-300`,children:`警告:`}),X.warnings.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-yellow-600 dark:text-yellow-400`,children:[(0,O.jsx)(a,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]}),X.errors&&X.errors.length>0&&(0,O.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,O.jsx)(`div`,{className:`text-xs font-medium text-red-700 dark:text-red-300`,children:`错误:`}),X.errors.map((e,t)=>(0,O.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-red-600 dark:text-red-400`,children:[(0,O.jsx)(o,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,O.jsx)(`span`,{children:e})]},t))]})]})]})]}),(0,O.jsxs)(_,{value:`clients`,className:k,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,O.jsx)(c,{className:`h-4 w-4`}),`远程客户端名称`]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`将日志中的客户端 IP 映射为设备名称。保存后新请求立即生效,无需重启代理。`})]}),(0,O.jsx)(`div`,{className:A,children:Object.entries(K).length===0?(0,O.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-center text-xs text-muted-foreground`,children:`尚未配置设备名称`}):Object.entries(K).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{value:e,readOnly:!0,className:`h-8 flex-1 font-mono text-xs bg-muted/40`,"aria-label":`客户端 IP ${e}`}),(0,O.jsx)(m,{value:t,onChange:t=>{let n=t.target.value;q(t=>({...t,[e]:n}))},className:`h-8 flex-1 text-sm`,"aria-label":`${e} 的设备名称`}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>{q(t=>{let n={...t};return delete n[e],n})},title:`删除设备名称`,children:(0,O.jsx)(me,{className:`h-4 w-4`})})]},e))}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-sm`,children:`添加设备`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(m,{value:J,onChange:e=>Ye(e.target.value),placeholder:`客户端 IP,例如 10.13.232.187`,className:`h-8 flex-1 font-mono text-xs`}),(0,O.jsx)(m,{value:Y,onChange:e=>Xe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ct()},placeholder:`设备名称,例如 iPhone`,className:`h-8 flex-1 text-sm`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-8`,onClick:ct,disabled:!J.trim()||!Y.trim(),children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加`]})]})]}),(0,O.jsxs)(C,{onClick:lt,disabled:R,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存客户端名称`]})]}),(0,O.jsxs)(_,{value:`ai`,className:k,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`启用 AI 功能`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`启用智能代码修复功能`})]}),(0,O.jsx)(se,{checked:F.enabled,onCheckedChange:e=>I({...F,enabled:e}),"aria-label":`启用 AI 功能`})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:j,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`AI 模型配置`}),(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>{W({name:``,provider:`openai`,apiKey:``,baseUrl:`https://api.openai.com/v1/chat/completions`,model:`gpt-4o-mini`})},children:[(0,O.jsx)(s,{className:`h-4 w-4 mr-1`}),`添加模型`]})]}),(0,O.jsx)(`div`,{className:A,children:F.models&&F.models.length>0?F.models.map(e=>(0,O.jsx)(`div`,{className:`p-3 rounded-md border ${F.activeModelId===e.id?`border-primary bg-primary/5`:`border-border`}`,children:(0,O.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),F.activeModelId===e.id&&(0,O.jsx)(E,{variant:`default`,className:`text-xs`,children:`当前使用`})]}),(0,O.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.provider===`openai`?`OpenAI`:`Anthropic`,` - `,e.model]})]}),(0,O.jsxs)(`div`,{className:`flex gap-1`,children:[F.activeModelId!==e.id&&(0,O.jsxs)(r,{variant:`ghost`,size:`sm`,onClick:()=>I(le(F,e.id)),className:`h-7 text-xs`,children:[(0,O.jsx)(De,{className:`h-3 w-3 mr-1`}),`使用`]}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>I(ue(F,e.id)),className:`h-7 w-7 p-0 text-destructive`,children:(0,O.jsx)(me,{className:`h-3 w-3`})})]})]})},e.id)):(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground italic py-4 text-center`,children:`暂无模型配置,点击"添加模型"创建`})}),U&&(0,O.jsxs)(`div`,{className:`space-y-5 rounded-md border border-primary bg-primary/5 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(v,{className:`text-sm font-medium`,children:`新增模型`}),(0,O.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>W(null),className:`h-6 w-6 p-0`,children:(0,O.jsx)(o,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelName`,className:`text-xs`,children:`模型名称`}),(0,O.jsx)(m,{id:`newModelName`,value:U.name||``,onChange:e=>W({...U,name:e.target.value}),placeholder:`如:GPT-4o Mini`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-xs`,children:`服务商`}),(0,O.jsxs)(h,{type:`single`,value:U.provider,onValueChange:e=>{if(e===`openai`){let e=u(`openai`);W({...U,provider:`openai`,baseUrl:e.baseUrl,model:e.model})}else if(e===`anthropic`){let e=u(`anthropic`);W({...U,provider:`anthropic`,baseUrl:e.baseUrl,model:e.model})}},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(y,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(y,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelApiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsx)(m,{id:`newModelApiKey`,type:L?`text`:`password`,value:U.apiKey||``,onChange:e=>W({...U,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelModel`,className:`text-xs`,children:`模型`}),(0,O.jsx)(m,{id:`newModelModel`,value:U.model||``,onChange:e=>W({...U,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`newModelBaseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(m,{id:`newModelBaseUrl`,value:U.baseUrl||``,onChange:e=>W({...U,baseUrl:e.target.value}),placeholder:`API 端点`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>W(null),className:`h-7 text-xs`,children:`取消`}),(0,O.jsxs)(r,{size:`sm`,onClick:()=>{U.name&&U.apiKey&&U.model&&U.baseUrl&&(I(fe(F,U)),W(null))},disabled:!U.name||!U.apiKey||!U.model||!U.baseUrl,className:`h-7 text-xs`,children:[(0,O.jsx)(s,{className:`h-3 w-3 mr-1`}),`添加`]})]})]})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(v,{className:`text-sm`,children:`传统配置(向后兼容)`}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`如果未配置多模型,将使用此配置`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{className:`text-xs`,children:`AI 服务商`}),(0,O.jsxs)(h,{type:`single`,value:F.provider,onValueChange:e=>{(e===`openai`||e===`anthropic`)&&nt(e)},variant:`outline`,size:`sm`,spacing:0,children:[(0,O.jsx)(y,{value:`openai`,children:`OpenAI`}),(0,O.jsx)(y,{value:`anthropic`,children:`Anthropic`})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`apiKey`,className:`text-xs`,children:`API Key`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(m,{id:`apiKey`,type:L?`text`:`password`,value:F.apiKey,onChange:e=>I({...F,apiKey:e.target.value}),placeholder:`输入 API Key`,className:`flex-1 h-8 text-sm`}),(0,O.jsx)(r,{variant:`outline`,size:`icon`,onClick:()=>We(!L),className:`h-8 w-8`,children:L?(0,O.jsx)(Fe,{className:`h-4 w-4`}):(0,O.jsx)(Ie,{className:`h-4 w-4`})})]})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`model`,className:`text-xs`,children:`模型`}),(0,O.jsx)(m,{id:`model`,value:F.model,onChange:e=>I({...F,model:e.target.value}),placeholder:`模型名称`,className:`h-8 text-sm`})]}),(0,O.jsxs)(`div`,{className:A,children:[(0,O.jsx)(v,{htmlFor:`baseUrl`,className:`text-xs`,children:`API 端点`}),(0,O.jsx)(m,{id:`baseUrl`,value:F.baseUrl,onChange:e=>I({...F,baseUrl:e.target.value}),placeholder:F.provider===`openai`?`https://api.openai.com/v1/chat/completions`:`https://api.anthropic.com/v1/messages`,className:`h-8 text-sm`})]}),Ge&&(0,O.jsxs)(Pe,{variant:B===`error`?`destructive`:`default`,children:[B===`success`?(0,O.jsx)(w,{}):B===`error`?(0,O.jsx)(o,{}):(0,O.jsx)(a,{}),(0,O.jsx)(Ne,{children:B===`success`?`操作成功`:B===`error`?`操作失败`:`处理中`}),(0,O.jsx)(Me,{children:Ge})]}),(0,O.jsx)(S,{}),(0,O.jsxs)(`div`,{className:`flex justify-between`,children:[(0,O.jsxs)(r,{variant:`outline`,size:`sm`,onClick:it,children:[(0,O.jsx)(te,{className:`h-4 w-4 mr-1`}),`重置`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(r,{variant:`outline`,size:`sm`,onClick:at,disabled:!d(F)||R,children:`测试连接`}),(0,O.jsxs)(C,{size:`sm`,onClick:rt,disabled:R,children:[(0,O.jsx)(p,{"data-icon":`inline-start`,className:`h-4 w-4`}),R?`保存中...`:`保存`]})]})]})]})]})]});return n?(0,O.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:$}):(0,O.jsx)(Te,{open:e,onOpenChange:t,children:(0,O.jsx)(we,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:600,storageKey:`settings-panel`,children:$})})}export{Be as SettingsPanel};
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>web</title>
8
- <script type="module" crossorigin src="/assets/index-DTeCUv1G.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DboWpNx1.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/button-BTToMaBW.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/dist-DZJ9SMlJ.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/dist-C6eaYCUo.js">
@@ -1 +0,0 @@
1
- import{a as e,f as t,l as n,t as r,u as i}from"./button-BTToMaBW.js";import"./dist-C6eaYCUo.js";import{t as ee}from"./chevron-down-CPngAx4M.js";import{t as te}from"./chevron-right-V1DGIDbL.js";import{t as a}from"./code-5_eJ_XpJ.js";import{n as ne,t as o}from"./checkbox-D0y07vOb.js";import{t as s}from"./plus-tVxSydJ8.js";import{t as re}from"./wand-sparkles-wkul5vje.js";import"./es2015-CfXu88Y7.js";import{o as ie,r as ae}from"./ai-config-store-DQXVJVn_.js";import{A as c,G as l,d as oe,f as se,g as ce,h as le,lt as ue,m as u,p as de,rt as fe,u as d,v as pe,y as me,z as f}from"./index-DTeCUv1G.js";import{r as p}from"./syntax-highlight-DVhPdkuV.js";import{a as he,i as m,n as ge,o as h,r as g,t as _}from"./table-CT97lAYq.js";import{n as _e}from"./monaco-editor-DboIGERI.js";import{n as ve,t as ye}from"./code-fixer-DOrMk-4V.js";import{t as v}from"./file-system-access-CtcvBfj4.js";var y=n(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),b=t(i(),1),x=e();function be(e){return e.trim().startsWith(`data:image/`)}var xe={name:``,urlPattern:``,method:`*`,statusCode:200,delay:0,bodyType:`inline`,headers:{},body:``,enabled:!0};function S({mockRules:e,fetchMocks:t,createMock:n,updateMock:i,deleteMock:S,initialEditData:C,onInitialEditConsumed:w}){let[T,E]=(0,b.useState)(!1),[D]=(0,b.useState)(null),[O,Se]=(0,b.useState)(xe),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(!1),[N,Ce]=(0,b.useState)(300),we=(0,b.useRef)(null),P=(0,b.useRef)(null),[F,I]=(0,b.useState)(``),[L,R]=(0,b.useState)(``),[z,B]=(0,b.useState)(null),[V,H]=(0,b.useState)(null),[U,W]=(0,b.useState)(!1),[G,K]=(0,b.useState)(!1),[q,J]=(0,b.useState)(null),Te=e=>e.type.startsWith(`image/`),Ee=e=>({json:`application/json`,js:`application/javascript`,css:`text/css`,html:`text/html`,htm:`text/html`,xml:`application/xml`,txt:`text/plain`,csv:`text/csv`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,bmp:`image/bmp`})[e.toLowerCase().split(`.`).pop()||``]||`text/plain`,Y=e=>{let t=Ee(e);return(O.headers||{})[`Content-Type`]?null:t},X=async e=>Te(e)?new Promise(t=>{let n=new FileReader;n.onload=e=>{t(e.target?.result)},n.readAsDataURL(e)}):await e.text(),De=(0,b.useCallback)(async()=>{if(v(window))try{let[e]=await window.showOpenFilePicker({types:[{description:`响应文件`,accept:{"application/json":[`.json`],"text/html":[`.html`,`.htm`],"text/plain":[`.txt`,`.js`,`.css`,`.xml`,`.csv`,`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`],"image/png":[`.png`],"image/jpeg":[`.jpg`,`.jpeg`],"image/gif":[`.gif`],"image/webp":[`.webp`]}}],multiple:!1}),t=await e.getFile();$(`body`,await X(t)),J(Y(t.name));return}catch(e){console.log(`File System Access API not available or cancelled:`,e)}P.current?.click()},[]),Oe=(0,b.useCallback)(e=>{let t=e.target.files?.[0];t&&X(t).then(e=>{$(`body`,e),J(Y(t.name))}),e.target.value=``},[]);(0,b.useEffect)(()=>{t()},[t]),(0,b.useEffect)(()=>{C&&(window.dispatchEvent(new CustomEvent(`global-panel:open-panel`,{detail:{id:`mock.create`,title:`新建 Mock 规则`,size:`lg`,params:{initialData:C}}})),w?.())},[C,w]),(0,b.useEffect)(()=>{T||(I(``),R(``),M(!1),H(null),B(null))},[T]);let ke=(0,b.useCallback)(e=>{if(!e.trim()){H(null);return}let t=p(e);t.valid?H(null):H(t.error||`内容格式错误`)},[]),Z=(0,b.useCallback)(()=>{window.dispatchEvent(new CustomEvent(`global-panel:open-panel`,{detail:{id:`mock.create`,title:`新建 Mock 规则`,size:`lg`}}))},[]),Ae=(0,b.useCallback)(e=>{window.dispatchEvent(new CustomEvent(`global-panel:open-panel`,{detail:{id:`mock.edit`,title:`编辑 Mock:${e.name||e.urlPattern}`,size:`lg`,params:{id:e.id}}}))},[]),je=(0,b.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=N,r=e=>{let r=e.clientY-t;Ce(Math.max(150,n+r))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[N]),Q=(0,b.useCallback)(async()=>{if(O.bodyType===`inline`&&O.body.trim()){let e=p(O.body);if(!e.valid){let t=e.error||`内容格式错误`;H(t),d.error(t);return}}A(!0);try{if(!(D==null?await n(O):await i(D,O)))throw Error(`保存 Mock 规则失败`);d.success(`Mock 规则保存成功`),E(!1)}catch(e){d.error(e instanceof Error?e.message:`保存失败`)}finally{A(!1)}},[D,O,n,i]);oe({active:T,enabled:!k&&!!O.urlPattern,priority:se.modal,onSave:Q});let Me=(0,b.useCallback)(async(e,t)=>{await i(e.id,{enabled:t})},[i]),Ne=(0,b.useCallback)(async e=>{await S(e)},[S]),$=(e,t)=>{Se(n=>({...n,[e]:t})),e===`body`&&typeof t==`string`&&ke(t)},Pe=(0,b.useCallback)(async()=>{K(!0);try{let{formatted:e,type:t}=await ve(O.body);$(`body`,e),B(null),console.log(`已格式化为 ${t}`)}catch(e){B(e instanceof Error?e.message:`格式化失败`),setTimeout(()=>B(null),3e3)}finally{K(!1)}},[O.body]),Fe=(0,b.useCallback)(async()=>{W(!0);try{let e=await ye(O.body,!0);e.success?($(`body`,e.fixed),H(null),B(null),console.log(`代码已修复 (方法: ${e.method===`ai`?`AI`:`规则`})`)):(B(`自动修复失败,请手动修正语法错误`),setTimeout(()=>B(null),3e3))}catch(e){B(e instanceof Error?e.message:`修复失败`),setTimeout(()=>B(null),3e3)}finally{W(!1)}},[O.body]);return(0,x.jsxs)(`div`,{className:`app-page-stack`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`h3`,{className:`text-sm font-medium`,children:`规则列表`}),(0,x.jsxs)(r,{variant:`outline`,size:`sm`,onClick:Z,children:[(0,x.jsx)(s,{"data-icon":`inline-start`}),`新增规则`]})]}),(0,x.jsx)(`div`,{className:`rounded-md border`,children:(0,x.jsxs)(_,{children:[(0,x.jsx)(he,{children:(0,x.jsxs)(h,{children:[(0,x.jsx)(m,{className:`w-12`,children:`启用`}),(0,x.jsx)(m,{className:`w-40`,children:`名称`}),(0,x.jsx)(m,{children:`URL 匹配`}),(0,x.jsx)(m,{className:`w-20`,children:`方法`}),(0,x.jsx)(m,{className:`w-20`,children:`状态码`}),(0,x.jsx)(m,{className:`w-16`,children:`类型`}),(0,x.jsx)(m,{className:`w-16`,children:`延迟`}),(0,x.jsx)(m,{className:`w-16`,children:`响应头`}),(0,x.jsx)(m,{className:`w-20`,children:`操作`})]})}),(0,x.jsx)(ge,{children:e.length===0?(0,x.jsx)(h,{children:(0,x.jsx)(g,{colSpan:9,className:`text-center text-muted-foreground py-8`,children:`暂无 Mock 规则,点击"新增规则"或从请求日志详情中创建`})}):e.map(e=>(0,x.jsxs)(h,{children:[(0,x.jsx)(g,{children:(0,x.jsx)(o,{checked:e.enabled,onCheckedChange:t=>Me(e,t===!0)})}),(0,x.jsx)(g,{className:`font-medium text-sm`,children:e.name||(0,x.jsx)(`span`,{className:`text-muted-foreground italic`,children:`未命名`})}),(0,x.jsx)(g,{className:`font-mono text-xs truncate max-w-[300px]`,title:e.urlPattern,children:e.urlPattern}),(0,x.jsx)(g,{children:(0,x.jsx)(f,{variant:`outline`,className:`text-xs`,children:e.method||`*`})}),(0,x.jsx)(g,{children:(0,x.jsx)(f,{variant:e.statusCode>=400?`destructive`:e.statusCode>=300?`secondary`:`default`,children:e.statusCode})}),(0,x.jsx)(g,{children:e.bodyType===`file`?(0,x.jsxs)(f,{variant:`secondary`,children:[(0,x.jsx)(ue,{}),`文件`]}):(0,x.jsxs)(f,{variant:`outline`,children:[(0,x.jsx)(a,{}),`内容`]})}),(0,x.jsx)(g,{className:`text-xs text-muted-foreground font-mono`,children:e.delay?`${e.delay}ms`:`-`}),(0,x.jsx)(g,{children:e.headers&&Object.keys(e.headers).length>0?(0,x.jsx)(f,{variant:`secondary`,className:`text-xs`,children:Object.keys(e.headers).length}):(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`-`})}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex gap-1`,children:[(0,x.jsx)(r,{variant:`ghost`,size:`icon-sm`,onClick:()=>Ae(e),className:`text-muted-foreground hover:text-primary`,"aria-label":`编辑 Mock 规则`,children:(0,x.jsx)(fe,{})}),(0,x.jsx)(r,{variant:`ghost`,size:`icon-sm`,onClick:()=>Ne(e.id),className:`text-muted-foreground hover:text-destructive`,"aria-label":`删除 Mock 规则`,children:(0,x.jsx)(l,{})})]})})]},e.id))})]})}),(0,x.jsx)(le,{open:T,onOpenChange:E,children:(0,x.jsxs)(ce,{className:`p-0 flex flex-col`,resizable:!0,defaultWidth:700,storageKey:`mock-config-editor`,children:[(0,x.jsx)(pe,{className:`px-4 pt-4 pb-2`,children:(0,x.jsx)(me,{className:`text-base`,children:D==null?`新建 Mock 规则`:`编辑 Mock 规则`})}),(0,x.jsx)(u,{}),(0,x.jsxs)(`div`,{className:`app-panel-content`,children:[(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`规则名称`}),(0,x.jsx)(c,{value:O.name,onChange:e=>$(`name`,e.target.value),placeholder:`如:模拟欠费状态`,className:`h-8`})]}),(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`URL 匹配(支持正则)`}),(0,x.jsx)(c,{value:O.urlPattern,onChange:e=>$(`urlPattern`,e.target.value),placeholder:`如:/api/console/user/corp/.*`,className:`h-8 font-mono text-sm`})]}),(0,x.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTP 方法`}),(0,x.jsxs)(`select`,{value:O.method,onChange:e=>$(`method`,e.target.value),className:`flex h-8 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,children:[(0,x.jsx)(`option`,{value:`*`,children:`全部`}),(0,x.jsx)(`option`,{value:`GET`,children:`GET`}),(0,x.jsx)(`option`,{value:`POST`,children:`POST`}),(0,x.jsx)(`option`,{value:`PUT`,children:`PUT`}),(0,x.jsx)(`option`,{value:`DELETE`,children:`DELETE`}),(0,x.jsx)(`option`,{value:`PATCH`,children:`PATCH`})]})]}),(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`响应状态码`}),(0,x.jsx)(c,{type:`number`,value:O.statusCode,onChange:e=>$(`statusCode`,parseInt(e.target.value)||200),className:`h-8`})]}),(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`响应延迟 (ms)`}),(0,x.jsx)(c,{type:`number`,value:O.delay,onChange:e=>$(`delay`,parseInt(e.target.value)||0),placeholder:`0`,className:`h-8`})]})]}),(0,x.jsxs)(`div`,{className:`app-field-group`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`响应内容 (Body)`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,onClick:De,children:[(0,x.jsx)(y,{className:`h-3 w-3 mr-1`}),`从文件加载`]}),(0,x.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,onClick:async()=>{let e=window.prompt(`请输入文件 URL:`);if(e)try{let t=await fetch(e);if((t.headers.get(`content-type`)||``).startsWith(`image/`)||e.match(/\.(png|jpg|jpeg|gif|webp|svg|ico|bmp)$/i)){let e=await t.blob(),n=new FileReader;n.onload=()=>{$(`body`,n.result)},n.readAsDataURL(e)}else $(`body`,await t.text())}catch(e){alert(`无法加载文件: `+e.message)}},children:[(0,x.jsx)(y,{className:`h-3 w-3 mr-1`}),`从URL导入`]}),z&&(0,x.jsx)(`span`,{className:`text-xs text-red-500`,children:z}),O.body.trim()&&ie(ae())&&(0,x.jsxs)(r,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,onClick:Fe,disabled:U,children:[(0,x.jsx)(re,{className:`h-3 w-3 mr-1`}),U?`修复中...`:`AI修复`]}),(0,x.jsxs)(r,{variant:`ghost`,size:`sm`,className:`h-6 text-xs`,onClick:Pe,disabled:G,children:[(0,x.jsx)(a,{className:`h-3 w-3 mr-1`}),G?`格式化中...`:`智能格式化`]})]})]}),(0,x.jsx)(`input`,{ref:P,type:`file`,className:`hidden`,onChange:Oe,accept:`image/*,.json,.html,.htm,.txt,.js,.css,.xml,.csv`}),O.body.trim()&&be(O.body)?(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(`div`,{className:`border rounded-md p-2 bg-muted/30`,children:(0,x.jsx)(`img`,{src:O.body,alt:`Preview`,className:`max-w-full max-h-96 object-contain`})}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[(0,x.jsx)(r,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,onClick:()=>$(`body`,``),children:`删除图片`}),(0,x.jsx)(r,{variant:`ghost`,size:`sm`,className:`h-6 text-xs`,onClick:()=>{navigator.clipboard.writeText(O.body),alert(`图片内容已复制到剪贴板`)},children:`复制内容`})]})]}):(0,x.jsxs)(`div`,{ref:we,className:`relative group`,children:[(0,x.jsx)(_e,{value:O.body,onChange:e=>$(`body`,e),placeholder:`支持 JSON, HTML, JS, CSS 等格式,或从文件/URL导入`,height:`${N}px`}),(0,x.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-4 cursor-ns-resize flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-t from-border/50 to-transparent`,onMouseDown:je,children:(0,x.jsx)(ne,{className:`h-4 w-4 text-muted-foreground`})})]}),V&&(0,x.jsxs)(`div`,{className:`flex items-start gap-2 p-2 rounded-md bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900`,children:[(0,x.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400 font-medium`,children:`语法错误:`}),(0,x.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400 flex-1`,children:V})]})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>M(!j),children:[j?(0,x.jsx)(ee,{className:`h-3 w-3`}):(0,x.jsx)(te,{className:`h-3 w-3`}),`响应头 (Headers)`,Object.keys(O.headers||{}).length>0&&(0,x.jsx)(f,{variant:`secondary`,className:`ml-1 text-xs`,children:Object.keys(O.headers||{}).length})]}),q&&(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,x.jsxs)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:[`检测到内容类型变更,建议更新为 `,q,`?`]}),(0,x.jsx)(r,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,onClick:()=>{$(`headers`,{...O.headers||{},"Content-Type":q}),J(null)},children:`更新`}),(0,x.jsx)(r,{variant:`ghost`,size:`sm`,className:`h-6 text-xs`,onClick:()=>J(null),children:`忽略`})]})]}),j&&(0,x.jsxs)(`div`,{className:`space-y-2 pl-4 border-l-2 border-muted`,children:[Object.entries(O.headers||{}).length>0?(0,x.jsx)(`div`,{className:`space-y-1`,children:Object.entries(O.headers||{}).map(([e,t])=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(c,{value:e,onChange:n=>{let r={...O.headers};delete r[e],n.target.value&&(r[n.target.value]=t),$(`headers`,r)},placeholder:`Header 名称`,className:`h-7 font-mono text-xs flex-1`}),(0,x.jsx)(c,{value:t,onChange:t=>{$(`headers`,{...O.headers,[e]:t.target.value})},placeholder:`Header 值`,className:`h-7 font-mono text-xs flex-1`}),(0,x.jsx)(r,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>{let t={...O.headers};delete t[e],$(`headers`,t)},children:(0,x.jsx)(l,{className:`h-3.5 w-3.5`})})]},e))}):(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`暂无自定义响应头`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(c,{value:F,onChange:e=>I(e.target.value),placeholder:`Header 名称`,className:`h-7 font-mono text-xs flex-1`}),(0,x.jsx)(c,{value:L,onChange:e=>R(e.target.value),placeholder:`Header 值`,className:`h-7 font-mono text-xs flex-1`}),(0,x.jsx)(r,{variant:`outline`,size:`sm`,className:`h-7`,onClick:()=>{F&&L&&($(`headers`,{...O.headers,[F]:L}),I(``),R(``))},disabled:!F||!L,children:(0,x.jsx)(s,{className:`h-3.5 w-3.5`})})]})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(o,{checked:O.enabled,onCheckedChange:e=>$(`enabled`,!!e)}),(0,x.jsx)(`label`,{className:`text-sm`,children:`启用此规则`})]})]}),(0,x.jsx)(u,{}),(0,x.jsxs)(`div`,{className:`px-4 py-3 flex justify-end gap-2`,children:[(0,x.jsx)(r,{variant:`outline`,size:`sm`,onClick:()=>E(!1),children:`取消`}),(0,x.jsx)(de,{size:`sm`,onClick:Q,disabled:k||!O.urlPattern,children:k?`保存中...`:`保存`})]})]})})]})}export{S as MockConfig};