@mcp-use/inspector 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{browser-DEOnoCHR.js → browser-BkJdGGVq.js} +4 -4
- package/dist/client/assets/{chunk-VL2OQCWN-CuNc4Qlg.js → chunk-VL2OQCWN-Dm4XquLI.js} +1 -1
- package/dist/client/assets/{embeddings-DINtiLOn.js → embeddings-BvWgxmh-.js} +1 -1
- package/dist/client/assets/{index-BCUAxuoE.js → index-BxUJEXs5.js} +3 -3
- package/dist/client/assets/{index-NNr5K88x.js → index-CEkgKN2t.js} +1 -1
- package/dist/client/assets/{index-gr-gzBTP.js → index-CWYxvW-c.js} +1 -1
- package/dist/client/assets/{index-BaFfLjLH.js → index-DHsHh1_g.js} +1 -1
- package/dist/client/assets/{index-BrKXdctt.js → index-Dnm19mgK.js} +1 -1
- package/dist/client/assets/{index-BXWlfrzU.js → index-F8MAAt6D.js} +1 -1
- package/dist/client/assets/{index-BmA2btDM.js → index-WLUXcbDv.js} +1 -1
- package/dist/client/assets/langfuse-6AJGHMAV-QljN0jPu.js +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +6 -6
- package/dist/client/assets/langfuse-6AJGHMAV-DrIbqh4V.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-BkJdGGVq.js","assets/chunk-VL2OQCWN-Dm4XquLI.js","assets/v4-BKrj-4V8.js","assets/index-F8MAAt6D.js","assets/index-Dnm19mgK.js","assets/embeddings-BvWgxmh-.js","assets/index-DHsHh1_g.js","assets/index-CWYxvW-c.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function EV(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const n in a)if(n!=="default"&&!(n in t)){const s=Object.getOwnPropertyDescriptor(a,n);s&&Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>a[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(n){if(n.ep)return;n.ep=!0;const s=r(n);fetch(n.href,s)}})();function ed(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rbe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function a(){var n=!1;try{n=this instanceof a}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:function(){return t[a]}})}),r}var mv={exports:{}},Qc={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -311,7 +311,7 @@ Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}
|
|
|
311
311
|
*
|
|
312
312
|
* This source code is licensed under the ISC license.
|
|
313
313
|
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/const NY=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Pu=lt("zap",NY);function kY(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const IY=t=>{switch(t){case"success":return LY;case"info":return PY;case"warning":return MY;case"error":return UY;default:return null}},OY=Array(12).fill(0),DY=({visible:t,className:e})=>Ce.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Ce.createElement("div",{className:"sonner-spinner"},OY.map((r,a)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),LY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),MY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),PY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),UY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),jY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),FY=()=>{const[t,e]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let _w=1;class zY{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:a,...n}=e,s=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:_w++,l=this.toasts.find(d=>d.id===s),c=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),l?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:a}),{...d,...e,id:s,dismissible:c,title:a}):d):this.addToast({title:a,...n,dismissible:c,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let s=a!==void 0,l;const c=n.then(async f=>{if(l=["resolve",f],Ce.isValidElement(f))s=!1,this.create({id:a,type:"default",message:f});else if(BY(f)&&!f.ok){s=!1;const h=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:v,..._})}else if(f instanceof Error){s=!1;const h=typeof r.error=="function"?await r.error(f):r.error,v=typeof r.description=="function"?await r.description(f):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:v,..._})}else if(r.success!==void 0){s=!1;const h=typeof r.success=="function"?await r.success(f):r.success,v=typeof r.description=="function"?await r.description(f):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:v,..._})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){s=!1;const m=typeof r.error=="function"?await r.error(f):r.error,h=typeof r.description=="function"?await r.description(f):r.description,b=typeof m=="object"&&!Ce.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...b})}}).finally(()=>{s&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((f,m)=>c.then(()=>l[0]==="reject"?m(l[1]):f(l[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:d}:Object.assign(a,{unwrap:d})},this.custom=(e,r)=>{const a=r?.id||_w++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const yn=new zY,$Y=(t,e)=>{const r=e?.id||_w++;return yn.addToast({title:t,...e,id:r}),r},BY=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",qY=$Y,HY=()=>yn.toasts,GY=()=>yn.getActiveToasts(),br=Object.assign(qY,{success:yn.success,info:yn.info,warning:yn.warning,error:yn.error,custom:yn.custom,message:yn.message,promise:yn.promise,dismiss:yn.dismiss,loading:yn.loading},{getHistory:HY,getToasts:GY});kY("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function zf(t){return t.label!==void 0}const VY=3,WY="24px",YY="16px",YI=4e3,KY=356,ZY=14,XY=45,QY=200;function Na(...t){return t.filter(Boolean).join(" ")}function JY(t){const[e,r]=t.split("-"),a=[];return e&&a.push(e),r&&a.push(r),a}const eK=t=>{var e,r,a,n,s,l,c,d,f;const{invert:m,toast:h,unstyled:v,interacting:b,setHeights:_,visibleToasts:S,heights:R,index:x,toasts:T,expanded:A,removeToast:C,defaultRichColors:k,closeButton:N,style:I,cancelButtonStyle:O,actionButtonStyle:P,className:M="",descriptionClassName:U="",duration:G,position:J,gap:V,expandByDefault:Y,classNames:j,icons:q,closeButtonAriaLabel:H="Close toast"}=t,[Q,ie]=Ce.useState(null),[$,W]=Ce.useState(null),[F,K]=Ce.useState(!1),[re,B]=Ce.useState(!1),[L,X]=Ce.useState(!1),[ne,ee]=Ce.useState(!1),[ce,ge]=Ce.useState(!1),[Ae,ye]=Ce.useState(0),[Se,Ie]=Ce.useState(0),he=Ce.useRef(h.duration||G||YI),Oe=Ce.useRef(null),De=Ce.useRef(null),Qe=x===0,Te=x+1<=S,_e=h.type,Re=h.dismissible!==!1,We=h.className||"",wt=h.descriptionClassName||"",Ye=Ce.useMemo(()=>R.findIndex(Ke=>Ke.toastId===h.id)||0,[R,h.id]),Je=Ce.useMemo(()=>{var Ke;return(Ke=h.closeButton)!=null?Ke:N},[h.closeButton,N]),Xe=Ce.useMemo(()=>h.duration||G||YI,[h.duration,G]),mt=Ce.useRef(0),lr=Ce.useRef(0),un=Ce.useRef(0),mr=Ce.useRef(null),[zt,Dt]=J.split("-"),rr=Ce.useMemo(()=>R.reduce((Ke,Lt,Kt)=>Kt>=Ye?Ke:Ke+Lt.height,0),[R,Ye]),cr=FY(),yr=h.invert||m,Pn=_e==="loading";lr.current=Ce.useMemo(()=>Ye*V+rr,[Ye,rr]),Ce.useEffect(()=>{he.current=Xe},[Xe]),Ce.useEffect(()=>{K(!0)},[]),Ce.useEffect(()=>{const Ke=De.current;if(Ke){const Lt=Ke.getBoundingClientRect().height;return Ie(Lt),_(Kt=>[{toastId:h.id,height:Lt,position:h.position},...Kt]),()=>_(Kt=>Kt.filter(Or=>Or.toastId!==h.id))}},[_,h.id]),Ce.useLayoutEffect(()=>{if(!F)return;const Ke=De.current,Lt=Ke.style.height;Ke.style.height="auto";const Kt=Ke.getBoundingClientRect().height;Ke.style.height=Lt,Ie(Kt),_(Or=>Or.find(Yt=>Yt.toastId===h.id)?Or.map(Yt=>Yt.toastId===h.id?{...Yt,height:Kt}:Yt):[{toastId:h.id,height:Kt,position:h.position},...Or])},[F,h.title,h.description,_,h.id,h.jsx,h.action,h.cancel]);const nr=Ce.useCallback(()=>{B(!0),ye(lr.current),_(Ke=>Ke.filter(Lt=>Lt.toastId!==h.id)),setTimeout(()=>{C(h)},QY)},[h,C,_,lr]);Ce.useEffect(()=>{if(h.promise&&_e==="loading"||h.duration===1/0||h.type==="loading")return;let Ke;return A||b||cr?(()=>{if(un.current<mt.current){const Or=new Date().getTime()-mt.current;he.current=he.current-Or}un.current=new Date().getTime()})():(()=>{he.current!==1/0&&(mt.current=new Date().getTime(),Ke=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),nr()},he.current))})(),()=>clearTimeout(Ke)},[A,b,h,_e,cr,nr]),Ce.useEffect(()=>{h.delete&&(nr(),h.onDismiss==null||h.onDismiss.call(h,h))},[nr,h.delete]);function Ht(){var Ke;if(q?.loading){var Lt;return Ce.createElement("div",{className:Na(j?.loader,h==null||(Lt=h.classNames)==null?void 0:Lt.loader,"sonner-loader"),"data-visible":_e==="loading"},q.loading)}return Ce.createElement(DY,{className:Na(j?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader),visible:_e==="loading"})}const dn=h.icon||q?.[_e]||IY(_e);var sa,tn;return Ce.createElement("li",{tabIndex:0,ref:De,className:Na(M,We,j?.toast,h==null||(e=h.classNames)==null?void 0:e.toast,j?.default,j?.[_e],h==null||(r=h.classNames)==null?void 0:r[_e]),"data-sonner-toast":"","data-rich-colors":(sa=h.richColors)!=null?sa:k,"data-styled":!(h.jsx||h.unstyled||v),"data-mounted":F,"data-promise":!!h.promise,"data-swiped":ce,"data-removed":re,"data-visible":Te,"data-y-position":zt,"data-x-position":Dt,"data-index":x,"data-front":Qe,"data-swiping":L,"data-dismissible":Re,"data-type":_e,"data-invert":yr,"data-swipe-out":ne,"data-swipe-direction":$,"data-expanded":!!(A||Y&&F),"data-testid":h.testId,style:{"--index":x,"--toasts-before":x,"--z-index":T.length-x,"--offset":`${re?Ae:lr.current}px`,"--initial-height":Y?"auto":`${Se}px`,...I,...h.style},onDragEnd:()=>{X(!1),ie(null),mr.current=null},onPointerDown:Ke=>{Ke.button!==2&&(Pn||!Re||(Oe.current=new Date,ye(lr.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(X(!0),mr.current={x:Ke.clientX,y:Ke.clientY})))},onPointerUp:()=>{var Ke,Lt,Kt;if(ne||!Re)return;mr.current=null;const Or=Number(((Ke=De.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Un=Number(((Lt=De.current)==null?void 0:Lt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Yt=new Date().getTime()-((Kt=Oe.current)==null?void 0:Kt.getTime()),Wr=Q==="x"?Or:Un,_a=Math.abs(Wr)/Yt;if(Math.abs(Wr)>=XY||_a>.11){ye(lr.current),h.onDismiss==null||h.onDismiss.call(h,h),W(Q==="x"?Or>0?"right":"left":Un>0?"down":"up"),nr(),ee(!0);return}else{var Yr,Ur;(Yr=De.current)==null||Yr.style.setProperty("--swipe-amount-x","0px"),(Ur=De.current)==null||Ur.style.setProperty("--swipe-amount-y","0px")}ge(!1),X(!1),ie(null)},onPointerMove:Ke=>{var Lt,Kt,Or;if(!mr.current||!Re||((Lt=window.getSelection())==null?void 0:Lt.toString().length)>0)return;const Yt=Ke.clientY-mr.current.y,Wr=Ke.clientX-mr.current.x;var _a;const Yr=(_a=t.swipeDirections)!=null?_a:JY(J);!Q&&(Math.abs(Wr)>1||Math.abs(Yt)>1)&&ie(Math.abs(Wr)>Math.abs(Yt)?"x":"y");let Ur={x:0,y:0};const ae=Z=>1/(1.5+Math.abs(Z)/20);if(Q==="y"){if(Yr.includes("top")||Yr.includes("bottom"))if(Yr.includes("top")&&Yt<0||Yr.includes("bottom")&&Yt>0)Ur.y=Yt;else{const Z=Yt*ae(Yt);Ur.y=Math.abs(Z)<Math.abs(Yt)?Z:Yt}}else if(Q==="x"&&(Yr.includes("left")||Yr.includes("right")))if(Yr.includes("left")&&Wr<0||Yr.includes("right")&&Wr>0)Ur.x=Wr;else{const Z=Wr*ae(Wr);Ur.x=Math.abs(Z)<Math.abs(Wr)?Z:Wr}(Math.abs(Ur.x)>0||Math.abs(Ur.y)>0)&&ge(!0),(Kt=De.current)==null||Kt.style.setProperty("--swipe-amount-x",`${Ur.x}px`),(Or=De.current)==null||Or.style.setProperty("--swipe-amount-y",`${Ur.y}px`)}},Je&&!h.jsx&&_e!=="loading"?Ce.createElement("button",{"aria-label":H,"data-disabled":Pn,"data-close-button":!0,onClick:Pn||!Re?()=>{}:()=>{nr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Na(j?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(tn=q?.close)!=null?tn:jY):null,(_e||h.icon||h.promise)&&h.icon!==null&&(q?.[_e]!==null||h.icon)?Ce.createElement("div",{"data-icon":"",className:Na(j?.icon,h==null||(n=h.classNames)==null?void 0:n.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Ht():null,h.type!=="loading"?dn:null):null,Ce.createElement("div",{"data-content":"",className:Na(j?.content,h==null||(s=h.classNames)==null?void 0:s.content)},Ce.createElement("div",{"data-title":"",className:Na(j?.title,h==null||(l=h.classNames)==null?void 0:l.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?Ce.createElement("div",{"data-description":"",className:Na(U,wt,j?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),Ce.isValidElement(h.cancel)?h.cancel:h.cancel&&zf(h.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ke=>{zf(h.cancel)&&Re&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ke),nr())},className:Na(j?.cancelButton,h==null||(d=h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,Ce.isValidElement(h.action)?h.action:h.action&&zf(h.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:Ke=>{zf(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ke),!Ke.defaultPrevented&&nr())},className:Na(j?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function KI(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function tK(t,e){const r={};return[t,e].forEach((a,n)=>{const s=n===1,l=s?"--mobile-offset":"--offset",c=s?YY:WY;function d(f){["top","right","bottom","left"].forEach(m=>{r[`${l}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof a=="number"||typeof a=="string"?d(a):typeof a=="object"?["top","right","bottom","left"].forEach(f=>{a[f]===void 0?r[`${l}-${f}`]=c:r[`${l}-${f}`]=typeof a[f]=="number"?`${a[f]}px`:a[f]}):d(c)}),r}const rK=Ce.forwardRef(function(e,r){const{id:a,invert:n,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:m,mobileOffset:h,theme:v="light",richColors:b,duration:_,style:S,visibleToasts:R=VY,toastOptions:x,dir:T=KI(),gap:A=ZY,icons:C,containerAriaLabel:k="Notifications"}=e,[N,I]=Ce.useState([]),O=Ce.useMemo(()=>a?N.filter(F=>F.toasterId===a):N.filter(F=>!F.toasterId),[N,a]),P=Ce.useMemo(()=>Array.from(new Set([s].concat(O.filter(F=>F.position).map(F=>F.position)))),[O,s]),[M,U]=Ce.useState([]),[G,J]=Ce.useState(!1),[V,Y]=Ce.useState(!1),[j,q]=Ce.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ce.useRef(null),Q=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),ie=Ce.useRef(null),$=Ce.useRef(!1),W=Ce.useCallback(F=>{I(K=>{var re;return(re=K.find(B=>B.id===F.id))!=null&&re.delete||yn.dismiss(F.id),K.filter(({id:B})=>B!==F.id)})},[]);return Ce.useEffect(()=>yn.subscribe(F=>{if(F.dismiss){requestAnimationFrame(()=>{I(K=>K.map(re=>re.id===F.id?{...re,delete:!0}:re))});return}setTimeout(()=>{A$.flushSync(()=>{I(K=>{const re=K.findIndex(B=>B.id===F.id);return re!==-1?[...K.slice(0,re),{...K[re],...F},...K.slice(re+1)]:[F,...K]})})})}),[N]),Ce.useEffect(()=>{if(v!=="system"){q(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:K})=>{q(K?"dark":"light")})}catch{F.addListener(({matches:re})=>{try{q(re?"dark":"light")}catch(B){console.error(B)}})}},[v]),Ce.useEffect(()=>{N.length<=1&&J(!1)},[N]),Ce.useEffect(()=>{const F=K=>{var re;if(l.every(X=>K[X]||K.code===X)){var L;J(!0),(L=H.current)==null||L.focus()}K.code==="Escape"&&(document.activeElement===H.current||(re=H.current)!=null&&re.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[l]),Ce.useEffect(()=>{if(H.current)return()=>{ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null,$.current=!1)}},[H.current]),Ce.createElement("section",{ref:r,"aria-label":`${k} ${Q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((F,K)=>{var re;const[B,L]=F.split("-");return O.length?Ce.createElement("ol",{key:F,dir:T==="auto"?KI():T,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":B,"data-x-position":L,style:{"--front-toast-height":`${((re=M[0])==null?void 0:re.height)||0}px`,"--width":`${KY}px`,"--gap":`${A}px`,...S,...tK(m,h)},onBlur:X=>{$.current&&!X.currentTarget.contains(X.relatedTarget)&&($.current=!1,ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||$.current||($.current=!0,ie.current=X.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{V||J(!1)},onDragEnd:()=>J(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},O.filter(X=>!X.position&&K===0||X.position===F).map((X,ne)=>{var ee,ce;return Ce.createElement(eK,{key:X.id,icons:C,index:ne,toast:X,defaultRichColors:b,duration:(ee=x?.duration)!=null?ee:_,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:n,visibleToasts:R,closeButton:(ce=x?.closeButton)!=null?ce:d,interacting:V,position:F,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:W,toasts:O.filter(ge=>ge.position==X.position),heights:M.filter(ge=>ge.position==X.position),setHeights:U,expandByDefault:c,gap:A,expanded:G,swipeDirections:e.swipeDirections})})):null}))});function ZI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ai(...t){return e=>{let r=!1;const a=t.map(n=>{const s=ZI(n,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<a.length;n++){const s=a[n];typeof s=="function"?s():ZI(t[n],null)}}}}function At(...t){return y.useCallback(Ai(...t),t)}function So(t){const e=nK(t),r=y.forwardRef((a,n)=>{const{children:s,...l}=a,c=y.Children.toArray(s),d=c.find(iK);if(d){const f=d.props.children,m=c.map(h=>h===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:h);return g.jsx(e,{...l,ref:n,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return g.jsx(e,{...l,ref:n,children:s})});return r.displayName=`${t}.Slot`,r}var M$=So("Slot");function nK(t){const e=y.forwardRef((r,a)=>{const{children:n,...s}=r;if(y.isValidElement(n)){const l=sK(n),c=oK(s,n.props);return n.type!==y.Fragment&&(c.ref=a?Ai(a,l):l),y.cloneElement(n,c)}return y.Children.count(n)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var P$=Symbol("radix.slottable");function aK(t){const e=({children:r})=>g.jsx(g.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=P$,e}function iK(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===P$}function oK(t,e){const r={...e};for(const a in e){const n=t[a],s=e[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...c)=>{const d=s(...c);return n(...c),d}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...t,...r}}function sK(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function U$(t){var e,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=U$(t[e]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function j$(){for(var t,e,r=0,a="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=U$(t))&&(a&&(a+=" "),a+=e);return a}const XI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,QI=j$,F$=(t,e)=>r=>{var a;if(e?.variants==null)return QI(t,r?.class,r?.className);const{variants:n,defaultVariants:s}=e,l=Object.keys(n).map(f=>{const m=r?.[f],h=s?.[f];if(m===null)return null;const v=XI(m)||XI(h);return n[f][v]}),c=r&&Object.entries(r).reduce((f,m)=>{let[h,v]=m;return v===void 0||(f[h]=v),f},{}),d=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((f,m)=>{let{class:h,className:v,...b}=m;return Object.entries(b).every(_=>{let[S,R]=_;return Array.isArray(R)?R.includes({...s,...c}[S]):{...s,...c}[S]===R})?[...f,h,v]:f},[]);return QI(t,l,d,r?.class,r?.className)},QT="-",lK=t=>{const e=uK(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{const c=l.split(QT);return c[0]===""&&c.length!==1&&c.shift(),z$(c,e)||cK(l)},getConflictingClassGroupIds:(l,c)=>{const d=r[l]||[];return c&&a[l]?[...d,...a[l]]:d}}},z$=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],a=e.nextPart.get(r),n=a?z$(t.slice(1),a):void 0;if(n)return n;if(e.validators.length===0)return;const s=t.join(QT);return e.validators.find(({validator:l})=>l(s))?.classGroupId},JI=/^\[(.+)\]$/,cK=t=>{if(JI.test(t)){const e=JI.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},uK=t=>{const{theme:e,classGroups:r}=t,a={nextPart:new Map,validators:[]};for(const n in r)ww(r[n],a,n,e);return a},ww=(t,e,r,a)=>{t.forEach(n=>{if(typeof n=="string"){const s=n===""?e:eO(e,n);s.classGroupId=r;return}if(typeof n=="function"){if(dK(n)){ww(n(a),e,r,a);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([s,l])=>{ww(l,eO(e,s),r,a)})})},eO=(t,e)=>{let r=t;return e.split(QT).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},dK=t=>t.isThemeGetter,fK=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,a=new Map;const n=(s,l)=>{r.set(s,l),e++,e>t&&(e=0,a=r,r=new Map)};return{get(s){let l=r.get(s);if(l!==void 0)return l;if((l=a.get(s))!==void 0)return n(s,l),l},set(s,l){r.has(s)?r.set(s,l):n(s,l)}}},Tw="!",Rw=":",pK=Rw.length,mK=t=>{const{prefix:e,experimentalParseClassName:r}=t;let a=n=>{const s=[];let l=0,c=0,d=0,f;for(let _=0;_<n.length;_++){let S=n[_];if(l===0&&c===0){if(S===Rw){s.push(n.slice(d,_)),d=_+pK;continue}if(S==="/"){f=_;continue}}S==="["?l++:S==="]"?l--:S==="("?c++:S===")"&&c--}const m=s.length===0?n:n.substring(d),h=hK(m),v=h!==m,b=f&&f>d?f-d:void 0;return{modifiers:s,hasImportantModifier:v,baseClassName:h,maybePostfixModifierPosition:b}};if(e){const n=e+Rw,s=a;a=l=>l.startsWith(n)?s(l.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(r){const n=a;a=s=>r({className:s,parseClassName:n})}return a},hK=t=>t.endsWith(Tw)?t.substring(0,t.length-1):t.startsWith(Tw)?t.substring(1):t,gK=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const n=[];let s=[];return a.forEach(l=>{l[0]==="["||e[l]?(n.push(...s.sort(),l),s=[]):s.push(l)}),n.push(...s.sort()),n}},vK=t=>({cache:fK(t.cacheSize),parseClassName:mK(t),sortModifiers:gK(t),...lK(t)}),bK=/\s+/,yK=(t,e)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=e,l=[],c=t.trim().split(bK);let d="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{isExternal:h,modifiers:v,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:S}=r(m);if(h){d=m+(d.length>0?" "+d:d);continue}let R=!!S,x=a(R?_.substring(0,S):_);if(!x){if(!R){d=m+(d.length>0?" "+d:d);continue}if(x=a(_),!x){d=m+(d.length>0?" "+d:d);continue}R=!1}const T=s(v).join(":"),A=b?T+Tw:T,C=A+x;if(l.includes(C))continue;l.push(C);const k=n(x,R);for(let N=0;N<k.length;++N){const I=k[N];l.push(A+I)}d=m+(d.length>0?" "+d:d)}return d};function EK(){let t=0,e,r,a="";for(;t<arguments.length;)(e=arguments[t++])&&(r=$$(e))&&(a&&(a+=" "),a+=r);return a}const $$=t=>{if(typeof t=="string")return t;let e,r="";for(let a=0;a<t.length;a++)t[a]&&(e=$$(t[a]))&&(r&&(r+=" "),r+=e);return r};function SK(t,...e){let r,a,n,s=l;function l(d){const f=e.reduce((m,h)=>h(m),t());return r=vK(f),a=r.cache.get,n=r.cache.set,s=c,c(d)}function c(d){const f=a(d);if(f)return f;const m=yK(d,r);return n(d,m),m}return function(){return s(EK.apply(null,arguments))}}const Nr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},B$=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,q$=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xK=/^\d+\/\d+$/,_K=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ol=t=>xK.test(t),gt=t=>!!t&&!Number.isNaN(Number(t)),io=t=>!!t&&Number.isInteger(Number(t)),vb=t=>t.endsWith("%")&>(t.slice(0,-1)),pi=t=>_K.test(t),CK=()=>!0,NK=t=>wK.test(t)&&!TK.test(t),H$=()=>!1,kK=t=>RK.test(t),IK=t=>AK.test(t),OK=t=>!Be(t)&&!qe(t),DK=t=>tc(t,W$,H$),Be=t=>B$.test(t),Jo=t=>tc(t,Y$,NK),bb=t=>tc(t,jK,gt),tO=t=>tc(t,G$,H$),LK=t=>tc(t,V$,IK),$f=t=>tc(t,K$,kK),qe=t=>q$.test(t),tu=t=>rc(t,Y$),MK=t=>rc(t,FK),rO=t=>rc(t,G$),PK=t=>rc(t,W$),UK=t=>rc(t,V$),Bf=t=>rc(t,K$,!0),tc=(t,e,r)=>{const a=B$.exec(t);return a?a[1]?e(a[1]):r(a[2]):!1},rc=(t,e,r=!1)=>{const a=q$.exec(t);return a?a[1]?e(a[1]):r:!1},G$=t=>t==="position"||t==="percentage",V$=t=>t==="image"||t==="url",W$=t=>t==="length"||t==="size"||t==="bg-size",Y$=t=>t==="length",jK=t=>t==="number",FK=t=>t==="family-name",K$=t=>t==="shadow",zK=()=>{const t=Nr("color"),e=Nr("font"),r=Nr("text"),a=Nr("font-weight"),n=Nr("tracking"),s=Nr("leading"),l=Nr("breakpoint"),c=Nr("container"),d=Nr("spacing"),f=Nr("radius"),m=Nr("shadow"),h=Nr("inset-shadow"),v=Nr("text-shadow"),b=Nr("drop-shadow"),_=Nr("blur"),S=Nr("perspective"),R=Nr("aspect"),x=Nr("ease"),T=Nr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),qe,Be],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],O=()=>[qe,Be,d],P=()=>[ol,"full","auto",...O()],M=()=>[io,"none","subgrid",qe,Be],U=()=>["auto",{span:["full",io,qe,Be]},io,qe,Be],G=()=>[io,"auto",qe,Be],J=()=>["auto","min","max","fr",qe,Be],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...O()],q=()=>[ol,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],H=()=>[t,qe,Be],Q=()=>[...C(),rO,tO,{position:[qe,Be]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",PK,DK,{size:[qe,Be]}],W=()=>[vb,tu,Jo],F=()=>["","none","full",f,qe,Be],K=()=>["",gt,tu,Jo],re=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>[gt,vb,rO,tO],X=()=>["","none",_,qe,Be],ne=()=>["none",gt,qe,Be],ee=()=>["none",gt,qe,Be],ce=()=>[gt,qe,Be],ge=()=>[ol,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pi],breakpoint:[pi],color:[CK],container:[pi],"drop-shadow":[pi],ease:["in","out","in-out"],font:[OK],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pi],shadow:[pi],spacing:["px",gt],text:[pi],"text-shadow":[pi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ol,Be,qe,R]}],container:["container"],columns:[{columns:[gt,Be,qe,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[io,"auto",qe,Be]}],basis:[{basis:[ol,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gt,ol,"auto","initial","none",Be]}],grow:[{grow:["",gt,qe,Be]}],shrink:[{shrink:["",gt,qe,Be]}],order:[{order:[io,"first","last","none",qe,Be]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[c,"screen",...q()]}],"min-w":[{"min-w":[c,"screen","none",...q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",r,tu,Jo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,qe,bb]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",vb,Be]}],"font-family":[{font:[MK,Be,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,qe,Be]}],"line-clamp":[{"line-clamp":[gt,"none",qe,bb]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",qe,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[gt,"from-font","auto",qe,Jo]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[gt,"auto",qe,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qe,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},io,qe,Be],radial:["",qe,Be],conic:[io,qe,Be]},UK,LK]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gt,qe,Be]}],"outline-w":[{outline:["",gt,tu,Jo]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",m,Bf,$f]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,Bf,$f]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[gt,Jo]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",v,Bf,$f]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[gt,qe,Be]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[qe,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Be]}],filter:[{filter:["","none",qe,Be]}],blur:[{blur:X()}],brightness:[{brightness:[gt,qe,Be]}],contrast:[{contrast:[gt,qe,Be]}],"drop-shadow":[{"drop-shadow":["","none",b,Bf,$f]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",gt,qe,Be]}],"hue-rotate":[{"hue-rotate":[gt,qe,Be]}],invert:[{invert:["",gt,qe,Be]}],saturate:[{saturate:[gt,qe,Be]}],sepia:[{sepia:["",gt,qe,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Be]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[gt,qe,Be]}],"backdrop-contrast":[{"backdrop-contrast":[gt,qe,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gt,qe,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gt,qe,Be]}],"backdrop-invert":[{"backdrop-invert":["",gt,qe,Be]}],"backdrop-opacity":[{"backdrop-opacity":[gt,qe,Be]}],"backdrop-saturate":[{"backdrop-saturate":[gt,qe,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",gt,qe,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gt,"initial",qe,Be]}],ease:[{ease:["linear","initial",x,qe,Be]}],delay:[{delay:[gt,qe,Be]}],animate:[{animate:["none",T,qe,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,qe,Be]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[qe,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qe,Be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",qe,Be]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[gt,tu,Jo,bb]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$K=SK(zK);function Ue(...t){return $K(j$(t))}const BK=F$("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ba({className:t,variant:e,asChild:r=!1,...a}){const n=r?M$:"span";return g.jsx(n,{"data-slot":"badge",className:Ue(BK({variant:e}),t),...a})}const qK=F$("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-full gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-full px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function at({className:t,variant:e,size:r,asChild:a=!1,...n}){const s=a?M$:"button";return g.jsx(s,{"data-slot":"button",className:Ue(qK({variant:e,size:r,className:t})),...n})}var HK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=HK.reduce((t,e)=>{const r=So(`Primitive.${e}`),a=y.forwardRef((n,s)=>{const{asChild:l,...c}=n,d=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(d,{...c,ref:s})});return a.displayName=`Primitive.${e}`,{...t,[e]:a}},{});function Z$(t,e){t&&ec.flushSync(()=>t.dispatchEvent(e))}var GK="Label",X$=y.forwardRef((t,e)=>g.jsx(ot.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));X$.displayName=GK;var VK=X$;function ir({className:t,...e}){return g.jsx(VK,{"data-slot":"label",className:Ue("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function JT({message:t,className:e="",vertical:r,noBorder:a}){return g.jsx("div",{className:Ue(`mt-2 rounded-md p-6 ${e}`,!a&&"border"),children:g.jsxs("p",{className:Ue("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[g.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:g.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:g.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[g.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),g.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),g.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function Q$({className:t,color:e,children:r,grayscaled:a=!1}){const n=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[e,a]),s=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[e,a]),l=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[e]),c=y.useMemo(()=>e||`oklch(${Math.min(s,1)} ${n} ${l})`,[l,n,s]),d=y.useMemo(()=>`oklch(${Math.min(s*2,1)} ${n} ${l})`,[l,n,s,e]),f=y.useMemo(()=>Math.floor(Math.random()*360),[l]),m=y.useMemo(()=>"1000%",[]);return g.jsx("section",{className:Ue("relative w-full h-full overflow-hidden",t),style:{background:`${d}`},children:g.jsxs("div",{className:"isolate relative w-full h-full",children:[g.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),r&&g.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t?.(n),r===!1||!n.defaultPrevented)return e?.(n)}}function WK(t,e){const r=y.createContext(e),a=s=>{const{children:l,...c}=s,d=y.useMemo(()=>c,Object.values(c));return g.jsx(r.Provider,{value:d,children:l})};a.displayName=t+"Provider";function n(s){const l=y.useContext(r);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[a,n]}function Wa(t,e=[]){let r=[];function a(s,l){const c=y.createContext(l),d=r.length;r=[...r,l];const f=h=>{const{scope:v,children:b,..._}=h,S=v?.[t]?.[d]||c,R=y.useMemo(()=>_,Object.values(_));return g.jsx(S.Provider,{value:R,children:b})};f.displayName=s+"Provider";function m(h,v){const b=v?.[t]?.[d]||c,_=y.useContext(b);if(_)return _;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[f,m]}const n=()=>{const s=r.map(l=>y.createContext(l));return function(c){const d=c?.[t]||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return n.scopeName=t,[a,YK(n,...e)]}function YK(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const a=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(s){const l=a.reduce((c,{useScope:d,scopeName:f})=>{const h=d(s)[`__scope${f}`];return{...c,...h}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return r.scopeName=e.scopeName,r}var en=globalThis?.document?y.useLayoutEffect:()=>{},KK=UT[" useInsertionEffect ".trim().toString()]||en;function xo({prop:t,defaultProp:e,onChange:r=()=>{},caller:a}){const[n,s,l]=ZK({defaultProp:e,onChange:r}),c=t!==void 0,d=c?t:n;{const m=y.useRef(t!==void 0);y.useEffect(()=>{const h=m.current;h!==c&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=c},[c,a])}const f=y.useCallback(m=>{if(c){const h=XK(m)?m(t):m;h!==t&&l.current?.(h)}else s(m)},[c,t,s,l]);return[d,f]}function ZK({defaultProp:t,onChange:e}){const[r,a]=y.useState(t),n=y.useRef(r),s=y.useRef(e);return KK(()=>{s.current=e},[e]),y.useEffect(()=>{n.current!==r&&(s.current?.(r),n.current=r)},[r,n]),[r,a,s]}function XK(t){return typeof t=="function"}function J$(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function eB(t){const[e,r]=y.useState(void 0);return en(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let l,c;if("borderBoxSize"in s){const d=s.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=t.offsetWidth,c=t.offsetHeight;r({width:l,height:c})});return a.observe(t,{box:"border-box"}),()=>a.unobserve(t)}else r(void 0)},[t]),e}var _m="Switch",[QK]=Wa(_m),[JK,eZ]=QK(_m),tB=y.forwardRef((t,e)=>{const{__scopeSwitch:r,name:a,checked:n,defaultChecked:s,required:l,disabled:c,value:d="on",onCheckedChange:f,form:m,...h}=t,[v,b]=y.useState(null),_=At(e,A=>b(A)),S=y.useRef(!1),R=v?m||!!v.closest("form"):!0,[x,T]=xo({prop:n,defaultProp:s??!1,onChange:f,caller:_m});return g.jsxs(JK,{scope:r,checked:x,disabled:c,children:[g.jsx(ot.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":iB(x),"data-disabled":c?"":void 0,disabled:c,value:d,...h,ref:_,onClick:ze(t.onClick,A=>{T(C=>!C),R&&(S.current=A.isPropagationStopped(),S.current||A.stopPropagation())})}),R&&g.jsx(aB,{control:v,bubbles:!S.current,name:a,value:d,checked:x,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});tB.displayName=_m;var rB="SwitchThumb",nB=y.forwardRef((t,e)=>{const{__scopeSwitch:r,...a}=t,n=eZ(rB,r);return g.jsx(ot.span,{"data-state":iB(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:e})});nB.displayName=rB;var tZ="SwitchBubbleInput",aB=y.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:a=!0,...n},s)=>{const l=y.useRef(null),c=At(l,s),d=J$(r),f=eB(e);return y.useEffect(()=>{const m=l.current;if(!m)return;const h=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(h,"checked").set;if(d!==r&&b){const _=new Event("click",{bubbles:a});b.call(m,r),m.dispatchEvent(_)}},[d,r,a]),g.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:c,style:{...n.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});aB.displayName=tZ;function iB(t){return t?"checked":"unchecked"}var oB=tB,rZ=nB;function eR({ref:t,className:e,...r}){return g.jsx(oB,{className:Ue("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:t,children:g.jsx(rZ,{className:Ue("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}eR.displayName=oB.displayName;function qa(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...r)=>e.current?.(...r),[])}function nZ(t,e=globalThis?.document){const r=qa(t);y.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[r,e])}var aZ="DismissableLayer",Aw="dismissableLayer.update",iZ="dismissableLayer.pointerDownOutside",oZ="dismissableLayer.focusOutside",nO,sB=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=t,f=y.useContext(sB),[m,h]=y.useState(null),v=m?.ownerDocument??globalThis?.document,[,b]=y.useState({}),_=At(e,I=>h(I)),S=Array.from(f.layers),[R]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=S.indexOf(R),T=m?S.indexOf(m):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,C=T>=x,k=cZ(I=>{const O=I.target,P=[...f.branches].some(M=>M.contains(O));!C||P||(n?.(I),l?.(I),I.defaultPrevented||c?.())},v),N=uZ(I=>{const O=I.target;[...f.branches].some(M=>M.contains(O))||(s?.(I),l?.(I),I.defaultPrevented||c?.())},v);return nZ(I=>{T===f.layers.size-1&&(a?.(I),!I.defaultPrevented&&c&&(I.preventDefault(),c()))},v),y.useEffect(()=>{if(m)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(nO=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),aO(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=nO)}},[m,v,r,f]),y.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),aO())},[m,f]),y.useEffect(()=>{const I=()=>b({});return document.addEventListener(Aw,I),()=>document.removeEventListener(Aw,I)},[]),g.jsx(ot.div,{...d,ref:_,style:{pointerEvents:A?C?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,k.onPointerDownCapture)})});nc.displayName=aZ;var sZ="DismissableLayerBranch",lZ=y.forwardRef((t,e)=>{const r=y.useContext(sB),a=y.useRef(null),n=At(e,a);return y.useEffect(()=>{const s=a.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),g.jsx(ot.div,{...t,ref:n})});lZ.displayName=sZ;function cZ(t,e=globalThis?.document){const r=qa(t),a=y.useRef(!1),n=y.useRef(()=>{});return y.useEffect(()=>{const s=c=>{if(c.target&&!a.current){let d=function(){lB(iZ,r,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=d,e.addEventListener("click",n.current,{once:!0})):d()}else e.removeEventListener("click",n.current);a.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",s),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>a.current=!0}}function uZ(t,e=globalThis?.document){const r=qa(t),a=y.useRef(!1);return y.useEffect(()=>{const n=s=>{s.target&&!a.current&&lB(oZ,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function aO(){const t=new CustomEvent(Aw);document.dispatchEvent(t)}function lB(t,e,r,{discrete:a}){const n=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),a?Z$(n,s):n.dispatchEvent(s)}var dZ=UT[" useId ".trim().toString()]||(()=>{}),fZ=0;function Gr(t){const[e,r]=y.useState(dZ());return en(()=>{r(a=>a??String(fZ++))},[t]),t||(e?`radix-${e}`:"")}const pZ=["top","right","bottom","left"],_o=Math.min,Ln=Math.max,Zp=Math.round,qf=Math.floor,Ua=t=>({x:t,y:t}),mZ={left:"right",right:"left",bottom:"top",top:"bottom"},hZ={start:"end",end:"start"};function Cw(t,e,r){return Ln(t,_o(e,r))}function Ci(t,e){return typeof t=="function"?t(e):t}function Ni(t){return t.split("-")[0]}function ac(t){return t.split("-")[1]}function tR(t){return t==="x"?"y":"x"}function rR(t){return t==="y"?"height":"width"}const gZ=new Set(["top","bottom"]);function Da(t){return gZ.has(Ni(t))?"y":"x"}function nR(t){return tR(Da(t))}function vZ(t,e,r){r===void 0&&(r=!1);const a=ac(t),n=nR(t),s=rR(n);let l=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(l=Xp(l)),[l,Xp(l)]}function bZ(t){const e=Xp(t);return[Nw(t),e,Nw(e)]}function Nw(t){return t.replace(/start|end/g,e=>hZ[e])}const iO=["left","right"],oO=["right","left"],yZ=["top","bottom"],EZ=["bottom","top"];function SZ(t,e,r){switch(t){case"top":case"bottom":return r?e?oO:iO:e?iO:oO;case"left":case"right":return e?yZ:EZ;default:return[]}}function xZ(t,e,r,a){const n=ac(t);let s=SZ(Ni(t),r==="start",a);return n&&(s=s.map(l=>l+"-"+n),e&&(s=s.concat(s.map(Nw)))),s}function Xp(t){return t.replace(/left|right|bottom|top/g,e=>mZ[e])}function _Z(t){return{top:0,right:0,bottom:0,left:0,...t}}function cB(t){return typeof t!="number"?_Z(t):{top:t,right:t,bottom:t,left:t}}function Qp(t){const{x:e,y:r,width:a,height:n}=t;return{width:a,height:n,top:r,left:e,right:e+a,bottom:r+n,x:e,y:r}}function sO(t,e,r){let{reference:a,floating:n}=t;const s=Da(e),l=nR(e),c=rR(l),d=Ni(e),f=s==="y",m=a.x+a.width/2-n.width/2,h=a.y+a.height/2-n.height/2,v=a[c]/2-n[c]/2;let b;switch(d){case"top":b={x:m,y:a.y-n.height};break;case"bottom":b={x:m,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:h};break;case"left":b={x:a.x-n.width,y:h};break;default:b={x:a.x,y:a.y}}switch(ac(e)){case"start":b[l]-=v*(r&&f?-1:1);break;case"end":b[l]+=v*(r&&f?-1:1);break}return b}const wZ=async(t,e,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:s=[],platform:l}=r,c=s.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(e));let f=await l.getElementRects({reference:t,floating:e,strategy:n}),{x:m,y:h}=sO(f,a,d),v=a,b={},_=0;for(let S=0;S<c.length;S++){const{name:R,fn:x}=c[S],{x:T,y:A,data:C,reset:k}=await x({x:m,y:h,initialPlacement:a,placement:v,strategy:n,middlewareData:b,rects:f,platform:l,elements:{reference:t,floating:e}});m=T??m,h=A??h,b={...b,[R]:{...b[R],...C}},k&&_<=50&&(_++,typeof k=="object"&&(k.placement&&(v=k.placement),k.rects&&(f=k.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:n}):k.rects),{x:m,y:h}=sO(f,v,d)),S=-1)}return{x:m,y:h,placement:v,strategy:n,middlewareData:b}};async function Uu(t,e){var r;e===void 0&&(e={});const{x:a,y:n,platform:s,rects:l,elements:c,strategy:d}=t,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:v=!1,padding:b=0}=Ci(e,t),_=cB(b),R=c[v?h==="floating"?"reference":"floating":h],x=Qp(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(R)))==null||r?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:d})),T=h==="floating"?{x:a,y:n,width:l.floating.width,height:l.floating.height}:l.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},k=Qp(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:A,strategy:d}):T);return{top:(x.top-k.top+_.top)/C.y,bottom:(k.bottom-x.bottom+_.bottom)/C.y,left:(x.left-k.left+_.left)/C.x,right:(k.right-x.right+_.right)/C.x}}const TZ=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:a,placement:n,rects:s,platform:l,elements:c,middlewareData:d}=e,{element:f,padding:m=0}=Ci(t,e)||{};if(f==null)return{};const h=cB(m),v={x:r,y:a},b=nR(n),_=rR(b),S=await l.getDimensions(f),R=b==="y",x=R?"top":"left",T=R?"bottom":"right",A=R?"clientHeight":"clientWidth",C=s.reference[_]+s.reference[b]-v[b]-s.floating[_],k=v[b]-s.reference[b],N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let I=N?N[A]:0;(!I||!await(l.isElement==null?void 0:l.isElement(N)))&&(I=c.floating[A]||s.floating[_]);const O=C/2-k/2,P=I/2-S[_]/2-1,M=_o(h[x],P),U=_o(h[T],P),G=M,J=I-S[_]-U,V=I/2-S[_]/2+O,Y=Cw(G,V,J),j=!d.arrow&&ac(n)!=null&&V!==Y&&s.reference[_]/2-(V<G?M:U)-S[_]/2<0,q=j?V<G?V-G:V-J:0;return{[b]:v[b]+q,data:{[b]:Y,centerOffset:V-Y-q,...j&&{alignmentOffset:q}},reset:j}}}),RZ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,a;const{placement:n,middlewareData:s,rects:l,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:S=!0,...R}=Ci(t,e);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const x=Ni(n),T=Da(c),A=Ni(c)===c,C=await(d.isRTL==null?void 0:d.isRTL(f.floating)),k=v||(A||!S?[Xp(c)]:bZ(c)),N=_!=="none";!v&&N&&k.push(...xZ(c,S,_,C));const I=[c,...k],O=await Uu(e,R),P=[];let M=((a=s.flip)==null?void 0:a.overflows)||[];if(m&&P.push(O[x]),h){const V=vZ(n,l,C);P.push(O[V[0]],O[V[1]])}if(M=[...M,{placement:n,overflows:P}],!P.every(V=>V<=0)){var U,G;const V=(((U=s.flip)==null?void 0:U.index)||0)+1,Y=I[V];if(Y&&(!(h==="alignment"?T!==Da(Y):!1)||M.every(H=>Da(H.placement)===T?H.overflows[0]>0:!0)))return{data:{index:V,overflows:M},reset:{placement:Y}};let j=(G=M.filter(q=>q.overflows[0]<=0).sort((q,H)=>q.overflows[1]-H.overflows[1])[0])==null?void 0:G.placement;if(!j)switch(b){case"bestFit":{var J;const q=(J=M.filter(H=>{if(N){const Q=Da(H.placement);return Q===T||Q==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(Q=>Q>0).reduce((Q,ie)=>Q+ie,0)]).sort((H,Q)=>H[1]-Q[1])[0])==null?void 0:J[0];q&&(j=q);break}case"initialPlacement":j=c;break}if(n!==j)return{reset:{placement:j}}}return{}}}};function lO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function cO(t){return pZ.some(e=>t[e]>=0)}const AZ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:a="referenceHidden",...n}=Ci(t,e);switch(a){case"referenceHidden":{const s=await Uu(e,{...n,elementContext:"reference"}),l=lO(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:cO(l)}}}case"escaped":{const s=await Uu(e,{...n,altBoundary:!0}),l=lO(s,r.floating);return{data:{escapedOffsets:l,escaped:cO(l)}}}default:return{}}}}},uB=new Set(["left","top"]);async function CZ(t,e){const{placement:r,platform:a,elements:n}=t,s=await(a.isRTL==null?void 0:a.isRTL(n.floating)),l=Ni(r),c=ac(r),d=Da(r)==="y",f=uB.has(l)?-1:1,m=s&&d?-1:1,h=Ci(e,t);let{mainAxis:v,crossAxis:b,alignmentAxis:_}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof _=="number"&&(b=c==="end"?_*-1:_),d?{x:b*m,y:v*f}:{x:v*f,y:b*m}}const NZ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,a;const{x:n,y:s,placement:l,middlewareData:c}=e,d=await CZ(e,t);return l===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+d.x,y:s+d.y,data:{...d,placement:l}}}}},kZ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:a,placement:n}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:R=>{let{x,y:T}=R;return{x,y:T}}},...d}=Ci(t,e),f={x:r,y:a},m=await Uu(e,d),h=Da(Ni(n)),v=tR(h);let b=f[v],_=f[h];if(s){const R=v==="y"?"top":"left",x=v==="y"?"bottom":"right",T=b+m[R],A=b-m[x];b=Cw(T,b,A)}if(l){const R=h==="y"?"top":"left",x=h==="y"?"bottom":"right",T=_+m[R],A=_-m[x];_=Cw(T,_,A)}const S=c.fn({...e,[v]:b,[h]:_});return{...S,data:{x:S.x-r,y:S.y-a,enabled:{[v]:s,[h]:l}}}}}},IZ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:a,placement:n,rects:s,middlewareData:l}=e,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Ci(t,e),m={x:r,y:a},h=Da(n),v=tR(h);let b=m[v],_=m[h];const S=Ci(c,e),R=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(d){const A=v==="y"?"height":"width",C=s.reference[v]-s.floating[A]+R.mainAxis,k=s.reference[v]+s.reference[A]-R.mainAxis;b<C?b=C:b>k&&(b=k)}if(f){var x,T;const A=v==="y"?"width":"height",C=uB.has(Ni(n)),k=s.reference[h]-s.floating[A]+(C&&((x=l.offset)==null?void 0:x[h])||0)+(C?0:R.crossAxis),N=s.reference[h]+s.reference[A]+(C?0:((T=l.offset)==null?void 0:T[h])||0)-(C?R.crossAxis:0);_<k?_=k:_>N&&(_=N)}return{[v]:b,[h]:_}}}},OZ=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,a;const{placement:n,rects:s,platform:l,elements:c}=e,{apply:d=()=>{},...f}=Ci(t,e),m=await Uu(e,f),h=Ni(n),v=ac(n),b=Da(n)==="y",{width:_,height:S}=s.floating;let R,x;h==="top"||h==="bottom"?(R=h,x=v===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(x=h,R=v==="end"?"top":"bottom");const T=S-m.top-m.bottom,A=_-m.left-m.right,C=_o(S-m[R],T),k=_o(_-m[x],A),N=!e.middlewareData.shift;let I=C,O=k;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(O=A),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(I=T),N&&!v){const M=Ln(m.left,0),U=Ln(m.right,0),G=Ln(m.top,0),J=Ln(m.bottom,0);b?O=_-2*(M!==0||U!==0?M+U:Ln(m.left,m.right)):I=S-2*(G!==0||J!==0?G+J:Ln(m.top,m.bottom))}await d({...e,availableWidth:O,availableHeight:I});const P=await l.getDimensions(c.floating);return _!==P.width||S!==P.height?{reset:{rects:!0}}:{}}}};function wm(){return typeof window<"u"}function ic(t){return dB(t)?(t.nodeName||"").toLowerCase():"#document"}function Mn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ya(t){var e;return(e=(dB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function dB(t){return wm()?t instanceof Node||t instanceof Mn(t).Node:!1}function Ea(t){return wm()?t instanceof Element||t instanceof Mn(t).Element:!1}function Ha(t){return wm()?t instanceof HTMLElement||t instanceof Mn(t).HTMLElement:!1}function uO(t){return!wm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Mn(t).ShadowRoot}const DZ=new Set(["inline","contents"]);function cd(t){const{overflow:e,overflowX:r,overflowY:a,display:n}=Sa(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+r)&&!DZ.has(n)}const LZ=new Set(["table","td","th"]);function MZ(t){return LZ.has(ic(t))}const PZ=[":popover-open",":modal"];function Tm(t){return PZ.some(e=>{try{return t.matches(e)}catch{return!1}})}const UZ=["transform","translate","scale","rotate","perspective"],jZ=["transform","translate","scale","rotate","perspective","filter"],FZ=["paint","layout","strict","content"];function aR(t){const e=iR(),r=Ea(t)?Sa(t):t;return UZ.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||jZ.some(a=>(r.willChange||"").includes(a))||FZ.some(a=>(r.contain||"").includes(a))}function zZ(t){let e=wo(t);for(;Ha(e)&&!ql(e);){if(aR(e))return e;if(Tm(e))return null;e=wo(e)}return null}function iR(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $Z=new Set(["html","body","#document"]);function ql(t){return $Z.has(ic(t))}function Sa(t){return Mn(t).getComputedStyle(t)}function Rm(t){return Ea(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wo(t){if(ic(t)==="html")return t;const e=t.assignedSlot||t.parentNode||uO(t)&&t.host||Ya(t);return uO(e)?e.host:e}function fB(t){const e=wo(t);return ql(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ha(e)&&cd(e)?e:fB(e)}function ju(t,e,r){var a;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=fB(t),s=n===((a=t.ownerDocument)==null?void 0:a.body),l=Mn(n);if(s){const c=kw(l);return e.concat(l,l.visualViewport||[],cd(n)?n:[],c&&r?ju(c):[])}return e.concat(n,ju(n,[],r))}function kw(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function pB(t){const e=Sa(t);let r=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const n=Ha(t),s=n?t.offsetWidth:r,l=n?t.offsetHeight:a,c=Zp(r)!==s||Zp(a)!==l;return c&&(r=s,a=l),{width:r,height:a,$:c}}function oR(t){return Ea(t)?t:t.contextElement}function Dl(t){const e=oR(t);if(!Ha(e))return Ua(1);const r=e.getBoundingClientRect(),{width:a,height:n,$:s}=pB(e);let l=(s?Zp(r.width):r.width)/a,c=(s?Zp(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const BZ=Ua(0);function mB(t){const e=Mn(t);return!iR()||!e.visualViewport?BZ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function qZ(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Mn(t)?!1:e}function vs(t,e,r,a){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),s=oR(t);let l=Ua(1);e&&(a?Ea(a)&&(l=Dl(a)):l=Dl(t));const c=qZ(s,r,a)?mB(s):Ua(0);let d=(n.left+c.x)/l.x,f=(n.top+c.y)/l.y,m=n.width/l.x,h=n.height/l.y;if(s){const v=Mn(s),b=a&&Ea(a)?Mn(a):a;let _=v,S=kw(_);for(;S&&a&&b!==_;){const R=Dl(S),x=S.getBoundingClientRect(),T=Sa(S),A=x.left+(S.clientLeft+parseFloat(T.paddingLeft))*R.x,C=x.top+(S.clientTop+parseFloat(T.paddingTop))*R.y;d*=R.x,f*=R.y,m*=R.x,h*=R.y,d+=A,f+=C,_=Mn(S),S=kw(_)}}return Qp({width:m,height:h,x:d,y:f})}function Am(t,e){const r=Rm(t).scrollLeft;return e?e.left+r:vs(Ya(t)).left+r}function hB(t,e){const r=t.getBoundingClientRect(),a=r.left+e.scrollLeft-Am(t,r),n=r.top+e.scrollTop;return{x:a,y:n}}function HZ(t){let{elements:e,rect:r,offsetParent:a,strategy:n}=t;const s=n==="fixed",l=Ya(a),c=e?Tm(e.floating):!1;if(a===l||c&&s)return r;let d={scrollLeft:0,scrollTop:0},f=Ua(1);const m=Ua(0),h=Ha(a);if((h||!h&&!s)&&((ic(a)!=="body"||cd(l))&&(d=Rm(a)),Ha(a))){const b=vs(a);f=Dl(a),m.x=b.x+a.clientLeft,m.y=b.y+a.clientTop}const v=l&&!h&&!s?hB(l,d):Ua(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-d.scrollLeft*f.x+m.x+v.x,y:r.y*f.y-d.scrollTop*f.y+m.y+v.y}}function GZ(t){return Array.from(t.getClientRects())}function VZ(t){const e=Ya(t),r=Rm(t),a=t.ownerDocument.body,n=Ln(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),s=Ln(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let l=-r.scrollLeft+Am(t);const c=-r.scrollTop;return Sa(a).direction==="rtl"&&(l+=Ln(e.clientWidth,a.clientWidth)-n),{width:n,height:s,x:l,y:c}}const dO=25;function WZ(t,e){const r=Mn(t),a=Ya(t),n=r.visualViewport;let s=a.clientWidth,l=a.clientHeight,c=0,d=0;if(n){s=n.width,l=n.height;const m=iR();(!m||m&&e==="fixed")&&(c=n.offsetLeft,d=n.offsetTop)}const f=Am(a);if(f<=0){const m=a.ownerDocument,h=m.body,v=getComputedStyle(h),b=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,_=Math.abs(a.clientWidth-h.clientWidth-b);_<=dO&&(s-=_)}else f<=dO&&(s+=f);return{width:s,height:l,x:c,y:d}}const YZ=new Set(["absolute","fixed"]);function KZ(t,e){const r=vs(t,!0,e==="fixed"),a=r.top+t.clientTop,n=r.left+t.clientLeft,s=Ha(t)?Dl(t):Ua(1),l=t.clientWidth*s.x,c=t.clientHeight*s.y,d=n*s.x,f=a*s.y;return{width:l,height:c,x:d,y:f}}function fO(t,e,r){let a;if(e==="viewport")a=WZ(t,r);else if(e==="document")a=VZ(Ya(t));else if(Ea(e))a=KZ(e,r);else{const n=mB(t);a={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Qp(a)}function gB(t,e){const r=wo(t);return r===e||!Ea(r)||ql(r)?!1:Sa(r).position==="fixed"||gB(r,e)}function ZZ(t,e){const r=e.get(t);if(r)return r;let a=ju(t,[],!1).filter(c=>Ea(c)&&ic(c)!=="body"),n=null;const s=Sa(t).position==="fixed";let l=s?wo(t):t;for(;Ea(l)&&!ql(l);){const c=Sa(l),d=aR(l);!d&&c.position==="fixed"&&(n=null),(s?!d&&!n:!d&&c.position==="static"&&!!n&&YZ.has(n.position)||cd(l)&&!d&&gB(t,l))?a=a.filter(m=>m!==l):n=c,l=wo(l)}return e.set(t,a),a}function XZ(t){let{element:e,boundary:r,rootBoundary:a,strategy:n}=t;const l=[...r==="clippingAncestors"?Tm(e)?[]:ZZ(e,this._c):[].concat(r),a],c=l[0],d=l.reduce((f,m)=>{const h=fO(e,m,n);return f.top=Ln(h.top,f.top),f.right=_o(h.right,f.right),f.bottom=_o(h.bottom,f.bottom),f.left=Ln(h.left,f.left),f},fO(e,c,n));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function QZ(t){const{width:e,height:r}=pB(t);return{width:e,height:r}}function JZ(t,e,r){const a=Ha(e),n=Ya(e),s=r==="fixed",l=vs(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const d=Ua(0);function f(){d.x=Am(n)}if(a||!a&&!s)if((ic(e)!=="body"||cd(n))&&(c=Rm(e)),a){const b=vs(e,!0,s,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else n&&f();s&&!a&&n&&f();const m=n&&!a&&!s?hB(n,c):Ua(0),h=l.left+c.scrollLeft-d.x-m.x,v=l.top+c.scrollTop-d.y-m.y;return{x:h,y:v,width:l.width,height:l.height}}function yb(t){return Sa(t).position==="static"}function pO(t,e){if(!Ha(t)||Sa(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ya(t)===r&&(r=r.ownerDocument.body),r}function vB(t,e){const r=Mn(t);if(Tm(t))return r;if(!Ha(t)){let n=wo(t);for(;n&&!ql(n);){if(Ea(n)&&!yb(n))return n;n=wo(n)}return r}let a=pO(t,e);for(;a&&MZ(a)&&yb(a);)a=pO(a,e);return a&&ql(a)&&yb(a)&&!aR(a)?r:a||zZ(t)||r}const eX=async function(t){const e=this.getOffsetParent||vB,r=this.getDimensions,a=await r(t.floating);return{reference:JZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function tX(t){return Sa(t).direction==="rtl"}const rX={convertOffsetParentRelativeRectToViewportRelativeRect:HZ,getDocumentElement:Ya,getClippingRect:XZ,getOffsetParent:vB,getElementRects:eX,getClientRects:GZ,getDimensions:QZ,getScale:Dl,isElement:Ea,isRTL:tX};function bB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function nX(t,e){let r=null,a;const n=Ya(t);function s(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const f=t.getBoundingClientRect(),{left:m,top:h,width:v,height:b}=f;if(c||e(),!v||!b)return;const _=qf(h),S=qf(n.clientWidth-(m+v)),R=qf(n.clientHeight-(h+b)),x=qf(m),A={rootMargin:-_+"px "+-S+"px "+-R+"px "+-x+"px",threshold:Ln(0,_o(1,d))||1};let C=!0;function k(N){const I=N[0].intersectionRatio;if(I!==d){if(!C)return l();I?l(!1,I):a=setTimeout(()=>{l(!1,1e-7)},1e3)}I===1&&!bB(f,t.getBoundingClientRect())&&l(),C=!1}try{r=new IntersectionObserver(k,{...A,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,A)}r.observe(t)}return l(!0),s}function aX(t,e,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=a,f=oR(t),m=n||s?[...f?ju(f):[],...ju(e)]:[];m.forEach(x=>{n&&x.addEventListener("scroll",r,{passive:!0}),s&&x.addEventListener("resize",r)});const h=f&&c?nX(f,r):null;let v=-1,b=null;l&&(b=new ResizeObserver(x=>{let[T]=x;T&&T.target===f&&b&&(b.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=b)==null||A.observe(e)})),r()}),f&&!d&&b.observe(f),b.observe(e));let _,S=d?vs(t):null;d&&R();function R(){const x=vs(t);S&&!bB(S,x)&&r(),S=x,_=requestAnimationFrame(R)}return r(),()=>{var x;m.forEach(T=>{n&&T.removeEventListener("scroll",r),s&&T.removeEventListener("resize",r)}),h?.(),(x=b)==null||x.disconnect(),b=null,d&&cancelAnimationFrame(_)}}const iX=NZ,oX=kZ,sX=RZ,lX=OZ,cX=AZ,mO=TZ,uX=IZ,dX=(t,e,r)=>{const a=new Map,n={platform:rX,...r},s={...n.platform,_c:a};return wZ(t,e,{...n,platform:s})};var fX=typeof document<"u",pX=function(){},dp=fX?y.useLayoutEffect:pX;function Jp(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,a,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(a=r;a--!==0;)if(!Jp(t[a],e[a]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(e,n[a]))return!1;for(a=r;a--!==0;){const s=n[a];if(!(s==="_owner"&&t.$$typeof)&&!Jp(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function yB(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function hO(t,e){const r=yB(t);return Math.round(e*r)/r}function Eb(t){const e=y.useRef(t);return dp(()=>{e.current=t}),e}function mX(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:d,open:f}=t,[m,h]=y.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[v,b]=y.useState(a);Jp(v,a)||b(a);const[_,S]=y.useState(null),[R,x]=y.useState(null),T=y.useCallback(H=>{H!==N.current&&(N.current=H,S(H))},[]),A=y.useCallback(H=>{H!==I.current&&(I.current=H,x(H))},[]),C=s||_,k=l||R,N=y.useRef(null),I=y.useRef(null),O=y.useRef(m),P=d!=null,M=Eb(d),U=Eb(n),G=Eb(f),J=y.useCallback(()=>{if(!N.current||!I.current)return;const H={placement:e,strategy:r,middleware:v};U.current&&(H.platform=U.current),dX(N.current,I.current,H).then(Q=>{const ie={...Q,isPositioned:G.current!==!1};V.current&&!Jp(O.current,ie)&&(O.current=ie,ec.flushSync(()=>{h(ie)}))})},[v,e,r,U,G]);dp(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[f]);const V=y.useRef(!1);dp(()=>(V.current=!0,()=>{V.current=!1}),[]),dp(()=>{if(C&&(N.current=C),k&&(I.current=k),C&&k){if(M.current)return M.current(C,k,J);J()}},[C,k,J,M,P]);const Y=y.useMemo(()=>({reference:N,floating:I,setReference:T,setFloating:A}),[T,A]),j=y.useMemo(()=>({reference:C,floating:k}),[C,k]),q=y.useMemo(()=>{const H={position:r,left:0,top:0};if(!j.floating)return H;const Q=hO(j.floating,m.x),ie=hO(j.floating,m.y);return c?{...H,transform:"translate("+Q+"px, "+ie+"px)",...yB(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:ie}},[r,c,j.floating,m.x,m.y]);return y.useMemo(()=>({...m,update:J,refs:Y,elements:j,floatingStyles:q}),[m,J,Y,j,q])}const hX=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:a,padding:n}=typeof t=="function"?t(r):t;return a&&e(a)?a.current!=null?mO({element:a.current,padding:n}).fn(r):{}:a?mO({element:a,padding:n}).fn(r):{}}}},gX=(t,e)=>({...iX(t),options:[t,e]}),vX=(t,e)=>({...oX(t),options:[t,e]}),bX=(t,e)=>({...uX(t),options:[t,e]}),yX=(t,e)=>({...sX(t),options:[t,e]}),EX=(t,e)=>({...lX(t),options:[t,e]}),SX=(t,e)=>({...cX(t),options:[t,e]}),xX=(t,e)=>({...hX(t),options:[t,e]});var _X="Arrow",EB=y.forwardRef((t,e)=>{const{children:r,width:a=10,height:n=5,...s}=t;return g.jsx(ot.svg,{...s,ref:e,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});EB.displayName=_X;var wX=EB,sR="Popper",[SB,Co]=Wa(sR),[TX,xB]=SB(sR),_B=t=>{const{__scopePopper:e,children:r}=t,[a,n]=y.useState(null);return g.jsx(TX,{scope:e,anchor:a,onAnchorChange:n,children:r})};_B.displayName=sR;var wB="PopperAnchor",TB=y.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:a,...n}=t,s=xB(wB,r),l=y.useRef(null),c=At(e,l),d=y.useRef(null);return y.useEffect(()=>{const f=d.current;d.current=a?.current||l.current,f!==d.current&&s.onAnchorChange(d.current)}),a?null:g.jsx(ot.div,{...n,ref:c})});TB.displayName=wB;var lR="PopperContent",[RX,AX]=SB(lR),RB=y.forwardRef((t,e)=>{const{__scopePopper:r,side:a="bottom",sideOffset:n=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:_,...S}=t,R=xB(lR,r),[x,T]=y.useState(null),A=At(e,L=>T(L)),[C,k]=y.useState(null),N=eB(C),I=N?.width??0,O=N?.height??0,P=a+(s!=="center"?"-"+s:""),M=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},U=Array.isArray(f)?f:[f],G=U.length>0,J={padding:M,boundary:U.filter(NX),altBoundary:G},{refs:V,floatingStyles:Y,placement:j,isPositioned:q,middlewareData:H}=mX({strategy:"fixed",placement:P,whileElementsMounted:(...L)=>aX(...L,{animationFrame:b==="always"}),elements:{reference:R.anchor},middleware:[gX({mainAxis:n+O,alignmentAxis:l}),d&&vX({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?bX():void 0,...J}),d&&yX({...J}),EX({...J,apply:({elements:L,rects:X,availableWidth:ne,availableHeight:ee})=>{const{width:ce,height:ge}=X.reference,Ae=L.floating.style;Ae.setProperty("--radix-popper-available-width",`${ne}px`),Ae.setProperty("--radix-popper-available-height",`${ee}px`),Ae.setProperty("--radix-popper-anchor-width",`${ce}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),C&&xX({element:C,padding:c}),kX({arrowWidth:I,arrowHeight:O}),v&&SX({strategy:"referenceHidden",...J})]}),[Q,ie]=NB(j),$=qa(_);en(()=>{q&&$?.()},[q,$]);const W=H.arrow?.x,F=H.arrow?.y,K=H.arrow?.centerOffset!==0,[re,B]=y.useState();return en(()=>{x&&B(window.getComputedStyle(x).zIndex)},[x]),g.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:q?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(RX,{scope:r,placedSide:Q,onArrowChange:k,arrowX:W,arrowY:F,shouldHideArrow:K,children:g.jsx(ot.div,{"data-side":Q,"data-align":ie,...S,ref:A,style:{...S.style,animation:q?void 0:"none"}})})})});RB.displayName=lR;var AB="PopperArrow",CX={top:"bottom",right:"left",bottom:"top",left:"right"},CB=y.forwardRef(function(e,r){const{__scopePopper:a,...n}=e,s=AX(AB,a),l=CX[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(wX,{...n,ref:r,style:{...n.style,display:"block"}})})});CB.displayName=AB;function NX(t){return t!==null}var kX=t=>({name:"transformOrigin",options:t,fn(e){const{placement:r,rects:a,middlewareData:n}=e,l=n.arrow?.centerOffset!==0,c=l?0:t.arrowWidth,d=l?0:t.arrowHeight,[f,m]=NB(r),h={start:"0%",center:"50%",end:"100%"}[m],v=(n.arrow?.x??0)+c/2,b=(n.arrow?.y??0)+d/2;let _="",S="";return f==="bottom"?(_=l?h:`${v}px`,S=`${-d}px`):f==="top"?(_=l?h:`${v}px`,S=`${a.floating.height+d}px`):f==="right"?(_=`${-d}px`,S=l?h:`${b}px`):f==="left"&&(_=`${a.floating.width+d}px`,S=l?h:`${b}px`),{data:{x:_,y:S}}}});function NB(t){const[e,r="center"]=t.split("-");return[e,r]}var Cm=_B,ud=TB,Nm=RB,km=CB,IX="Portal",oc=y.forwardRef((t,e)=>{const{container:r,...a}=t,[n,s]=y.useState(!1);en(()=>s(!0),[]);const l=r||n&&globalThis?.document?.body;return l?A$.createPortal(g.jsx(ot.div,{...a,ref:e}),l):null});oc.displayName=IX;function OX(t,e){return y.useReducer((r,a)=>e[r][a]??r,t)}var oa=t=>{const{present:e,children:r}=t,a=DX(e),n=typeof r=="function"?r({present:a.isPresent}):y.Children.only(r),s=At(a.ref,LX(n));return typeof r=="function"||a.isPresent?y.cloneElement(n,{ref:s}):null};oa.displayName="Presence";function DX(t){const[e,r]=y.useState(),a=y.useRef(null),n=y.useRef(t),s=y.useRef("none"),l=t?"mounted":"unmounted",[c,d]=OX(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const f=Hf(a.current);s.current=c==="mounted"?f:"none"},[c]),en(()=>{const f=a.current,m=n.current;if(m!==t){const v=s.current,b=Hf(f);t?d("MOUNT"):b==="none"||f?.display==="none"?d("UNMOUNT"):d(m&&v!==b?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,d]),en(()=>{if(e){let f;const m=e.ownerDocument.defaultView??window,h=b=>{const S=Hf(a.current).includes(CSS.escape(b.animationName));if(b.target===e&&S&&(d("ANIMATION_END"),!n.current)){const R=e.style.animationFillMode;e.style.animationFillMode="forwards",f=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=R)})}},v=b=>{b.target===e&&(s.current=Hf(a.current))};return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{m.clearTimeout(f),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(f=>{a.current=f?getComputedStyle(f):null,r(f)},[])}}function Hf(t){return t?.animationName||"none"}function LX(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var kB=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"}),MX="VisuallyHidden",IB=y.forwardRef((t,e)=>g.jsx(ot.span,{...t,ref:e,style:{...kB,...t.style}}));IB.displayName=MX;var PX=IB,[Im]=Wa("Tooltip",[Co]),Om=Co(),OB="TooltipProvider",UX=700,Iw="tooltip.open",[jX,cR]=Im(OB),DB=t=>{const{__scopeTooltip:e,delayDuration:r=UX,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:s}=t,l=y.useRef(!0),c=y.useRef(!1),d=y.useRef(0);return y.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),g.jsx(jX,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:y.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:y.useCallback(f=>{c.current=f},[]),disableHoverableContent:n,children:s})};DB.displayName=OB;var Fu="Tooltip",[FX,dd]=Im(Fu),LB=t=>{const{__scopeTooltip:e,children:r,open:a,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=t,d=cR(Fu,t.__scopeTooltip),f=Om(e),[m,h]=y.useState(null),v=Gr(),b=y.useRef(0),_=l??d.disableHoverableContent,S=c??d.delayDuration,R=y.useRef(!1),[x,T]=xo({prop:a,defaultProp:n??!1,onChange:I=>{I?(d.onOpen(),document.dispatchEvent(new CustomEvent(Iw))):d.onClose(),s?.(I)},caller:Fu}),A=y.useMemo(()=>x?R.current?"delayed-open":"instant-open":"closed",[x]),C=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R.current=!1,T(!0)},[T]),k=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T(!1)},[T]),N=y.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{R.current=!0,T(!0),b.current=0},S)},[S,T]);return y.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),g.jsx(Cm,{...f,children:g.jsx(FX,{scope:e,contentId:v,open:x,stateAttribute:A,trigger:m,onTriggerChange:h,onTriggerEnter:y.useCallback(()=>{d.isOpenDelayedRef.current?N():C()},[d.isOpenDelayedRef,N,C]),onTriggerLeave:y.useCallback(()=>{_?k():(window.clearTimeout(b.current),b.current=0)},[k,_]),onOpen:C,onClose:k,disableHoverableContent:_,children:r})})};LB.displayName=Fu;var Ow="TooltipTrigger",MB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=dd(Ow,r),s=cR(Ow,r),l=Om(r),c=y.useRef(null),d=At(e,c,n.onTriggerChange),f=y.useRef(!1),m=y.useRef(!1),h=y.useCallback(()=>f.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),g.jsx(ud,{asChild:!0,...l,children:g.jsx(ot.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:d,onPointerMove:ze(t.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),m.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{n.onTriggerLeave(),m.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{n.open&&n.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ze(t.onFocus,()=>{f.current||n.onOpen()}),onBlur:ze(t.onBlur,n.onClose),onClick:ze(t.onClick,n.onClose)})})});MB.displayName=Ow;var uR="TooltipPortal",[zX,$X]=Im(uR,{forceMount:void 0}),PB=t=>{const{__scopeTooltip:e,forceMount:r,children:a,container:n}=t,s=dd(uR,e);return g.jsx(zX,{scope:e,forceMount:r,children:g.jsx(oa,{present:r||s.open,children:g.jsx(oc,{asChild:!0,container:n,children:a})})})};PB.displayName=uR;var Hl="TooltipContent",UB=y.forwardRef((t,e)=>{const r=$X(Hl,t.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...s}=t,l=dd(Hl,t.__scopeTooltip);return g.jsx(oa,{present:a||l.open,children:l.disableHoverableContent?g.jsx(jB,{side:n,...s,ref:e}):g.jsx(BX,{side:n,...s,ref:e})})}),BX=y.forwardRef((t,e)=>{const r=dd(Hl,t.__scopeTooltip),a=cR(Hl,t.__scopeTooltip),n=y.useRef(null),s=At(e,n),[l,c]=y.useState(null),{trigger:d,onClose:f}=r,m=n.current,{onPointerInTransitChange:h}=a,v=y.useCallback(()=>{c(null),h(!1)},[h]),b=y.useCallback((_,S)=>{const R=_.currentTarget,x={x:_.clientX,y:_.clientY},T=VX(x,R.getBoundingClientRect()),A=WX(x,T),C=YX(S.getBoundingClientRect()),k=ZX([...A,...C]);c(k),h(!0)},[h]);return y.useEffect(()=>()=>v(),[v]),y.useEffect(()=>{if(d&&m){const _=R=>b(R,m),S=R=>b(R,d);return d.addEventListener("pointerleave",_),m.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",_),m.removeEventListener("pointerleave",S)}}},[d,m,b,v]),y.useEffect(()=>{if(l){const _=S=>{const R=S.target,x={x:S.clientX,y:S.clientY},T=d?.contains(R)||m?.contains(R),A=!KX(x,l);T?v():A&&(v(),f())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[d,m,l,f,v]),g.jsx(jB,{...t,ref:s})}),[qX,HX]=Im(Fu,{isInside:!1}),GX=aK("TooltipContent"),jB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=t,d=dd(Hl,r),f=Om(r),{onClose:m}=d;return y.useEffect(()=>(document.addEventListener(Iw,m),()=>document.removeEventListener(Iw,m)),[m]),y.useEffect(()=>{if(d.trigger){const h=v=>{v.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,m]),g.jsx(nc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:g.jsxs(Nm,{"data-state":d.stateAttribute,...f,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(GX,{children:a}),g.jsx(qX,{scope:r,isInside:!0,children:g.jsx(PX,{id:d.contentId,role:"tooltip",children:n||a})})]})})});UB.displayName=Hl;var FB="TooltipArrow",zB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=Om(r);return HX(FB,r).isInside?null:g.jsx(km,{...n,...a,ref:e})});zB.displayName=FB;function VX(t,e){const r=Math.abs(e.top-t.y),a=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(r,a,n,s)){case s:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function WX(t,e,r=5){const a=[];switch(e){case"top":a.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":a.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":a.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":a.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return a}function YX(t){const{top:e,right:r,bottom:a,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:a},{x:n,y:a}]}function KX(t,e){const{x:r,y:a}=t;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,m=c.y,h=d.x,v=d.y;m>a!=v>a&&r<(h-f)*(a-m)/(v-m)+f&&(n=!n)}return n}function ZX(t){const e=t.slice();return e.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),XX(e)}function XX(t){if(t.length<=1)return t.slice();const e=[];for(let a=0;a<t.length;a++){const n=t[a];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let a=t.length-1;a>=0;a--){const n=t[a];for(;r.length>=2;){const s=r[r.length-1],l=r[r.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var QX=DB,JX=LB,eQ=MB,tQ=PB,rQ=UB,nQ=zB;function $B({delayDuration:t=0,...e}){return g.jsx(QX,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Zr({...t}){return g.jsx($B,{children:g.jsx(JX,{"data-slot":"tooltip",...t})})}function Xr({...t}){return g.jsx(eQ,{"data-slot":"tooltip-trigger",...t})}function Qr({className:t,sideOffset:e=0,children:r,...a}){return g.jsx(tQ,{children:g.jsxs(rQ,{"data-slot":"tooltip-content",sideOffset:e,className:Ue("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...a,children:[r,g.jsx(nQ,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class aQ{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class gO{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class vO{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class bO{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class yO{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class iQ{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class oQ{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class sQ{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class lQ{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function Sb(){try{return"0.4.9"}catch{return"0.0.0"}}var cQ={};function xb(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class EO{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,a=setTimeout(()=>r.abort(),this.timeout),n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(a),!n.ok)throw new Error(`HTTP error! status: ${n.status}`)}catch{}}}function oo(t){return`mcp_inspector_telemetry_${t}`}class Mr{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const e=xb(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new EO(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new EO(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(oo("disabled"))==="true"||typeof process<"u"&&cQ?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(oo("source")):null}static getInstance(){return Mr.instance||(Mr.instance=new Mr),Mr.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(oo("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!xb())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(oo("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(oo("user_id"),r),this._currUserId=r}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:Sb(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=Sb(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&xb())try{const r=Sb();let a=!1,n=!1;const s=localStorage.getItem(oo("download_version"));if(s?r>s&&(a=!0,n=!1,localStorage.setItem(oo("download_version"),r)):(a=!0,n=!0,localStorage.setItem(oo("download_version"),r)),a){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=n,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new aQ(e);await this.capture(r)}}const BB=y.createContext(void 0);function uQ({url:t,name:e,proxyConfig:r,transportType:a,onUpdate:n,onRemove:s}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let c=t,d={};if(r?.proxyAddress){const v=new URL(r.proxyAddress),b=new URL(t);c=`${v.origin}${v.pathname}${b.pathname}${b.search}`,d["X-Target-URL"]=t}r?.customHeaders&&(d={...d,...r.customHeaders});const f=BT({url:c,callbackUrl:l,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http"}),m=y.useRef(n),h=y.useRef(null);return y.useEffect(()=>{m.current=n},[n]),y.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{const v={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage},b=h.current;(!b||b.state!==v.state||b.error!==v.error||b.authUrl!==v.authUrl||b.tools.length!==v.tools.length||b.resources.length!==v.resources.length||b.prompts.length!==v.prompts.length)&&(h.current=v,m.current(v))});else{const v={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage},b=h.current;(!b||b.state!==v.state||b.error!==v.error||b.authUrl!==v.authUrl||b.tools.length!==v.tools.length||b.resources.length!==v.resources.length||b.prompts.length!==v.prompts.length)&&(h.current=v,m.current(v))}},[t,e,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl]),null}function dQ({children:t}){const[e,r]=y.useState([]),[a,n]=y.useState(new Map),[s,l]=y.useState(0),[c,d]=y.useState(!0),[f,m]=y.useState(new Set);y.useEffect(()=>{const C=localStorage.getItem("mcp-inspector-connections");if(C)try{const N=JSON.parse(C),I=Array.isArray(N)?N.filter(P=>P&&typeof P=="object"&&typeof P.id=="string"&&typeof P.url=="string"&&typeof P.name=="string").map(P=>(P.transportType||(P.transportType="http"),P)):[];(I.length!==N.length||I.some(P=>P.transportType==="http"&&!N.find(M=>M.id===P.id&&M.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(I))),r(I)}catch(N){console.error("Failed to parse saved connections:",N),localStorage.removeItem("mcp-inspector-connections")}const k=localStorage.getItem("mcp-inspector-auto-connect");k!==null&&d(k==="true")},[]);const h=y.useCallback(C=>{n(k=>new Map(k).set(C.id,C)),l(k=>k+1)},[]),v=y.useCallback((C,k,N,I)=>{const P={id:C,url:C,name:k||C,proxyConfig:N,transportType:I||"http"};r(M=>{if(M.some(G=>G.id===C))return M;const U=[...M,P];return localStorage.setItem("mcp-inspector-connections",JSON.stringify(U)),U})},[]),b=y.useCallback(C=>{Mr.getInstance().capture(new oQ({serverId:C})).catch(()=>{}),r(N=>{const I=N.filter(O=>O.id!==C);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(I)),I}),n(N=>{const I=new Map(N),O=I.get(C);if(O){try{O.clearStorage()}catch(P){console.error("Failed to clear storage:",P)}I.delete(C)}return I})},[]),_=y.useCallback(C=>{const k=a.get(C);if(k)return k;const N=e.find(I=>I.id===C);if(N)return{id:N.id,url:N.url,name:N.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,listPrompts:async I=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{}}},[a,e]),S=y.useCallback(C=>{d(C),localStorage.setItem("mcp-inspector-auto-connect",String(C)),C||m(new Set)},[]),R=y.useCallback(C=>{m(k=>new Set(k).add(C))},[]),x=y.useCallback(C=>{m(k=>{const N=new Set(k);return N.delete(C),N}),n(k=>{const N=new Map(k),I=N.get(C);if(I){try{I.clearStorage()}catch(O){console.error("Failed to clear storage:",O)}N.delete(C)}return N})},[]),T=y.useMemo(()=>{const C=e.map(k=>{const N=a.get(k.id);return N||{id:k.id,url:k.url,name:k.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async I=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{}}});return console.warn("[McpContext] Connections updated, version:",s,"count:",C.length,"states:",C.map(k=>`${k.id}:${k.state}`)),C},[a,e,s]),A=y.useMemo(()=>({connections:T,addConnection:v,removeConnection:b,getConnection:_,autoConnect:c,setAutoConnect:S,connectServer:R,disconnectServer:x}),[T,v,b,_,c,S,R,x]);return g.jsxs(BB,{value:A,children:[e.filter(C=>c||f.has(C.id)).map(C=>g.jsx(uQ,{url:C.url,name:C.name,proxyConfig:C.proxyConfig,transportType:C.transportType,onUpdate:h,onRemove:()=>b(C.id)},C.id)),t]})}function dR(){const t=y.use(BB);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}var _b="focusScope.autoFocusOnMount",wb="focusScope.autoFocusOnUnmount",SO={bubbles:!1,cancelable:!0},fQ="FocusScope",fd=y.forwardRef((t,e)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...l}=t,[c,d]=y.useState(null),f=qa(n),m=qa(s),h=y.useRef(null),v=At(e,S=>d(S)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(a){let S=function(A){if(b.paused||!c)return;const C=A.target;c.contains(C)?h.current=C:lo(h.current,{select:!0})},R=function(A){if(b.paused||!c)return;const C=A.relatedTarget;C!==null&&(c.contains(C)||lo(h.current,{select:!0}))},x=function(A){if(document.activeElement===document.body)for(const k of A)k.removedNodes.length>0&&lo(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",R);const T=new MutationObserver(x);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",R),T.disconnect()}}},[a,c,b.paused]),y.useEffect(()=>{if(c){_O.add(b);const S=document.activeElement;if(!c.contains(S)){const x=new CustomEvent(_b,SO);c.addEventListener(_b,f),c.dispatchEvent(x),x.defaultPrevented||(pQ(bQ(qB(c)),{select:!0}),document.activeElement===S&&lo(c))}return()=>{c.removeEventListener(_b,f),setTimeout(()=>{const x=new CustomEvent(wb,SO);c.addEventListener(wb,m),c.dispatchEvent(x),x.defaultPrevented||lo(S??document.body,{select:!0}),c.removeEventListener(wb,m),_O.remove(b)},0)}}},[c,f,m,b]);const _=y.useCallback(S=>{if(!r&&!a||b.paused)return;const R=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,x=document.activeElement;if(R&&x){const T=S.currentTarget,[A,C]=mQ(T);A&&C?!S.shiftKey&&x===C?(S.preventDefault(),r&&lo(A,{select:!0})):S.shiftKey&&x===A&&(S.preventDefault(),r&&lo(C,{select:!0})):x===T&&S.preventDefault()}},[r,a,b.paused]);return g.jsx(ot.div,{tabIndex:-1,...l,ref:v,onKeyDown:_})});fd.displayName=fQ;function pQ(t,{select:e=!1}={}){const r=document.activeElement;for(const a of t)if(lo(a,{select:e}),document.activeElement!==r)return}function mQ(t){const e=qB(t),r=xO(e,t),a=xO(e.reverse(),t);return[r,a]}function qB(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function xO(t,e){for(const r of t)if(!hQ(r,{upTo:e}))return r}function hQ(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function gQ(t){return t instanceof HTMLInputElement&&"select"in t}function lo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&gQ(t)&&e&&t.select()}}var _O=vQ();function vQ(){let t=[];return{add(e){const r=t[0];e!==r&&r?.pause(),t=wO(t,e),t.unshift(e)},remove(e){t=wO(t,e),t[0]?.resume()}}}function wO(t,e){const r=[...t],a=r.indexOf(e);return a!==-1&&r.splice(a,1),r}function bQ(t){return t.filter(e=>e.tagName!=="A")}var Tb=0;function Dm(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??TO()),document.body.insertAdjacentElement("beforeend",t[1]??TO()),Tb++,()=>{Tb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tb--}},[])}function TO(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Oa=function(){return Oa=Object.assign||function(e){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Oa.apply(this,arguments)};function HB(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)e.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(r[a[n]]=t[a[n]]);return r}function yQ(t,e,r){if(r||arguments.length===2)for(var a=0,n=e.length,s;a<n;a++)(s||!(a in e))&&(s||(s=Array.prototype.slice.call(e,0,a)),s[a]=e[a]);return t.concat(s||Array.prototype.slice.call(e))}var fp="right-scroll-bar-position",pp="width-before-scroll-bar",EQ="with-scroll-bars-hidden",SQ="--removed-body-scroll-bar-size";function Rb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function xQ(t,e){var r=y.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=e,r.facade}var _Q=typeof window<"u"?y.useLayoutEffect:y.useEffect,RO=new WeakMap;function wQ(t,e){var r=xQ(null,function(a){return t.forEach(function(n){return Rb(n,a)})});return _Q(function(){var a=RO.get(r);if(a){var n=new Set(a),s=new Set(t),l=r.current;n.forEach(function(c){s.has(c)||Rb(c,null)}),s.forEach(function(c){n.has(c)||Rb(c,l)})}RO.set(r,t)},[t]),r}function TQ(t){return t}function RQ(t,e){e===void 0&&(e=TQ);var r=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var l=e(s,a);return r.push(l),function(){r=r.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(a=!0;r.length;){var l=r;r=[],l.forEach(s)}r={push:function(c){return s(c)},filter:function(){return r}}},assignMedium:function(s){a=!0;var l=[];if(r.length){var c=r;r=[],c.forEach(s),l=r}var d=function(){var m=l;l=[],m.forEach(s)},f=function(){return Promise.resolve().then(d)};f(),r={push:function(m){l.push(m),f()},filter:function(m){return l=l.filter(m),r}}}};return n}function AQ(t){t===void 0&&(t={});var e=RQ(null);return e.options=Oa({async:!0,ssr:!1},t),e}var GB=function(t){var e=t.sideCar,r=HB(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return y.createElement(a,Oa({},r))};GB.isSideCarExport=!0;function CQ(t,e){return t.useMedium(e),GB}var VB=AQ(),Ab=function(){},Lm=y.forwardRef(function(t,e){var r=y.useRef(null),a=y.useState({onScrollCapture:Ab,onWheelCapture:Ab,onTouchMoveCapture:Ab}),n=a[0],s=a[1],l=t.forwardProps,c=t.children,d=t.className,f=t.removeScrollBar,m=t.enabled,h=t.shards,v=t.sideCar,b=t.noRelative,_=t.noIsolation,S=t.inert,R=t.allowPinchZoom,x=t.as,T=x===void 0?"div":x,A=t.gapMode,C=HB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=v,N=wQ([r,e]),I=Oa(Oa({},C),n);return y.createElement(y.Fragment,null,m&&y.createElement(k,{sideCar:VB,removeScrollBar:f,shards:h,noRelative:b,noIsolation:_,inert:S,setCallbacks:s,allowPinchZoom:!!R,lockRef:r,gapMode:A}),l?y.cloneElement(y.Children.only(c),Oa(Oa({},I),{ref:N})):y.createElement(T,Oa({},I,{className:d,ref:N}),c))});Lm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lm.classNames={fullWidth:pp,zeroRight:fp};var NQ=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kQ(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=NQ();return e&&t.setAttribute("nonce",e),t}function IQ(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function OQ(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var DQ=function(){var t=0,e=null;return{add:function(r){t==0&&(e=kQ())&&(IQ(e,r),OQ(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},LQ=function(){var t=DQ();return function(e,r){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},WB=function(){var t=LQ(),e=function(r){var a=r.styles,n=r.dynamic;return t(a,n),null};return e},MQ={left:0,top:0,right:0,gap:0},Cb=function(t){return parseInt(t||"",10)||0},PQ=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],a=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[Cb(r),Cb(a),Cb(n)]},UQ=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return MQ;var e=PQ(t),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-r+e[2]-e[0])}},jQ=WB(),Ll="data-scroll-locked",FQ=function(t,e,r,a){var n=t.left,s=t.top,l=t.right,c=t.gap;return r===void 0&&(r="margin"),`
|
|
314
|
+
*/const NY=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Pu=lt("zap",NY);function kY(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const IY=t=>{switch(t){case"success":return LY;case"info":return PY;case"warning":return MY;case"error":return UY;default:return null}},OY=Array(12).fill(0),DY=({visible:t,className:e})=>Ce.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Ce.createElement("div",{className:"sonner-spinner"},OY.map((r,a)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),LY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),MY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),PY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),UY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),jY=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),FY=()=>{const[t,e]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let _w=1;class zY{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:a,...n}=e,s=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:_w++,l=this.toasts.find(d=>d.id===s),c=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),l?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:a}),{...d,...e,id:s,dismissible:c,title:a}):d):this.addToast({title:a,...n,dismissible:c,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(e instanceof Function?e():e);let s=a!==void 0,l;const c=n.then(async f=>{if(l=["resolve",f],Ce.isValidElement(f))s=!1,this.create({id:a,type:"default",message:f});else if(BY(f)&&!f.ok){s=!1;const h=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:v,..._})}else if(f instanceof Error){s=!1;const h=typeof r.error=="function"?await r.error(f):r.error,v=typeof r.description=="function"?await r.description(f):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:v,..._})}else if(r.success!==void 0){s=!1;const h=typeof r.success=="function"?await r.success(f):r.success,v=typeof r.description=="function"?await r.description(f):r.description,_=typeof h=="object"&&!Ce.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:v,..._})}}).catch(async f=>{if(l=["reject",f],r.error!==void 0){s=!1;const m=typeof r.error=="function"?await r.error(f):r.error,h=typeof r.description=="function"?await r.description(f):r.description,b=typeof m=="object"&&!Ce.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...b})}}).finally(()=>{s&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((f,m)=>c.then(()=>l[0]==="reject"?m(l[1]):f(l[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:d}:Object.assign(a,{unwrap:d})},this.custom=(e,r)=>{const a=r?.id||_w++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const yn=new zY,$Y=(t,e)=>{const r=e?.id||_w++;return yn.addToast({title:t,...e,id:r}),r},BY=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",qY=$Y,HY=()=>yn.toasts,GY=()=>yn.getActiveToasts(),br=Object.assign(qY,{success:yn.success,info:yn.info,warning:yn.warning,error:yn.error,custom:yn.custom,message:yn.message,promise:yn.promise,dismiss:yn.dismiss,loading:yn.loading},{getHistory:HY,getToasts:GY});kY("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function zf(t){return t.label!==void 0}const VY=3,WY="24px",YY="16px",YI=4e3,KY=356,ZY=14,XY=45,QY=200;function Na(...t){return t.filter(Boolean).join(" ")}function JY(t){const[e,r]=t.split("-"),a=[];return e&&a.push(e),r&&a.push(r),a}const eK=t=>{var e,r,a,n,s,l,c,d,f;const{invert:m,toast:h,unstyled:v,interacting:b,setHeights:_,visibleToasts:S,heights:R,index:x,toasts:T,expanded:A,removeToast:C,defaultRichColors:k,closeButton:N,style:I,cancelButtonStyle:O,actionButtonStyle:P,className:M="",descriptionClassName:U="",duration:G,position:J,gap:V,expandByDefault:Y,classNames:j,icons:q,closeButtonAriaLabel:H="Close toast"}=t,[Q,ie]=Ce.useState(null),[$,W]=Ce.useState(null),[F,K]=Ce.useState(!1),[re,B]=Ce.useState(!1),[L,X]=Ce.useState(!1),[ne,ee]=Ce.useState(!1),[ce,ge]=Ce.useState(!1),[Ae,ye]=Ce.useState(0),[Se,Ie]=Ce.useState(0),he=Ce.useRef(h.duration||G||YI),Oe=Ce.useRef(null),De=Ce.useRef(null),Qe=x===0,Te=x+1<=S,_e=h.type,Re=h.dismissible!==!1,We=h.className||"",wt=h.descriptionClassName||"",Ye=Ce.useMemo(()=>R.findIndex(Ke=>Ke.toastId===h.id)||0,[R,h.id]),Je=Ce.useMemo(()=>{var Ke;return(Ke=h.closeButton)!=null?Ke:N},[h.closeButton,N]),Xe=Ce.useMemo(()=>h.duration||G||YI,[h.duration,G]),mt=Ce.useRef(0),lr=Ce.useRef(0),un=Ce.useRef(0),mr=Ce.useRef(null),[zt,Dt]=J.split("-"),rr=Ce.useMemo(()=>R.reduce((Ke,Lt,Kt)=>Kt>=Ye?Ke:Ke+Lt.height,0),[R,Ye]),cr=FY(),yr=h.invert||m,Pn=_e==="loading";lr.current=Ce.useMemo(()=>Ye*V+rr,[Ye,rr]),Ce.useEffect(()=>{he.current=Xe},[Xe]),Ce.useEffect(()=>{K(!0)},[]),Ce.useEffect(()=>{const Ke=De.current;if(Ke){const Lt=Ke.getBoundingClientRect().height;return Ie(Lt),_(Kt=>[{toastId:h.id,height:Lt,position:h.position},...Kt]),()=>_(Kt=>Kt.filter(Or=>Or.toastId!==h.id))}},[_,h.id]),Ce.useLayoutEffect(()=>{if(!F)return;const Ke=De.current,Lt=Ke.style.height;Ke.style.height="auto";const Kt=Ke.getBoundingClientRect().height;Ke.style.height=Lt,Ie(Kt),_(Or=>Or.find(Yt=>Yt.toastId===h.id)?Or.map(Yt=>Yt.toastId===h.id?{...Yt,height:Kt}:Yt):[{toastId:h.id,height:Kt,position:h.position},...Or])},[F,h.title,h.description,_,h.id,h.jsx,h.action,h.cancel]);const nr=Ce.useCallback(()=>{B(!0),ye(lr.current),_(Ke=>Ke.filter(Lt=>Lt.toastId!==h.id)),setTimeout(()=>{C(h)},QY)},[h,C,_,lr]);Ce.useEffect(()=>{if(h.promise&&_e==="loading"||h.duration===1/0||h.type==="loading")return;let Ke;return A||b||cr?(()=>{if(un.current<mt.current){const Or=new Date().getTime()-mt.current;he.current=he.current-Or}un.current=new Date().getTime()})():(()=>{he.current!==1/0&&(mt.current=new Date().getTime(),Ke=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),nr()},he.current))})(),()=>clearTimeout(Ke)},[A,b,h,_e,cr,nr]),Ce.useEffect(()=>{h.delete&&(nr(),h.onDismiss==null||h.onDismiss.call(h,h))},[nr,h.delete]);function Ht(){var Ke;if(q?.loading){var Lt;return Ce.createElement("div",{className:Na(j?.loader,h==null||(Lt=h.classNames)==null?void 0:Lt.loader,"sonner-loader"),"data-visible":_e==="loading"},q.loading)}return Ce.createElement(DY,{className:Na(j?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader),visible:_e==="loading"})}const dn=h.icon||q?.[_e]||IY(_e);var sa,tn;return Ce.createElement("li",{tabIndex:0,ref:De,className:Na(M,We,j?.toast,h==null||(e=h.classNames)==null?void 0:e.toast,j?.default,j?.[_e],h==null||(r=h.classNames)==null?void 0:r[_e]),"data-sonner-toast":"","data-rich-colors":(sa=h.richColors)!=null?sa:k,"data-styled":!(h.jsx||h.unstyled||v),"data-mounted":F,"data-promise":!!h.promise,"data-swiped":ce,"data-removed":re,"data-visible":Te,"data-y-position":zt,"data-x-position":Dt,"data-index":x,"data-front":Qe,"data-swiping":L,"data-dismissible":Re,"data-type":_e,"data-invert":yr,"data-swipe-out":ne,"data-swipe-direction":$,"data-expanded":!!(A||Y&&F),"data-testid":h.testId,style:{"--index":x,"--toasts-before":x,"--z-index":T.length-x,"--offset":`${re?Ae:lr.current}px`,"--initial-height":Y?"auto":`${Se}px`,...I,...h.style},onDragEnd:()=>{X(!1),ie(null),mr.current=null},onPointerDown:Ke=>{Ke.button!==2&&(Pn||!Re||(Oe.current=new Date,ye(lr.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(X(!0),mr.current={x:Ke.clientX,y:Ke.clientY})))},onPointerUp:()=>{var Ke,Lt,Kt;if(ne||!Re)return;mr.current=null;const Or=Number(((Ke=De.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Un=Number(((Lt=De.current)==null?void 0:Lt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Yt=new Date().getTime()-((Kt=Oe.current)==null?void 0:Kt.getTime()),Wr=Q==="x"?Or:Un,_a=Math.abs(Wr)/Yt;if(Math.abs(Wr)>=XY||_a>.11){ye(lr.current),h.onDismiss==null||h.onDismiss.call(h,h),W(Q==="x"?Or>0?"right":"left":Un>0?"down":"up"),nr(),ee(!0);return}else{var Yr,Ur;(Yr=De.current)==null||Yr.style.setProperty("--swipe-amount-x","0px"),(Ur=De.current)==null||Ur.style.setProperty("--swipe-amount-y","0px")}ge(!1),X(!1),ie(null)},onPointerMove:Ke=>{var Lt,Kt,Or;if(!mr.current||!Re||((Lt=window.getSelection())==null?void 0:Lt.toString().length)>0)return;const Yt=Ke.clientY-mr.current.y,Wr=Ke.clientX-mr.current.x;var _a;const Yr=(_a=t.swipeDirections)!=null?_a:JY(J);!Q&&(Math.abs(Wr)>1||Math.abs(Yt)>1)&&ie(Math.abs(Wr)>Math.abs(Yt)?"x":"y");let Ur={x:0,y:0};const ae=Z=>1/(1.5+Math.abs(Z)/20);if(Q==="y"){if(Yr.includes("top")||Yr.includes("bottom"))if(Yr.includes("top")&&Yt<0||Yr.includes("bottom")&&Yt>0)Ur.y=Yt;else{const Z=Yt*ae(Yt);Ur.y=Math.abs(Z)<Math.abs(Yt)?Z:Yt}}else if(Q==="x"&&(Yr.includes("left")||Yr.includes("right")))if(Yr.includes("left")&&Wr<0||Yr.includes("right")&&Wr>0)Ur.x=Wr;else{const Z=Wr*ae(Wr);Ur.x=Math.abs(Z)<Math.abs(Wr)?Z:Wr}(Math.abs(Ur.x)>0||Math.abs(Ur.y)>0)&&ge(!0),(Kt=De.current)==null||Kt.style.setProperty("--swipe-amount-x",`${Ur.x}px`),(Or=De.current)==null||Or.style.setProperty("--swipe-amount-y",`${Ur.y}px`)}},Je&&!h.jsx&&_e!=="loading"?Ce.createElement("button",{"aria-label":H,"data-disabled":Pn,"data-close-button":!0,onClick:Pn||!Re?()=>{}:()=>{nr(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Na(j?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(tn=q?.close)!=null?tn:jY):null,(_e||h.icon||h.promise)&&h.icon!==null&&(q?.[_e]!==null||h.icon)?Ce.createElement("div",{"data-icon":"",className:Na(j?.icon,h==null||(n=h.classNames)==null?void 0:n.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Ht():null,h.type!=="loading"?dn:null):null,Ce.createElement("div",{"data-content":"",className:Na(j?.content,h==null||(s=h.classNames)==null?void 0:s.content)},Ce.createElement("div",{"data-title":"",className:Na(j?.title,h==null||(l=h.classNames)==null?void 0:l.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?Ce.createElement("div",{"data-description":"",className:Na(U,wt,j?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),Ce.isValidElement(h.cancel)?h.cancel:h.cancel&&zf(h.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ke=>{zf(h.cancel)&&Re&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ke),nr())},className:Na(j?.cancelButton,h==null||(d=h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,Ce.isValidElement(h.action)?h.action:h.action&&zf(h.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:Ke=>{zf(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ke),!Ke.defaultPrevented&&nr())},className:Na(j?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function KI(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function tK(t,e){const r={};return[t,e].forEach((a,n)=>{const s=n===1,l=s?"--mobile-offset":"--offset",c=s?YY:WY;function d(f){["top","right","bottom","left"].forEach(m=>{r[`${l}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof a=="number"||typeof a=="string"?d(a):typeof a=="object"?["top","right","bottom","left"].forEach(f=>{a[f]===void 0?r[`${l}-${f}`]=c:r[`${l}-${f}`]=typeof a[f]=="number"?`${a[f]}px`:a[f]}):d(c)}),r}const rK=Ce.forwardRef(function(e,r){const{id:a,invert:n,position:s="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:m,mobileOffset:h,theme:v="light",richColors:b,duration:_,style:S,visibleToasts:R=VY,toastOptions:x,dir:T=KI(),gap:A=ZY,icons:C,containerAriaLabel:k="Notifications"}=e,[N,I]=Ce.useState([]),O=Ce.useMemo(()=>a?N.filter(F=>F.toasterId===a):N.filter(F=>!F.toasterId),[N,a]),P=Ce.useMemo(()=>Array.from(new Set([s].concat(O.filter(F=>F.position).map(F=>F.position)))),[O,s]),[M,U]=Ce.useState([]),[G,J]=Ce.useState(!1),[V,Y]=Ce.useState(!1),[j,q]=Ce.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ce.useRef(null),Q=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),ie=Ce.useRef(null),$=Ce.useRef(!1),W=Ce.useCallback(F=>{I(K=>{var re;return(re=K.find(B=>B.id===F.id))!=null&&re.delete||yn.dismiss(F.id),K.filter(({id:B})=>B!==F.id)})},[]);return Ce.useEffect(()=>yn.subscribe(F=>{if(F.dismiss){requestAnimationFrame(()=>{I(K=>K.map(re=>re.id===F.id?{...re,delete:!0}:re))});return}setTimeout(()=>{A$.flushSync(()=>{I(K=>{const re=K.findIndex(B=>B.id===F.id);return re!==-1?[...K.slice(0,re),{...K[re],...F},...K.slice(re+1)]:[F,...K]})})})}),[N]),Ce.useEffect(()=>{if(v!=="system"){q(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:K})=>{q(K?"dark":"light")})}catch{F.addListener(({matches:re})=>{try{q(re?"dark":"light")}catch(B){console.error(B)}})}},[v]),Ce.useEffect(()=>{N.length<=1&&J(!1)},[N]),Ce.useEffect(()=>{const F=K=>{var re;if(l.every(X=>K[X]||K.code===X)){var L;J(!0),(L=H.current)==null||L.focus()}K.code==="Escape"&&(document.activeElement===H.current||(re=H.current)!=null&&re.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[l]),Ce.useEffect(()=>{if(H.current)return()=>{ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null,$.current=!1)}},[H.current]),Ce.createElement("section",{ref:r,"aria-label":`${k} ${Q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((F,K)=>{var re;const[B,L]=F.split("-");return O.length?Ce.createElement("ol",{key:F,dir:T==="auto"?KI():T,tabIndex:-1,ref:H,className:f,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":B,"data-x-position":L,style:{"--front-toast-height":`${((re=M[0])==null?void 0:re.height)||0}px`,"--width":`${KY}px`,"--gap":`${A}px`,...S,...tK(m,h)},onBlur:X=>{$.current&&!X.currentTarget.contains(X.relatedTarget)&&($.current=!1,ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||$.current||($.current=!0,ie.current=X.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{V||J(!1)},onDragEnd:()=>J(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},O.filter(X=>!X.position&&K===0||X.position===F).map((X,ne)=>{var ee,ce;return Ce.createElement(eK,{key:X.id,icons:C,index:ne,toast:X,defaultRichColors:b,duration:(ee=x?.duration)!=null?ee:_,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:n,visibleToasts:R,closeButton:(ce=x?.closeButton)!=null?ce:d,interacting:V,position:F,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:W,toasts:O.filter(ge=>ge.position==X.position),heights:M.filter(ge=>ge.position==X.position),setHeights:U,expandByDefault:c,gap:A,expanded:G,swipeDirections:e.swipeDirections})})):null}))});function ZI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ai(...t){return e=>{let r=!1;const a=t.map(n=>{const s=ZI(n,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<a.length;n++){const s=a[n];typeof s=="function"?s():ZI(t[n],null)}}}}function At(...t){return y.useCallback(Ai(...t),t)}function So(t){const e=nK(t),r=y.forwardRef((a,n)=>{const{children:s,...l}=a,c=y.Children.toArray(s),d=c.find(iK);if(d){const f=d.props.children,m=c.map(h=>h===d?y.Children.count(f)>1?y.Children.only(null):y.isValidElement(f)?f.props.children:null:h);return g.jsx(e,{...l,ref:n,children:y.isValidElement(f)?y.cloneElement(f,void 0,m):null})}return g.jsx(e,{...l,ref:n,children:s})});return r.displayName=`${t}.Slot`,r}var M$=So("Slot");function nK(t){const e=y.forwardRef((r,a)=>{const{children:n,...s}=r;if(y.isValidElement(n)){const l=sK(n),c=oK(s,n.props);return n.type!==y.Fragment&&(c.ref=a?Ai(a,l):l),y.cloneElement(n,c)}return y.Children.count(n)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var P$=Symbol("radix.slottable");function aK(t){const e=({children:r})=>g.jsx(g.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=P$,e}function iK(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===P$}function oK(t,e){const r={...e};for(const a in e){const n=t[a],s=e[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...c)=>{const d=s(...c);return n(...c),d}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...t,...r}}function sK(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function U$(t){var e,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=U$(t[e]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function j$(){for(var t,e,r=0,a="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=U$(t))&&(a&&(a+=" "),a+=e);return a}const XI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,QI=j$,F$=(t,e)=>r=>{var a;if(e?.variants==null)return QI(t,r?.class,r?.className);const{variants:n,defaultVariants:s}=e,l=Object.keys(n).map(f=>{const m=r?.[f],h=s?.[f];if(m===null)return null;const v=XI(m)||XI(h);return n[f][v]}),c=r&&Object.entries(r).reduce((f,m)=>{let[h,v]=m;return v===void 0||(f[h]=v),f},{}),d=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((f,m)=>{let{class:h,className:v,...b}=m;return Object.entries(b).every(_=>{let[S,R]=_;return Array.isArray(R)?R.includes({...s,...c}[S]):{...s,...c}[S]===R})?[...f,h,v]:f},[]);return QI(t,l,d,r?.class,r?.className)},QT="-",lK=t=>{const e=uK(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{const c=l.split(QT);return c[0]===""&&c.length!==1&&c.shift(),z$(c,e)||cK(l)},getConflictingClassGroupIds:(l,c)=>{const d=r[l]||[];return c&&a[l]?[...d,...a[l]]:d}}},z$=(t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],a=e.nextPart.get(r),n=a?z$(t.slice(1),a):void 0;if(n)return n;if(e.validators.length===0)return;const s=t.join(QT);return e.validators.find(({validator:l})=>l(s))?.classGroupId},JI=/^\[(.+)\]$/,cK=t=>{if(JI.test(t)){const e=JI.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},uK=t=>{const{theme:e,classGroups:r}=t,a={nextPart:new Map,validators:[]};for(const n in r)ww(r[n],a,n,e);return a},ww=(t,e,r,a)=>{t.forEach(n=>{if(typeof n=="string"){const s=n===""?e:eO(e,n);s.classGroupId=r;return}if(typeof n=="function"){if(dK(n)){ww(n(a),e,r,a);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([s,l])=>{ww(l,eO(e,s),r,a)})})},eO=(t,e)=>{let r=t;return e.split(QT).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},dK=t=>t.isThemeGetter,fK=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,a=new Map;const n=(s,l)=>{r.set(s,l),e++,e>t&&(e=0,a=r,r=new Map)};return{get(s){let l=r.get(s);if(l!==void 0)return l;if((l=a.get(s))!==void 0)return n(s,l),l},set(s,l){r.has(s)?r.set(s,l):n(s,l)}}},Tw="!",Rw=":",pK=Rw.length,mK=t=>{const{prefix:e,experimentalParseClassName:r}=t;let a=n=>{const s=[];let l=0,c=0,d=0,f;for(let _=0;_<n.length;_++){let S=n[_];if(l===0&&c===0){if(S===Rw){s.push(n.slice(d,_)),d=_+pK;continue}if(S==="/"){f=_;continue}}S==="["?l++:S==="]"?l--:S==="("?c++:S===")"&&c--}const m=s.length===0?n:n.substring(d),h=hK(m),v=h!==m,b=f&&f>d?f-d:void 0;return{modifiers:s,hasImportantModifier:v,baseClassName:h,maybePostfixModifierPosition:b}};if(e){const n=e+Rw,s=a;a=l=>l.startsWith(n)?s(l.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(r){const n=a;a=s=>r({className:s,parseClassName:n})}return a},hK=t=>t.endsWith(Tw)?t.substring(0,t.length-1):t.startsWith(Tw)?t.substring(1):t,gK=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const n=[];let s=[];return a.forEach(l=>{l[0]==="["||e[l]?(n.push(...s.sort(),l),s=[]):s.push(l)}),n.push(...s.sort()),n}},vK=t=>({cache:fK(t.cacheSize),parseClassName:mK(t),sortModifiers:gK(t),...lK(t)}),bK=/\s+/,yK=(t,e)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=e,l=[],c=t.trim().split(bK);let d="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{isExternal:h,modifiers:v,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:S}=r(m);if(h){d=m+(d.length>0?" "+d:d);continue}let R=!!S,x=a(R?_.substring(0,S):_);if(!x){if(!R){d=m+(d.length>0?" "+d:d);continue}if(x=a(_),!x){d=m+(d.length>0?" "+d:d);continue}R=!1}const T=s(v).join(":"),A=b?T+Tw:T,C=A+x;if(l.includes(C))continue;l.push(C);const k=n(x,R);for(let N=0;N<k.length;++N){const I=k[N];l.push(A+I)}d=m+(d.length>0?" "+d:d)}return d};function EK(){let t=0,e,r,a="";for(;t<arguments.length;)(e=arguments[t++])&&(r=$$(e))&&(a&&(a+=" "),a+=r);return a}const $$=t=>{if(typeof t=="string")return t;let e,r="";for(let a=0;a<t.length;a++)t[a]&&(e=$$(t[a]))&&(r&&(r+=" "),r+=e);return r};function SK(t,...e){let r,a,n,s=l;function l(d){const f=e.reduce((m,h)=>h(m),t());return r=vK(f),a=r.cache.get,n=r.cache.set,s=c,c(d)}function c(d){const f=a(d);if(f)return f;const m=yK(d,r);return n(d,m),m}return function(){return s(EK.apply(null,arguments))}}const Nr=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},B$=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,q$=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xK=/^\d+\/\d+$/,_K=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ol=t=>xK.test(t),gt=t=>!!t&&!Number.isNaN(Number(t)),io=t=>!!t&&Number.isInteger(Number(t)),vb=t=>t.endsWith("%")&>(t.slice(0,-1)),pi=t=>_K.test(t),CK=()=>!0,NK=t=>wK.test(t)&&!TK.test(t),H$=()=>!1,kK=t=>RK.test(t),IK=t=>AK.test(t),OK=t=>!Be(t)&&!qe(t),DK=t=>tc(t,W$,H$),Be=t=>B$.test(t),Jo=t=>tc(t,Y$,NK),bb=t=>tc(t,jK,gt),tO=t=>tc(t,G$,H$),LK=t=>tc(t,V$,IK),$f=t=>tc(t,K$,kK),qe=t=>q$.test(t),tu=t=>rc(t,Y$),MK=t=>rc(t,FK),rO=t=>rc(t,G$),PK=t=>rc(t,W$),UK=t=>rc(t,V$),Bf=t=>rc(t,K$,!0),tc=(t,e,r)=>{const a=B$.exec(t);return a?a[1]?e(a[1]):r(a[2]):!1},rc=(t,e,r=!1)=>{const a=q$.exec(t);return a?a[1]?e(a[1]):r:!1},G$=t=>t==="position"||t==="percentage",V$=t=>t==="image"||t==="url",W$=t=>t==="length"||t==="size"||t==="bg-size",Y$=t=>t==="length",jK=t=>t==="number",FK=t=>t==="family-name",K$=t=>t==="shadow",zK=()=>{const t=Nr("color"),e=Nr("font"),r=Nr("text"),a=Nr("font-weight"),n=Nr("tracking"),s=Nr("leading"),l=Nr("breakpoint"),c=Nr("container"),d=Nr("spacing"),f=Nr("radius"),m=Nr("shadow"),h=Nr("inset-shadow"),v=Nr("text-shadow"),b=Nr("drop-shadow"),_=Nr("blur"),S=Nr("perspective"),R=Nr("aspect"),x=Nr("ease"),T=Nr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),qe,Be],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],O=()=>[qe,Be,d],P=()=>[ol,"full","auto",...O()],M=()=>[io,"none","subgrid",qe,Be],U=()=>["auto",{span:["full",io,qe,Be]},io,qe,Be],G=()=>[io,"auto",qe,Be],J=()=>["auto","min","max","fr",qe,Be],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...O()],q=()=>[ol,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],H=()=>[t,qe,Be],Q=()=>[...C(),rO,tO,{position:[qe,Be]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",PK,DK,{size:[qe,Be]}],W=()=>[vb,tu,Jo],F=()=>["","none","full",f,qe,Be],K=()=>["",gt,tu,Jo],re=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>[gt,vb,rO,tO],X=()=>["","none",_,qe,Be],ne=()=>["none",gt,qe,Be],ee=()=>["none",gt,qe,Be],ce=()=>[gt,qe,Be],ge=()=>[ol,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pi],breakpoint:[pi],color:[CK],container:[pi],"drop-shadow":[pi],ease:["in","out","in-out"],font:[OK],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pi],shadow:[pi],spacing:["px",gt],text:[pi],"text-shadow":[pi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ol,Be,qe,R]}],container:["container"],columns:[{columns:[gt,Be,qe,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[io,"auto",qe,Be]}],basis:[{basis:[ol,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gt,ol,"auto","initial","none",Be]}],grow:[{grow:["",gt,qe,Be]}],shrink:[{shrink:["",gt,qe,Be]}],order:[{order:[io,"first","last","none",qe,Be]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[c,"screen",...q()]}],"min-w":[{"min-w":[c,"screen","none",...q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",r,tu,Jo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,qe,bb]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",vb,Be]}],"font-family":[{font:[MK,Be,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,qe,Be]}],"line-clamp":[{"line-clamp":[gt,"none",qe,bb]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",qe,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[gt,"from-font","auto",qe,Jo]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[gt,"auto",qe,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qe,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},io,qe,Be],radial:["",qe,Be],conic:[io,qe,Be]},UK,LK]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gt,qe,Be]}],"outline-w":[{outline:["",gt,tu,Jo]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",m,Bf,$f]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,Bf,$f]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[gt,Jo]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",v,Bf,$f]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[gt,qe,Be]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[qe,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Be]}],filter:[{filter:["","none",qe,Be]}],blur:[{blur:X()}],brightness:[{brightness:[gt,qe,Be]}],contrast:[{contrast:[gt,qe,Be]}],"drop-shadow":[{"drop-shadow":["","none",b,Bf,$f]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",gt,qe,Be]}],"hue-rotate":[{"hue-rotate":[gt,qe,Be]}],invert:[{invert:["",gt,qe,Be]}],saturate:[{saturate:[gt,qe,Be]}],sepia:[{sepia:["",gt,qe,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Be]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[gt,qe,Be]}],"backdrop-contrast":[{"backdrop-contrast":[gt,qe,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gt,qe,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gt,qe,Be]}],"backdrop-invert":[{"backdrop-invert":["",gt,qe,Be]}],"backdrop-opacity":[{"backdrop-opacity":[gt,qe,Be]}],"backdrop-saturate":[{"backdrop-saturate":[gt,qe,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",gt,qe,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gt,"initial",qe,Be]}],ease:[{ease:["linear","initial",x,qe,Be]}],delay:[{delay:[gt,qe,Be]}],animate:[{animate:["none",T,qe,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,qe,Be]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[qe,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qe,Be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",qe,Be]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[gt,tu,Jo,bb]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$K=SK(zK);function Ue(...t){return $K(j$(t))}const BK=F$("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ba({className:t,variant:e,asChild:r=!1,...a}){const n=r?M$:"span";return g.jsx(n,{"data-slot":"badge",className:Ue(BK({variant:e}),t),...a})}const qK=F$("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-full gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-full px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function at({className:t,variant:e,size:r,asChild:a=!1,...n}){const s=a?M$:"button";return g.jsx(s,{"data-slot":"button",className:Ue(qK({variant:e,size:r,className:t})),...n})}var HK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=HK.reduce((t,e)=>{const r=So(`Primitive.${e}`),a=y.forwardRef((n,s)=>{const{asChild:l,...c}=n,d=l?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(d,{...c,ref:s})});return a.displayName=`Primitive.${e}`,{...t,[e]:a}},{});function Z$(t,e){t&&ec.flushSync(()=>t.dispatchEvent(e))}var GK="Label",X$=y.forwardRef((t,e)=>g.jsx(ot.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));X$.displayName=GK;var VK=X$;function ir({className:t,...e}){return g.jsx(VK,{"data-slot":"label",className:Ue("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function JT({message:t,className:e="",vertical:r,noBorder:a}){return g.jsx("div",{className:Ue(`mt-2 rounded-md p-6 ${e}`,!a&&"border"),children:g.jsxs("p",{className:Ue("text-sm text-muted-foreground flex items-center gap-4",r&&"flex-col"),children:[g.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:g.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:g.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[g.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),g.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),g.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),t]})})}function Q$({className:t,color:e,children:r,grayscaled:a=!1}){const n=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[e,a]),s=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[e,a]),l=y.useMemo(()=>{if(e){const h=e.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[e]),c=y.useMemo(()=>e||`oklch(${Math.min(s,1)} ${n} ${l})`,[l,n,s]),d=y.useMemo(()=>`oklch(${Math.min(s*2,1)} ${n} ${l})`,[l,n,s,e]),f=y.useMemo(()=>Math.floor(Math.random()*360),[l]),m=y.useMemo(()=>"1000%",[]);return g.jsx("section",{className:Ue("relative w-full h-full overflow-hidden",t),style:{background:`${d}`},children:g.jsxs("div",{className:"isolate relative w-full h-full",children:[g.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),r&&g.jsx("div",{className:"relative z-10 w-full h-full",children:r})]})})}function ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t?.(n),r===!1||!n.defaultPrevented)return e?.(n)}}function WK(t,e){const r=y.createContext(e),a=s=>{const{children:l,...c}=s,d=y.useMemo(()=>c,Object.values(c));return g.jsx(r.Provider,{value:d,children:l})};a.displayName=t+"Provider";function n(s){const l=y.useContext(r);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[a,n]}function Wa(t,e=[]){let r=[];function a(s,l){const c=y.createContext(l),d=r.length;r=[...r,l];const f=h=>{const{scope:v,children:b,..._}=h,S=v?.[t]?.[d]||c,R=y.useMemo(()=>_,Object.values(_));return g.jsx(S.Provider,{value:R,children:b})};f.displayName=s+"Provider";function m(h,v){const b=v?.[t]?.[d]||c,_=y.useContext(b);if(_)return _;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[f,m]}const n=()=>{const s=r.map(l=>y.createContext(l));return function(c){const d=c?.[t]||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return n.scopeName=t,[a,YK(n,...e)]}function YK(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const a=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(s){const l=a.reduce((c,{useScope:d,scopeName:f})=>{const h=d(s)[`__scope${f}`];return{...c,...h}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return r.scopeName=e.scopeName,r}var en=globalThis?.document?y.useLayoutEffect:()=>{},KK=UT[" useInsertionEffect ".trim().toString()]||en;function xo({prop:t,defaultProp:e,onChange:r=()=>{},caller:a}){const[n,s,l]=ZK({defaultProp:e,onChange:r}),c=t!==void 0,d=c?t:n;{const m=y.useRef(t!==void 0);y.useEffect(()=>{const h=m.current;h!==c&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=c},[c,a])}const f=y.useCallback(m=>{if(c){const h=XK(m)?m(t):m;h!==t&&l.current?.(h)}else s(m)},[c,t,s,l]);return[d,f]}function ZK({defaultProp:t,onChange:e}){const[r,a]=y.useState(t),n=y.useRef(r),s=y.useRef(e);return KK(()=>{s.current=e},[e]),y.useEffect(()=>{n.current!==r&&(s.current?.(r),n.current=r)},[r,n]),[r,a,s]}function XK(t){return typeof t=="function"}function J$(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function eB(t){const[e,r]=y.useState(void 0);return en(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let l,c;if("borderBoxSize"in s){const d=s.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=t.offsetWidth,c=t.offsetHeight;r({width:l,height:c})});return a.observe(t,{box:"border-box"}),()=>a.unobserve(t)}else r(void 0)},[t]),e}var _m="Switch",[QK]=Wa(_m),[JK,eZ]=QK(_m),tB=y.forwardRef((t,e)=>{const{__scopeSwitch:r,name:a,checked:n,defaultChecked:s,required:l,disabled:c,value:d="on",onCheckedChange:f,form:m,...h}=t,[v,b]=y.useState(null),_=At(e,A=>b(A)),S=y.useRef(!1),R=v?m||!!v.closest("form"):!0,[x,T]=xo({prop:n,defaultProp:s??!1,onChange:f,caller:_m});return g.jsxs(JK,{scope:r,checked:x,disabled:c,children:[g.jsx(ot.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":iB(x),"data-disabled":c?"":void 0,disabled:c,value:d,...h,ref:_,onClick:ze(t.onClick,A=>{T(C=>!C),R&&(S.current=A.isPropagationStopped(),S.current||A.stopPropagation())})}),R&&g.jsx(aB,{control:v,bubbles:!S.current,name:a,value:d,checked:x,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});tB.displayName=_m;var rB="SwitchThumb",nB=y.forwardRef((t,e)=>{const{__scopeSwitch:r,...a}=t,n=eZ(rB,r);return g.jsx(ot.span,{"data-state":iB(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:e})});nB.displayName=rB;var tZ="SwitchBubbleInput",aB=y.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:a=!0,...n},s)=>{const l=y.useRef(null),c=At(l,s),d=J$(r),f=eB(e);return y.useEffect(()=>{const m=l.current;if(!m)return;const h=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(h,"checked").set;if(d!==r&&b){const _=new Event("click",{bubbles:a});b.call(m,r),m.dispatchEvent(_)}},[d,r,a]),g.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:c,style:{...n.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});aB.displayName=tZ;function iB(t){return t?"checked":"unchecked"}var oB=tB,rZ=nB;function eR({ref:t,className:e,...r}){return g.jsx(oB,{className:Ue("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:t,children:g.jsx(rZ,{className:Ue("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}eR.displayName=oB.displayName;function qa(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...r)=>e.current?.(...r),[])}function nZ(t,e=globalThis?.document){const r=qa(t);y.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[r,e])}var aZ="DismissableLayer",Aw="dismissableLayer.update",iZ="dismissableLayer.pointerDownOutside",oZ="dismissableLayer.focusOutside",nO,sB=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=t,f=y.useContext(sB),[m,h]=y.useState(null),v=m?.ownerDocument??globalThis?.document,[,b]=y.useState({}),_=At(e,I=>h(I)),S=Array.from(f.layers),[R]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=S.indexOf(R),T=m?S.indexOf(m):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,C=T>=x,k=cZ(I=>{const O=I.target,P=[...f.branches].some(M=>M.contains(O));!C||P||(n?.(I),l?.(I),I.defaultPrevented||c?.())},v),N=uZ(I=>{const O=I.target;[...f.branches].some(M=>M.contains(O))||(s?.(I),l?.(I),I.defaultPrevented||c?.())},v);return nZ(I=>{T===f.layers.size-1&&(a?.(I),!I.defaultPrevented&&c&&(I.preventDefault(),c()))},v),y.useEffect(()=>{if(m)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(nO=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),aO(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=nO)}},[m,v,r,f]),y.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),aO())},[m,f]),y.useEffect(()=>{const I=()=>b({});return document.addEventListener(Aw,I),()=>document.removeEventListener(Aw,I)},[]),g.jsx(ot.div,{...d,ref:_,style:{pointerEvents:A?C?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,N.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,k.onPointerDownCapture)})});nc.displayName=aZ;var sZ="DismissableLayerBranch",lZ=y.forwardRef((t,e)=>{const r=y.useContext(sB),a=y.useRef(null),n=At(e,a);return y.useEffect(()=>{const s=a.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),g.jsx(ot.div,{...t,ref:n})});lZ.displayName=sZ;function cZ(t,e=globalThis?.document){const r=qa(t),a=y.useRef(!1),n=y.useRef(()=>{});return y.useEffect(()=>{const s=c=>{if(c.target&&!a.current){let d=function(){lB(iZ,r,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=d,e.addEventListener("click",n.current,{once:!0})):d()}else e.removeEventListener("click",n.current);a.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",s),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>a.current=!0}}function uZ(t,e=globalThis?.document){const r=qa(t),a=y.useRef(!1);return y.useEffect(()=>{const n=s=>{s.target&&!a.current&&lB(oZ,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function aO(){const t=new CustomEvent(Aw);document.dispatchEvent(t)}function lB(t,e,r,{discrete:a}){const n=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),a?Z$(n,s):n.dispatchEvent(s)}var dZ=UT[" useId ".trim().toString()]||(()=>{}),fZ=0;function Gr(t){const[e,r]=y.useState(dZ());return en(()=>{r(a=>a??String(fZ++))},[t]),t||(e?`radix-${e}`:"")}const pZ=["top","right","bottom","left"],_o=Math.min,Ln=Math.max,Zp=Math.round,qf=Math.floor,Ua=t=>({x:t,y:t}),mZ={left:"right",right:"left",bottom:"top",top:"bottom"},hZ={start:"end",end:"start"};function Cw(t,e,r){return Ln(t,_o(e,r))}function Ci(t,e){return typeof t=="function"?t(e):t}function Ni(t){return t.split("-")[0]}function ac(t){return t.split("-")[1]}function tR(t){return t==="x"?"y":"x"}function rR(t){return t==="y"?"height":"width"}const gZ=new Set(["top","bottom"]);function Da(t){return gZ.has(Ni(t))?"y":"x"}function nR(t){return tR(Da(t))}function vZ(t,e,r){r===void 0&&(r=!1);const a=ac(t),n=nR(t),s=rR(n);let l=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(l=Xp(l)),[l,Xp(l)]}function bZ(t){const e=Xp(t);return[Nw(t),e,Nw(e)]}function Nw(t){return t.replace(/start|end/g,e=>hZ[e])}const iO=["left","right"],oO=["right","left"],yZ=["top","bottom"],EZ=["bottom","top"];function SZ(t,e,r){switch(t){case"top":case"bottom":return r?e?oO:iO:e?iO:oO;case"left":case"right":return e?yZ:EZ;default:return[]}}function xZ(t,e,r,a){const n=ac(t);let s=SZ(Ni(t),r==="start",a);return n&&(s=s.map(l=>l+"-"+n),e&&(s=s.concat(s.map(Nw)))),s}function Xp(t){return t.replace(/left|right|bottom|top/g,e=>mZ[e])}function _Z(t){return{top:0,right:0,bottom:0,left:0,...t}}function cB(t){return typeof t!="number"?_Z(t):{top:t,right:t,bottom:t,left:t}}function Qp(t){const{x:e,y:r,width:a,height:n}=t;return{width:a,height:n,top:r,left:e,right:e+a,bottom:r+n,x:e,y:r}}function sO(t,e,r){let{reference:a,floating:n}=t;const s=Da(e),l=nR(e),c=rR(l),d=Ni(e),f=s==="y",m=a.x+a.width/2-n.width/2,h=a.y+a.height/2-n.height/2,v=a[c]/2-n[c]/2;let b;switch(d){case"top":b={x:m,y:a.y-n.height};break;case"bottom":b={x:m,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:h};break;case"left":b={x:a.x-n.width,y:h};break;default:b={x:a.x,y:a.y}}switch(ac(e)){case"start":b[l]-=v*(r&&f?-1:1);break;case"end":b[l]+=v*(r&&f?-1:1);break}return b}const wZ=async(t,e,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:s=[],platform:l}=r,c=s.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(e));let f=await l.getElementRects({reference:t,floating:e,strategy:n}),{x:m,y:h}=sO(f,a,d),v=a,b={},_=0;for(let S=0;S<c.length;S++){const{name:R,fn:x}=c[S],{x:T,y:A,data:C,reset:k}=await x({x:m,y:h,initialPlacement:a,placement:v,strategy:n,middlewareData:b,rects:f,platform:l,elements:{reference:t,floating:e}});m=T??m,h=A??h,b={...b,[R]:{...b[R],...C}},k&&_<=50&&(_++,typeof k=="object"&&(k.placement&&(v=k.placement),k.rects&&(f=k.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:n}):k.rects),{x:m,y:h}=sO(f,v,d)),S=-1)}return{x:m,y:h,placement:v,strategy:n,middlewareData:b}};async function Uu(t,e){var r;e===void 0&&(e={});const{x:a,y:n,platform:s,rects:l,elements:c,strategy:d}=t,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:v=!1,padding:b=0}=Ci(e,t),_=cB(b),R=c[v?h==="floating"?"reference":"floating":h],x=Qp(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(R)))==null||r?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:d})),T=h==="floating"?{x:a,y:n,width:l.floating.width,height:l.floating.height}:l.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),C=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},k=Qp(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:A,strategy:d}):T);return{top:(x.top-k.top+_.top)/C.y,bottom:(k.bottom-x.bottom+_.bottom)/C.y,left:(x.left-k.left+_.left)/C.x,right:(k.right-x.right+_.right)/C.x}}const TZ=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:a,placement:n,rects:s,platform:l,elements:c,middlewareData:d}=e,{element:f,padding:m=0}=Ci(t,e)||{};if(f==null)return{};const h=cB(m),v={x:r,y:a},b=nR(n),_=rR(b),S=await l.getDimensions(f),R=b==="y",x=R?"top":"left",T=R?"bottom":"right",A=R?"clientHeight":"clientWidth",C=s.reference[_]+s.reference[b]-v[b]-s.floating[_],k=v[b]-s.reference[b],N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let I=N?N[A]:0;(!I||!await(l.isElement==null?void 0:l.isElement(N)))&&(I=c.floating[A]||s.floating[_]);const O=C/2-k/2,P=I/2-S[_]/2-1,M=_o(h[x],P),U=_o(h[T],P),G=M,J=I-S[_]-U,V=I/2-S[_]/2+O,Y=Cw(G,V,J),j=!d.arrow&&ac(n)!=null&&V!==Y&&s.reference[_]/2-(V<G?M:U)-S[_]/2<0,q=j?V<G?V-G:V-J:0;return{[b]:v[b]+q,data:{[b]:Y,centerOffset:V-Y-q,...j&&{alignmentOffset:q}},reset:j}}}),RZ=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,a;const{placement:n,middlewareData:s,rects:l,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:S=!0,...R}=Ci(t,e);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const x=Ni(n),T=Da(c),A=Ni(c)===c,C=await(d.isRTL==null?void 0:d.isRTL(f.floating)),k=v||(A||!S?[Xp(c)]:bZ(c)),N=_!=="none";!v&&N&&k.push(...xZ(c,S,_,C));const I=[c,...k],O=await Uu(e,R),P=[];let M=((a=s.flip)==null?void 0:a.overflows)||[];if(m&&P.push(O[x]),h){const V=vZ(n,l,C);P.push(O[V[0]],O[V[1]])}if(M=[...M,{placement:n,overflows:P}],!P.every(V=>V<=0)){var U,G;const V=(((U=s.flip)==null?void 0:U.index)||0)+1,Y=I[V];if(Y&&(!(h==="alignment"?T!==Da(Y):!1)||M.every(H=>Da(H.placement)===T?H.overflows[0]>0:!0)))return{data:{index:V,overflows:M},reset:{placement:Y}};let j=(G=M.filter(q=>q.overflows[0]<=0).sort((q,H)=>q.overflows[1]-H.overflows[1])[0])==null?void 0:G.placement;if(!j)switch(b){case"bestFit":{var J;const q=(J=M.filter(H=>{if(N){const Q=Da(H.placement);return Q===T||Q==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(Q=>Q>0).reduce((Q,ie)=>Q+ie,0)]).sort((H,Q)=>H[1]-Q[1])[0])==null?void 0:J[0];q&&(j=q);break}case"initialPlacement":j=c;break}if(n!==j)return{reset:{placement:j}}}return{}}}};function lO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function cO(t){return pZ.some(e=>t[e]>=0)}const AZ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:a="referenceHidden",...n}=Ci(t,e);switch(a){case"referenceHidden":{const s=await Uu(e,{...n,elementContext:"reference"}),l=lO(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:cO(l)}}}case"escaped":{const s=await Uu(e,{...n,altBoundary:!0}),l=lO(s,r.floating);return{data:{escapedOffsets:l,escaped:cO(l)}}}default:return{}}}}},uB=new Set(["left","top"]);async function CZ(t,e){const{placement:r,platform:a,elements:n}=t,s=await(a.isRTL==null?void 0:a.isRTL(n.floating)),l=Ni(r),c=ac(r),d=Da(r)==="y",f=uB.has(l)?-1:1,m=s&&d?-1:1,h=Ci(e,t);let{mainAxis:v,crossAxis:b,alignmentAxis:_}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof _=="number"&&(b=c==="end"?_*-1:_),d?{x:b*m,y:v*f}:{x:v*f,y:b*m}}const NZ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,a;const{x:n,y:s,placement:l,middlewareData:c}=e,d=await CZ(e,t);return l===((r=c.offset)==null?void 0:r.placement)&&(a=c.arrow)!=null&&a.alignmentOffset?{}:{x:n+d.x,y:s+d.y,data:{...d,placement:l}}}}},kZ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:a,placement:n}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:R=>{let{x,y:T}=R;return{x,y:T}}},...d}=Ci(t,e),f={x:r,y:a},m=await Uu(e,d),h=Da(Ni(n)),v=tR(h);let b=f[v],_=f[h];if(s){const R=v==="y"?"top":"left",x=v==="y"?"bottom":"right",T=b+m[R],A=b-m[x];b=Cw(T,b,A)}if(l){const R=h==="y"?"top":"left",x=h==="y"?"bottom":"right",T=_+m[R],A=_-m[x];_=Cw(T,_,A)}const S=c.fn({...e,[v]:b,[h]:_});return{...S,data:{x:S.x-r,y:S.y-a,enabled:{[v]:s,[h]:l}}}}}},IZ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:a,placement:n,rects:s,middlewareData:l}=e,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Ci(t,e),m={x:r,y:a},h=Da(n),v=tR(h);let b=m[v],_=m[h];const S=Ci(c,e),R=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(d){const A=v==="y"?"height":"width",C=s.reference[v]-s.floating[A]+R.mainAxis,k=s.reference[v]+s.reference[A]-R.mainAxis;b<C?b=C:b>k&&(b=k)}if(f){var x,T;const A=v==="y"?"width":"height",C=uB.has(Ni(n)),k=s.reference[h]-s.floating[A]+(C&&((x=l.offset)==null?void 0:x[h])||0)+(C?0:R.crossAxis),N=s.reference[h]+s.reference[A]+(C?0:((T=l.offset)==null?void 0:T[h])||0)-(C?R.crossAxis:0);_<k?_=k:_>N&&(_=N)}return{[v]:b,[h]:_}}}},OZ=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,a;const{placement:n,rects:s,platform:l,elements:c}=e,{apply:d=()=>{},...f}=Ci(t,e),m=await Uu(e,f),h=Ni(n),v=ac(n),b=Da(n)==="y",{width:_,height:S}=s.floating;let R,x;h==="top"||h==="bottom"?(R=h,x=v===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(x=h,R=v==="end"?"top":"bottom");const T=S-m.top-m.bottom,A=_-m.left-m.right,C=_o(S-m[R],T),k=_o(_-m[x],A),N=!e.middlewareData.shift;let I=C,O=k;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(O=A),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(I=T),N&&!v){const M=Ln(m.left,0),U=Ln(m.right,0),G=Ln(m.top,0),J=Ln(m.bottom,0);b?O=_-2*(M!==0||U!==0?M+U:Ln(m.left,m.right)):I=S-2*(G!==0||J!==0?G+J:Ln(m.top,m.bottom))}await d({...e,availableWidth:O,availableHeight:I});const P=await l.getDimensions(c.floating);return _!==P.width||S!==P.height?{reset:{rects:!0}}:{}}}};function wm(){return typeof window<"u"}function ic(t){return dB(t)?(t.nodeName||"").toLowerCase():"#document"}function Mn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ya(t){var e;return(e=(dB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function dB(t){return wm()?t instanceof Node||t instanceof Mn(t).Node:!1}function Ea(t){return wm()?t instanceof Element||t instanceof Mn(t).Element:!1}function Ha(t){return wm()?t instanceof HTMLElement||t instanceof Mn(t).HTMLElement:!1}function uO(t){return!wm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Mn(t).ShadowRoot}const DZ=new Set(["inline","contents"]);function cd(t){const{overflow:e,overflowX:r,overflowY:a,display:n}=Sa(t);return/auto|scroll|overlay|hidden|clip/.test(e+a+r)&&!DZ.has(n)}const LZ=new Set(["table","td","th"]);function MZ(t){return LZ.has(ic(t))}const PZ=[":popover-open",":modal"];function Tm(t){return PZ.some(e=>{try{return t.matches(e)}catch{return!1}})}const UZ=["transform","translate","scale","rotate","perspective"],jZ=["transform","translate","scale","rotate","perspective","filter"],FZ=["paint","layout","strict","content"];function aR(t){const e=iR(),r=Ea(t)?Sa(t):t;return UZ.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||jZ.some(a=>(r.willChange||"").includes(a))||FZ.some(a=>(r.contain||"").includes(a))}function zZ(t){let e=wo(t);for(;Ha(e)&&!ql(e);){if(aR(e))return e;if(Tm(e))return null;e=wo(e)}return null}function iR(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $Z=new Set(["html","body","#document"]);function ql(t){return $Z.has(ic(t))}function Sa(t){return Mn(t).getComputedStyle(t)}function Rm(t){return Ea(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wo(t){if(ic(t)==="html")return t;const e=t.assignedSlot||t.parentNode||uO(t)&&t.host||Ya(t);return uO(e)?e.host:e}function fB(t){const e=wo(t);return ql(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ha(e)&&cd(e)?e:fB(e)}function ju(t,e,r){var a;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=fB(t),s=n===((a=t.ownerDocument)==null?void 0:a.body),l=Mn(n);if(s){const c=kw(l);return e.concat(l,l.visualViewport||[],cd(n)?n:[],c&&r?ju(c):[])}return e.concat(n,ju(n,[],r))}function kw(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function pB(t){const e=Sa(t);let r=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const n=Ha(t),s=n?t.offsetWidth:r,l=n?t.offsetHeight:a,c=Zp(r)!==s||Zp(a)!==l;return c&&(r=s,a=l),{width:r,height:a,$:c}}function oR(t){return Ea(t)?t:t.contextElement}function Dl(t){const e=oR(t);if(!Ha(e))return Ua(1);const r=e.getBoundingClientRect(),{width:a,height:n,$:s}=pB(e);let l=(s?Zp(r.width):r.width)/a,c=(s?Zp(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const BZ=Ua(0);function mB(t){const e=Mn(t);return!iR()||!e.visualViewport?BZ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function qZ(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Mn(t)?!1:e}function vs(t,e,r,a){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),s=oR(t);let l=Ua(1);e&&(a?Ea(a)&&(l=Dl(a)):l=Dl(t));const c=qZ(s,r,a)?mB(s):Ua(0);let d=(n.left+c.x)/l.x,f=(n.top+c.y)/l.y,m=n.width/l.x,h=n.height/l.y;if(s){const v=Mn(s),b=a&&Ea(a)?Mn(a):a;let _=v,S=kw(_);for(;S&&a&&b!==_;){const R=Dl(S),x=S.getBoundingClientRect(),T=Sa(S),A=x.left+(S.clientLeft+parseFloat(T.paddingLeft))*R.x,C=x.top+(S.clientTop+parseFloat(T.paddingTop))*R.y;d*=R.x,f*=R.y,m*=R.x,h*=R.y,d+=A,f+=C,_=Mn(S),S=kw(_)}}return Qp({width:m,height:h,x:d,y:f})}function Am(t,e){const r=Rm(t).scrollLeft;return e?e.left+r:vs(Ya(t)).left+r}function hB(t,e){const r=t.getBoundingClientRect(),a=r.left+e.scrollLeft-Am(t,r),n=r.top+e.scrollTop;return{x:a,y:n}}function HZ(t){let{elements:e,rect:r,offsetParent:a,strategy:n}=t;const s=n==="fixed",l=Ya(a),c=e?Tm(e.floating):!1;if(a===l||c&&s)return r;let d={scrollLeft:0,scrollTop:0},f=Ua(1);const m=Ua(0),h=Ha(a);if((h||!h&&!s)&&((ic(a)!=="body"||cd(l))&&(d=Rm(a)),Ha(a))){const b=vs(a);f=Dl(a),m.x=b.x+a.clientLeft,m.y=b.y+a.clientTop}const v=l&&!h&&!s?hB(l,d):Ua(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-d.scrollLeft*f.x+m.x+v.x,y:r.y*f.y-d.scrollTop*f.y+m.y+v.y}}function GZ(t){return Array.from(t.getClientRects())}function VZ(t){const e=Ya(t),r=Rm(t),a=t.ownerDocument.body,n=Ln(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),s=Ln(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let l=-r.scrollLeft+Am(t);const c=-r.scrollTop;return Sa(a).direction==="rtl"&&(l+=Ln(e.clientWidth,a.clientWidth)-n),{width:n,height:s,x:l,y:c}}const dO=25;function WZ(t,e){const r=Mn(t),a=Ya(t),n=r.visualViewport;let s=a.clientWidth,l=a.clientHeight,c=0,d=0;if(n){s=n.width,l=n.height;const m=iR();(!m||m&&e==="fixed")&&(c=n.offsetLeft,d=n.offsetTop)}const f=Am(a);if(f<=0){const m=a.ownerDocument,h=m.body,v=getComputedStyle(h),b=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,_=Math.abs(a.clientWidth-h.clientWidth-b);_<=dO&&(s-=_)}else f<=dO&&(s+=f);return{width:s,height:l,x:c,y:d}}const YZ=new Set(["absolute","fixed"]);function KZ(t,e){const r=vs(t,!0,e==="fixed"),a=r.top+t.clientTop,n=r.left+t.clientLeft,s=Ha(t)?Dl(t):Ua(1),l=t.clientWidth*s.x,c=t.clientHeight*s.y,d=n*s.x,f=a*s.y;return{width:l,height:c,x:d,y:f}}function fO(t,e,r){let a;if(e==="viewport")a=WZ(t,r);else if(e==="document")a=VZ(Ya(t));else if(Ea(e))a=KZ(e,r);else{const n=mB(t);a={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Qp(a)}function gB(t,e){const r=wo(t);return r===e||!Ea(r)||ql(r)?!1:Sa(r).position==="fixed"||gB(r,e)}function ZZ(t,e){const r=e.get(t);if(r)return r;let a=ju(t,[],!1).filter(c=>Ea(c)&&ic(c)!=="body"),n=null;const s=Sa(t).position==="fixed";let l=s?wo(t):t;for(;Ea(l)&&!ql(l);){const c=Sa(l),d=aR(l);!d&&c.position==="fixed"&&(n=null),(s?!d&&!n:!d&&c.position==="static"&&!!n&&YZ.has(n.position)||cd(l)&&!d&&gB(t,l))?a=a.filter(m=>m!==l):n=c,l=wo(l)}return e.set(t,a),a}function XZ(t){let{element:e,boundary:r,rootBoundary:a,strategy:n}=t;const l=[...r==="clippingAncestors"?Tm(e)?[]:ZZ(e,this._c):[].concat(r),a],c=l[0],d=l.reduce((f,m)=>{const h=fO(e,m,n);return f.top=Ln(h.top,f.top),f.right=_o(h.right,f.right),f.bottom=_o(h.bottom,f.bottom),f.left=Ln(h.left,f.left),f},fO(e,c,n));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function QZ(t){const{width:e,height:r}=pB(t);return{width:e,height:r}}function JZ(t,e,r){const a=Ha(e),n=Ya(e),s=r==="fixed",l=vs(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const d=Ua(0);function f(){d.x=Am(n)}if(a||!a&&!s)if((ic(e)!=="body"||cd(n))&&(c=Rm(e)),a){const b=vs(e,!0,s,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else n&&f();s&&!a&&n&&f();const m=n&&!a&&!s?hB(n,c):Ua(0),h=l.left+c.scrollLeft-d.x-m.x,v=l.top+c.scrollTop-d.y-m.y;return{x:h,y:v,width:l.width,height:l.height}}function yb(t){return Sa(t).position==="static"}function pO(t,e){if(!Ha(t)||Sa(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ya(t)===r&&(r=r.ownerDocument.body),r}function vB(t,e){const r=Mn(t);if(Tm(t))return r;if(!Ha(t)){let n=wo(t);for(;n&&!ql(n);){if(Ea(n)&&!yb(n))return n;n=wo(n)}return r}let a=pO(t,e);for(;a&&MZ(a)&&yb(a);)a=pO(a,e);return a&&ql(a)&&yb(a)&&!aR(a)?r:a||zZ(t)||r}const eX=async function(t){const e=this.getOffsetParent||vB,r=this.getDimensions,a=await r(t.floating);return{reference:JZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function tX(t){return Sa(t).direction==="rtl"}const rX={convertOffsetParentRelativeRectToViewportRelativeRect:HZ,getDocumentElement:Ya,getClippingRect:XZ,getOffsetParent:vB,getElementRects:eX,getClientRects:GZ,getDimensions:QZ,getScale:Dl,isElement:Ea,isRTL:tX};function bB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function nX(t,e){let r=null,a;const n=Ya(t);function s(){var c;clearTimeout(a),(c=r)==null||c.disconnect(),r=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const f=t.getBoundingClientRect(),{left:m,top:h,width:v,height:b}=f;if(c||e(),!v||!b)return;const _=qf(h),S=qf(n.clientWidth-(m+v)),R=qf(n.clientHeight-(h+b)),x=qf(m),A={rootMargin:-_+"px "+-S+"px "+-R+"px "+-x+"px",threshold:Ln(0,_o(1,d))||1};let C=!0;function k(N){const I=N[0].intersectionRatio;if(I!==d){if(!C)return l();I?l(!1,I):a=setTimeout(()=>{l(!1,1e-7)},1e3)}I===1&&!bB(f,t.getBoundingClientRect())&&l(),C=!1}try{r=new IntersectionObserver(k,{...A,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,A)}r.observe(t)}return l(!0),s}function aX(t,e,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=a,f=oR(t),m=n||s?[...f?ju(f):[],...ju(e)]:[];m.forEach(x=>{n&&x.addEventListener("scroll",r,{passive:!0}),s&&x.addEventListener("resize",r)});const h=f&&c?nX(f,r):null;let v=-1,b=null;l&&(b=new ResizeObserver(x=>{let[T]=x;T&&T.target===f&&b&&(b.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=b)==null||A.observe(e)})),r()}),f&&!d&&b.observe(f),b.observe(e));let _,S=d?vs(t):null;d&&R();function R(){const x=vs(t);S&&!bB(S,x)&&r(),S=x,_=requestAnimationFrame(R)}return r(),()=>{var x;m.forEach(T=>{n&&T.removeEventListener("scroll",r),s&&T.removeEventListener("resize",r)}),h?.(),(x=b)==null||x.disconnect(),b=null,d&&cancelAnimationFrame(_)}}const iX=NZ,oX=kZ,sX=RZ,lX=OZ,cX=AZ,mO=TZ,uX=IZ,dX=(t,e,r)=>{const a=new Map,n={platform:rX,...r},s={...n.platform,_c:a};return wZ(t,e,{...n,platform:s})};var fX=typeof document<"u",pX=function(){},dp=fX?y.useLayoutEffect:pX;function Jp(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,a,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(a=r;a--!==0;)if(!Jp(t[a],e[a]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(e,n[a]))return!1;for(a=r;a--!==0;){const s=n[a];if(!(s==="_owner"&&t.$$typeof)&&!Jp(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function yB(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function hO(t,e){const r=yB(t);return Math.round(e*r)/r}function Eb(t){const e=y.useRef(t);return dp(()=>{e.current=t}),e}function mX(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:d,open:f}=t,[m,h]=y.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[v,b]=y.useState(a);Jp(v,a)||b(a);const[_,S]=y.useState(null),[R,x]=y.useState(null),T=y.useCallback(H=>{H!==N.current&&(N.current=H,S(H))},[]),A=y.useCallback(H=>{H!==I.current&&(I.current=H,x(H))},[]),C=s||_,k=l||R,N=y.useRef(null),I=y.useRef(null),O=y.useRef(m),P=d!=null,M=Eb(d),U=Eb(n),G=Eb(f),J=y.useCallback(()=>{if(!N.current||!I.current)return;const H={placement:e,strategy:r,middleware:v};U.current&&(H.platform=U.current),dX(N.current,I.current,H).then(Q=>{const ie={...Q,isPositioned:G.current!==!1};V.current&&!Jp(O.current,ie)&&(O.current=ie,ec.flushSync(()=>{h(ie)}))})},[v,e,r,U,G]);dp(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[f]);const V=y.useRef(!1);dp(()=>(V.current=!0,()=>{V.current=!1}),[]),dp(()=>{if(C&&(N.current=C),k&&(I.current=k),C&&k){if(M.current)return M.current(C,k,J);J()}},[C,k,J,M,P]);const Y=y.useMemo(()=>({reference:N,floating:I,setReference:T,setFloating:A}),[T,A]),j=y.useMemo(()=>({reference:C,floating:k}),[C,k]),q=y.useMemo(()=>{const H={position:r,left:0,top:0};if(!j.floating)return H;const Q=hO(j.floating,m.x),ie=hO(j.floating,m.y);return c?{...H,transform:"translate("+Q+"px, "+ie+"px)",...yB(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:ie}},[r,c,j.floating,m.x,m.y]);return y.useMemo(()=>({...m,update:J,refs:Y,elements:j,floatingStyles:q}),[m,J,Y,j,q])}const hX=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:a,padding:n}=typeof t=="function"?t(r):t;return a&&e(a)?a.current!=null?mO({element:a.current,padding:n}).fn(r):{}:a?mO({element:a,padding:n}).fn(r):{}}}},gX=(t,e)=>({...iX(t),options:[t,e]}),vX=(t,e)=>({...oX(t),options:[t,e]}),bX=(t,e)=>({...uX(t),options:[t,e]}),yX=(t,e)=>({...sX(t),options:[t,e]}),EX=(t,e)=>({...lX(t),options:[t,e]}),SX=(t,e)=>({...cX(t),options:[t,e]}),xX=(t,e)=>({...hX(t),options:[t,e]});var _X="Arrow",EB=y.forwardRef((t,e)=>{const{children:r,width:a=10,height:n=5,...s}=t;return g.jsx(ot.svg,{...s,ref:e,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});EB.displayName=_X;var wX=EB,sR="Popper",[SB,Co]=Wa(sR),[TX,xB]=SB(sR),_B=t=>{const{__scopePopper:e,children:r}=t,[a,n]=y.useState(null);return g.jsx(TX,{scope:e,anchor:a,onAnchorChange:n,children:r})};_B.displayName=sR;var wB="PopperAnchor",TB=y.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:a,...n}=t,s=xB(wB,r),l=y.useRef(null),c=At(e,l),d=y.useRef(null);return y.useEffect(()=>{const f=d.current;d.current=a?.current||l.current,f!==d.current&&s.onAnchorChange(d.current)}),a?null:g.jsx(ot.div,{...n,ref:c})});TB.displayName=wB;var lR="PopperContent",[RX,AX]=SB(lR),RB=y.forwardRef((t,e)=>{const{__scopePopper:r,side:a="bottom",sideOffset:n=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:_,...S}=t,R=xB(lR,r),[x,T]=y.useState(null),A=At(e,L=>T(L)),[C,k]=y.useState(null),N=eB(C),I=N?.width??0,O=N?.height??0,P=a+(s!=="center"?"-"+s:""),M=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},U=Array.isArray(f)?f:[f],G=U.length>0,J={padding:M,boundary:U.filter(NX),altBoundary:G},{refs:V,floatingStyles:Y,placement:j,isPositioned:q,middlewareData:H}=mX({strategy:"fixed",placement:P,whileElementsMounted:(...L)=>aX(...L,{animationFrame:b==="always"}),elements:{reference:R.anchor},middleware:[gX({mainAxis:n+O,alignmentAxis:l}),d&&vX({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?bX():void 0,...J}),d&&yX({...J}),EX({...J,apply:({elements:L,rects:X,availableWidth:ne,availableHeight:ee})=>{const{width:ce,height:ge}=X.reference,Ae=L.floating.style;Ae.setProperty("--radix-popper-available-width",`${ne}px`),Ae.setProperty("--radix-popper-available-height",`${ee}px`),Ae.setProperty("--radix-popper-anchor-width",`${ce}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),C&&xX({element:C,padding:c}),kX({arrowWidth:I,arrowHeight:O}),v&&SX({strategy:"referenceHidden",...J})]}),[Q,ie]=NB(j),$=qa(_);en(()=>{q&&$?.()},[q,$]);const W=H.arrow?.x,F=H.arrow?.y,K=H.arrow?.centerOffset!==0,[re,B]=y.useState();return en(()=>{x&&B(window.getComputedStyle(x).zIndex)},[x]),g.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:q?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(RX,{scope:r,placedSide:Q,onArrowChange:k,arrowX:W,arrowY:F,shouldHideArrow:K,children:g.jsx(ot.div,{"data-side":Q,"data-align":ie,...S,ref:A,style:{...S.style,animation:q?void 0:"none"}})})})});RB.displayName=lR;var AB="PopperArrow",CX={top:"bottom",right:"left",bottom:"top",left:"right"},CB=y.forwardRef(function(e,r){const{__scopePopper:a,...n}=e,s=AX(AB,a),l=CX[s.placedSide];return g.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g.jsx(wX,{...n,ref:r,style:{...n.style,display:"block"}})})});CB.displayName=AB;function NX(t){return t!==null}var kX=t=>({name:"transformOrigin",options:t,fn(e){const{placement:r,rects:a,middlewareData:n}=e,l=n.arrow?.centerOffset!==0,c=l?0:t.arrowWidth,d=l?0:t.arrowHeight,[f,m]=NB(r),h={start:"0%",center:"50%",end:"100%"}[m],v=(n.arrow?.x??0)+c/2,b=(n.arrow?.y??0)+d/2;let _="",S="";return f==="bottom"?(_=l?h:`${v}px`,S=`${-d}px`):f==="top"?(_=l?h:`${v}px`,S=`${a.floating.height+d}px`):f==="right"?(_=`${-d}px`,S=l?h:`${b}px`):f==="left"&&(_=`${a.floating.width+d}px`,S=l?h:`${b}px`),{data:{x:_,y:S}}}});function NB(t){const[e,r="center"]=t.split("-");return[e,r]}var Cm=_B,ud=TB,Nm=RB,km=CB,IX="Portal",oc=y.forwardRef((t,e)=>{const{container:r,...a}=t,[n,s]=y.useState(!1);en(()=>s(!0),[]);const l=r||n&&globalThis?.document?.body;return l?A$.createPortal(g.jsx(ot.div,{...a,ref:e}),l):null});oc.displayName=IX;function OX(t,e){return y.useReducer((r,a)=>e[r][a]??r,t)}var oa=t=>{const{present:e,children:r}=t,a=DX(e),n=typeof r=="function"?r({present:a.isPresent}):y.Children.only(r),s=At(a.ref,LX(n));return typeof r=="function"||a.isPresent?y.cloneElement(n,{ref:s}):null};oa.displayName="Presence";function DX(t){const[e,r]=y.useState(),a=y.useRef(null),n=y.useRef(t),s=y.useRef("none"),l=t?"mounted":"unmounted",[c,d]=OX(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const f=Hf(a.current);s.current=c==="mounted"?f:"none"},[c]),en(()=>{const f=a.current,m=n.current;if(m!==t){const v=s.current,b=Hf(f);t?d("MOUNT"):b==="none"||f?.display==="none"?d("UNMOUNT"):d(m&&v!==b?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,d]),en(()=>{if(e){let f;const m=e.ownerDocument.defaultView??window,h=b=>{const S=Hf(a.current).includes(CSS.escape(b.animationName));if(b.target===e&&S&&(d("ANIMATION_END"),!n.current)){const R=e.style.animationFillMode;e.style.animationFillMode="forwards",f=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=R)})}},v=b=>{b.target===e&&(s.current=Hf(a.current))};return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{m.clearTimeout(f),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(f=>{a.current=f?getComputedStyle(f):null,r(f)},[])}}function Hf(t){return t?.animationName||"none"}function LX(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var kB=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"}),MX="VisuallyHidden",IB=y.forwardRef((t,e)=>g.jsx(ot.span,{...t,ref:e,style:{...kB,...t.style}}));IB.displayName=MX;var PX=IB,[Im]=Wa("Tooltip",[Co]),Om=Co(),OB="TooltipProvider",UX=700,Iw="tooltip.open",[jX,cR]=Im(OB),DB=t=>{const{__scopeTooltip:e,delayDuration:r=UX,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:s}=t,l=y.useRef(!0),c=y.useRef(!1),d=y.useRef(0);return y.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),g.jsx(jX,{scope:e,isOpenDelayedRef:l,delayDuration:r,onOpen:y.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:y.useCallback(f=>{c.current=f},[]),disableHoverableContent:n,children:s})};DB.displayName=OB;var Fu="Tooltip",[FX,dd]=Im(Fu),LB=t=>{const{__scopeTooltip:e,children:r,open:a,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=t,d=cR(Fu,t.__scopeTooltip),f=Om(e),[m,h]=y.useState(null),v=Gr(),b=y.useRef(0),_=l??d.disableHoverableContent,S=c??d.delayDuration,R=y.useRef(!1),[x,T]=xo({prop:a,defaultProp:n??!1,onChange:I=>{I?(d.onOpen(),document.dispatchEvent(new CustomEvent(Iw))):d.onClose(),s?.(I)},caller:Fu}),A=y.useMemo(()=>x?R.current?"delayed-open":"instant-open":"closed",[x]),C=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R.current=!1,T(!0)},[T]),k=y.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T(!1)},[T]),N=y.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{R.current=!0,T(!0),b.current=0},S)},[S,T]);return y.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),g.jsx(Cm,{...f,children:g.jsx(FX,{scope:e,contentId:v,open:x,stateAttribute:A,trigger:m,onTriggerChange:h,onTriggerEnter:y.useCallback(()=>{d.isOpenDelayedRef.current?N():C()},[d.isOpenDelayedRef,N,C]),onTriggerLeave:y.useCallback(()=>{_?k():(window.clearTimeout(b.current),b.current=0)},[k,_]),onOpen:C,onClose:k,disableHoverableContent:_,children:r})})};LB.displayName=Fu;var Ow="TooltipTrigger",MB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=dd(Ow,r),s=cR(Ow,r),l=Om(r),c=y.useRef(null),d=At(e,c,n.onTriggerChange),f=y.useRef(!1),m=y.useRef(!1),h=y.useCallback(()=>f.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),g.jsx(ud,{asChild:!0,...l,children:g.jsx(ot.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:d,onPointerMove:ze(t.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),m.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{n.onTriggerLeave(),m.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{n.open&&n.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ze(t.onFocus,()=>{f.current||n.onOpen()}),onBlur:ze(t.onBlur,n.onClose),onClick:ze(t.onClick,n.onClose)})})});MB.displayName=Ow;var uR="TooltipPortal",[zX,$X]=Im(uR,{forceMount:void 0}),PB=t=>{const{__scopeTooltip:e,forceMount:r,children:a,container:n}=t,s=dd(uR,e);return g.jsx(zX,{scope:e,forceMount:r,children:g.jsx(oa,{present:r||s.open,children:g.jsx(oc,{asChild:!0,container:n,children:a})})})};PB.displayName=uR;var Hl="TooltipContent",UB=y.forwardRef((t,e)=>{const r=$X(Hl,t.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...s}=t,l=dd(Hl,t.__scopeTooltip);return g.jsx(oa,{present:a||l.open,children:l.disableHoverableContent?g.jsx(jB,{side:n,...s,ref:e}):g.jsx(BX,{side:n,...s,ref:e})})}),BX=y.forwardRef((t,e)=>{const r=dd(Hl,t.__scopeTooltip),a=cR(Hl,t.__scopeTooltip),n=y.useRef(null),s=At(e,n),[l,c]=y.useState(null),{trigger:d,onClose:f}=r,m=n.current,{onPointerInTransitChange:h}=a,v=y.useCallback(()=>{c(null),h(!1)},[h]),b=y.useCallback((_,S)=>{const R=_.currentTarget,x={x:_.clientX,y:_.clientY},T=VX(x,R.getBoundingClientRect()),A=WX(x,T),C=YX(S.getBoundingClientRect()),k=ZX([...A,...C]);c(k),h(!0)},[h]);return y.useEffect(()=>()=>v(),[v]),y.useEffect(()=>{if(d&&m){const _=R=>b(R,m),S=R=>b(R,d);return d.addEventListener("pointerleave",_),m.addEventListener("pointerleave",S),()=>{d.removeEventListener("pointerleave",_),m.removeEventListener("pointerleave",S)}}},[d,m,b,v]),y.useEffect(()=>{if(l){const _=S=>{const R=S.target,x={x:S.clientX,y:S.clientY},T=d?.contains(R)||m?.contains(R),A=!KX(x,l);T?v():A&&(v(),f())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[d,m,l,f,v]),g.jsx(jB,{...t,ref:s})}),[qX,HX]=Im(Fu,{isInside:!1}),GX=aK("TooltipContent"),jB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=t,d=dd(Hl,r),f=Om(r),{onClose:m}=d;return y.useEffect(()=>(document.addEventListener(Iw,m),()=>document.removeEventListener(Iw,m)),[m]),y.useEffect(()=>{if(d.trigger){const h=v=>{v.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,m]),g.jsx(nc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:g.jsxs(Nm,{"data-state":d.stateAttribute,...f,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(GX,{children:a}),g.jsx(qX,{scope:r,isInside:!0,children:g.jsx(PX,{id:d.contentId,role:"tooltip",children:n||a})})]})})});UB.displayName=Hl;var FB="TooltipArrow",zB=y.forwardRef((t,e)=>{const{__scopeTooltip:r,...a}=t,n=Om(r);return HX(FB,r).isInside?null:g.jsx(km,{...n,...a,ref:e})});zB.displayName=FB;function VX(t,e){const r=Math.abs(e.top-t.y),a=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(r,a,n,s)){case s:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function WX(t,e,r=5){const a=[];switch(e){case"top":a.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":a.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":a.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":a.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return a}function YX(t){const{top:e,right:r,bottom:a,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:a},{x:n,y:a}]}function KX(t,e){const{x:r,y:a}=t;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const c=e[s],d=e[l],f=c.x,m=c.y,h=d.x,v=d.y;m>a!=v>a&&r<(h-f)*(a-m)/(v-m)+f&&(n=!n)}return n}function ZX(t){const e=t.slice();return e.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),XX(e)}function XX(t){if(t.length<=1)return t.slice();const e=[];for(let a=0;a<t.length;a++){const n=t[a];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let a=t.length-1;a>=0;a--){const n=t[a];for(;r.length>=2;){const s=r[r.length-1],l=r[r.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var QX=DB,JX=LB,eQ=MB,tQ=PB,rQ=UB,nQ=zB;function $B({delayDuration:t=0,...e}){return g.jsx(QX,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Zr({...t}){return g.jsx($B,{children:g.jsx(JX,{"data-slot":"tooltip",...t})})}function Xr({...t}){return g.jsx(eQ,{"data-slot":"tooltip-trigger",...t})}function Qr({className:t,sideOffset:e=0,children:r,...a}){return g.jsx(tQ,{children:g.jsxs(rQ,{"data-slot":"tooltip-content",sideOffset:e,className:Ue("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...a,children:[r,g.jsx(nQ,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class aQ{name="mcp_inspector_open";properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}}class gO{name="mcp_tool_execution";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}}class vO{name="mcp_resource_read";properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}}class bO{name="mcp_prompt_call";properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}}class yO{name="mcp_chat_message";properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}}class iQ{name="mcp_server_added";properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}}class oQ{name="mcp_server_removed";properties;constructor(e){this.properties={server_id:e.serverId}}}class sQ{name="mcp_command_palette_open";properties;constructor(e){this.properties={trigger:e.trigger}}}class lQ{name="mcp_tool_saved";properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}}function Sb(){try{return"0.4.10"}catch{return"0.0.0"}}var cQ={};function xb(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class EO{endpoint;timeout;constructor(e,r=3e3){this.endpoint=e,this.timeout=r}async logEvent(e){try{const r=new AbortController,a=setTimeout(()=>r.abort(),this.timeout),n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(clearTimeout(a),!n.ok)throw new Error(`HTTP error! status: ${n.status}`)}catch{}}}function oo(t){return`mcp_inspector_telemetry_${t}`}class Mr{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const e=xb(),r=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",r)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new EO(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new EO(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(oo("disabled"))==="true"||typeof process<"u"&&cQ?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(oo("source")):null}static getInstance(){return Mr.instance||(Mr.instance=new Mr),Mr.instance}setSource(e){this._source=e,typeof localStorage<"u"&&localStorage.setItem(oo("source"),e)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!xb())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const e=localStorage.getItem(oo("user_id"));if(e)this._currUserId=e;else{const r=this.generateUserId();localStorage.setItem(oo("user_id"),r),this._currUserId=r}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const r={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:Sb(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(r)}catch{}if(this._scarfClient)try{const r={};r.mcp_use_version=Sb(),r.user_id=this.userId,r.event=e.name,r.language="typescript",r.source=this._source,r.package="inspector",await this._scarfClient.logEvent(r)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&xb())try{const r=Sb();let a=!1,n=!1;const s=localStorage.getItem(oo("download_version"));if(s?r>s&&(a=!0,n=!1,localStorage.setItem(oo("download_version"),r)):(a=!0,n=!0,localStorage.setItem(oo("download_version"),r)),a){const l={...e||{}};l.mcp_use_version=r,l.user_id=this.userId,l.event="package_download",l.first_download=n,l.language="typescript",l.source=this._source,l.package="inspector",await this._scarfClient.logEvent(l)}}catch{}}async trackInspectorOpen(e){const r=new aQ(e);await this.capture(r)}}const BB=y.createContext(void 0);function uQ({url:t,name:e,proxyConfig:r,transportType:a,onUpdate:n,onRemove:s}){const l=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let c=t,d={};if(r?.proxyAddress){const v=new URL(r.proxyAddress),b=new URL(t);c=`${v.origin}${v.pathname}${b.pathname}${b.search}`,d["X-Target-URL"]=t}r?.customHeaders&&(d={...d,...r.customHeaders});const f=BT({url:c,callbackUrl:l,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http"}),m=y.useRef(n),h=y.useRef(null);return y.useEffect(()=>{m.current=n},[n]),y.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{const v={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage},b=h.current;(!b||b.state!==v.state||b.error!==v.error||b.authUrl!==v.authUrl||b.tools.length!==v.tools.length||b.resources.length!==v.resources.length||b.prompts.length!==v.prompts.length)&&(h.current=v,m.current(v))});else{const v={id:t,url:t,name:e,state:f.state,tools:f.tools,resources:f.resources,prompts:f.prompts,error:f.error??null,authUrl:f.authUrl??null,callTool:f.callTool,readResource:f.readResource,listPrompts:f.listPrompts,getPrompt:f.getPrompt,authenticate:f.authenticate,retry:f.retry,clearStorage:f.clearStorage},b=h.current;(!b||b.state!==v.state||b.error!==v.error||b.authUrl!==v.authUrl||b.tools.length!==v.tools.length||b.resources.length!==v.resources.length||b.prompts.length!==v.prompts.length)&&(h.current=v,m.current(v))}},[t,e,f.state,f.tools,f.resources,f.prompts,f.error,f.authUrl]),null}function dQ({children:t}){const[e,r]=y.useState([]),[a,n]=y.useState(new Map),[s,l]=y.useState(0),[c,d]=y.useState(!0),[f,m]=y.useState(new Set);y.useEffect(()=>{const C=localStorage.getItem("mcp-inspector-connections");if(C)try{const N=JSON.parse(C),I=Array.isArray(N)?N.filter(P=>P&&typeof P=="object"&&typeof P.id=="string"&&typeof P.url=="string"&&typeof P.name=="string").map(P=>(P.transportType||(P.transportType="http"),P)):[];(I.length!==N.length||I.some(P=>P.transportType==="http"&&!N.find(M=>M.id===P.id&&M.transportType)))&&(console.warn("Updated connections in localStorage with transport type migration"),localStorage.setItem("mcp-inspector-connections",JSON.stringify(I))),r(I)}catch(N){console.error("Failed to parse saved connections:",N),localStorage.removeItem("mcp-inspector-connections")}const k=localStorage.getItem("mcp-inspector-auto-connect");k!==null&&d(k==="true")},[]);const h=y.useCallback(C=>{n(k=>new Map(k).set(C.id,C)),l(k=>k+1)},[]),v=y.useCallback((C,k,N,I)=>{const P={id:C,url:C,name:k||C,proxyConfig:N,transportType:I||"http"};r(M=>{if(M.some(G=>G.id===C))return M;const U=[...M,P];return localStorage.setItem("mcp-inspector-connections",JSON.stringify(U)),U})},[]),b=y.useCallback(C=>{Mr.getInstance().capture(new oQ({serverId:C})).catch(()=>{}),r(N=>{const I=N.filter(O=>O.id!==C);return localStorage.setItem("mcp-inspector-connections",JSON.stringify(I)),I}),n(N=>{const I=new Map(N),O=I.get(C);if(O){try{O.clearStorage()}catch(P){console.error("Failed to clear storage:",P)}I.delete(C)}return I})},[]),_=y.useCallback(C=>{const k=a.get(C);if(k)return k;const N=e.find(I=>I.id===C);if(N)return{id:N.id,url:N.url,name:N.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,listPrompts:async I=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{}}},[a,e]),S=y.useCallback(C=>{d(C),localStorage.setItem("mcp-inspector-auto-connect",String(C)),C||m(new Set)},[]),R=y.useCallback(C=>{m(k=>new Set(k).add(C))},[]),x=y.useCallback(C=>{m(k=>{const N=new Set(k);return N.delete(C),N}),n(k=>{const N=new Map(k),I=N.get(C);if(I){try{I.clearStorage()}catch(O){console.error("Failed to clear storage:",O)}N.delete(C)}return N})},[]),T=y.useMemo(()=>{const C=e.map(k=>{const N=a.get(k.id);return N||{id:k.id,url:k.url,name:k.name,state:"disconnected",tools:[],resources:[],prompts:[],error:null,authUrl:null,callTool:async()=>{throw new Error("Not connected")},readResource:async()=>{throw new Error("Not connected")},listPrompts:async I=>{throw new Error("Not connected")},getPrompt:async()=>{throw new Error("Not connected")},authenticate:()=>{},retry:()=>{},clearStorage:()=>{}}});return console.warn("[McpContext] Connections updated, version:",s,"count:",C.length,"states:",C.map(k=>`${k.id}:${k.state}`)),C},[a,e,s]),A=y.useMemo(()=>({connections:T,addConnection:v,removeConnection:b,getConnection:_,autoConnect:c,setAutoConnect:S,connectServer:R,disconnectServer:x}),[T,v,b,_,c,S,R,x]);return g.jsxs(BB,{value:A,children:[e.filter(C=>c||f.has(C.id)).map(C=>g.jsx(uQ,{url:C.url,name:C.name,proxyConfig:C.proxyConfig,transportType:C.transportType,onUpdate:h,onRemove:()=>b(C.id)},C.id)),t]})}function dR(){const t=y.use(BB);if(!t)throw new Error("useMcpContext must be used within McpProvider");return t}var _b="focusScope.autoFocusOnMount",wb="focusScope.autoFocusOnUnmount",SO={bubbles:!1,cancelable:!0},fQ="FocusScope",fd=y.forwardRef((t,e)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...l}=t,[c,d]=y.useState(null),f=qa(n),m=qa(s),h=y.useRef(null),v=At(e,S=>d(S)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(a){let S=function(A){if(b.paused||!c)return;const C=A.target;c.contains(C)?h.current=C:lo(h.current,{select:!0})},R=function(A){if(b.paused||!c)return;const C=A.relatedTarget;C!==null&&(c.contains(C)||lo(h.current,{select:!0}))},x=function(A){if(document.activeElement===document.body)for(const k of A)k.removedNodes.length>0&&lo(c)};document.addEventListener("focusin",S),document.addEventListener("focusout",R);const T=new MutationObserver(x);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",R),T.disconnect()}}},[a,c,b.paused]),y.useEffect(()=>{if(c){_O.add(b);const S=document.activeElement;if(!c.contains(S)){const x=new CustomEvent(_b,SO);c.addEventListener(_b,f),c.dispatchEvent(x),x.defaultPrevented||(pQ(bQ(qB(c)),{select:!0}),document.activeElement===S&&lo(c))}return()=>{c.removeEventListener(_b,f),setTimeout(()=>{const x=new CustomEvent(wb,SO);c.addEventListener(wb,m),c.dispatchEvent(x),x.defaultPrevented||lo(S??document.body,{select:!0}),c.removeEventListener(wb,m),_O.remove(b)},0)}}},[c,f,m,b]);const _=y.useCallback(S=>{if(!r&&!a||b.paused)return;const R=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,x=document.activeElement;if(R&&x){const T=S.currentTarget,[A,C]=mQ(T);A&&C?!S.shiftKey&&x===C?(S.preventDefault(),r&&lo(A,{select:!0})):S.shiftKey&&x===A&&(S.preventDefault(),r&&lo(C,{select:!0})):x===T&&S.preventDefault()}},[r,a,b.paused]);return g.jsx(ot.div,{tabIndex:-1,...l,ref:v,onKeyDown:_})});fd.displayName=fQ;function pQ(t,{select:e=!1}={}){const r=document.activeElement;for(const a of t)if(lo(a,{select:e}),document.activeElement!==r)return}function mQ(t){const e=qB(t),r=xO(e,t),a=xO(e.reverse(),t);return[r,a]}function qB(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function xO(t,e){for(const r of t)if(!hQ(r,{upTo:e}))return r}function hQ(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function gQ(t){return t instanceof HTMLInputElement&&"select"in t}function lo(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&gQ(t)&&e&&t.select()}}var _O=vQ();function vQ(){let t=[];return{add(e){const r=t[0];e!==r&&r?.pause(),t=wO(t,e),t.unshift(e)},remove(e){t=wO(t,e),t[0]?.resume()}}}function wO(t,e){const r=[...t],a=r.indexOf(e);return a!==-1&&r.splice(a,1),r}function bQ(t){return t.filter(e=>e.tagName!=="A")}var Tb=0;function Dm(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??TO()),document.body.insertAdjacentElement("beforeend",t[1]??TO()),Tb++,()=>{Tb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tb--}},[])}function TO(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Oa=function(){return Oa=Object.assign||function(e){for(var r,a=1,n=arguments.length;a<n;a++){r=arguments[a];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Oa.apply(this,arguments)};function HB(t,e){var r={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(r[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)e.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(r[a[n]]=t[a[n]]);return r}function yQ(t,e,r){if(r||arguments.length===2)for(var a=0,n=e.length,s;a<n;a++)(s||!(a in e))&&(s||(s=Array.prototype.slice.call(e,0,a)),s[a]=e[a]);return t.concat(s||Array.prototype.slice.call(e))}var fp="right-scroll-bar-position",pp="width-before-scroll-bar",EQ="with-scroll-bars-hidden",SQ="--removed-body-scroll-bar-size";function Rb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function xQ(t,e){var r=y.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=e,r.facade}var _Q=typeof window<"u"?y.useLayoutEffect:y.useEffect,RO=new WeakMap;function wQ(t,e){var r=xQ(null,function(a){return t.forEach(function(n){return Rb(n,a)})});return _Q(function(){var a=RO.get(r);if(a){var n=new Set(a),s=new Set(t),l=r.current;n.forEach(function(c){s.has(c)||Rb(c,null)}),s.forEach(function(c){n.has(c)||Rb(c,l)})}RO.set(r,t)},[t]),r}function TQ(t){return t}function RQ(t,e){e===void 0&&(e=TQ);var r=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var l=e(s,a);return r.push(l),function(){r=r.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(a=!0;r.length;){var l=r;r=[],l.forEach(s)}r={push:function(c){return s(c)},filter:function(){return r}}},assignMedium:function(s){a=!0;var l=[];if(r.length){var c=r;r=[],c.forEach(s),l=r}var d=function(){var m=l;l=[],m.forEach(s)},f=function(){return Promise.resolve().then(d)};f(),r={push:function(m){l.push(m),f()},filter:function(m){return l=l.filter(m),r}}}};return n}function AQ(t){t===void 0&&(t={});var e=RQ(null);return e.options=Oa({async:!0,ssr:!1},t),e}var GB=function(t){var e=t.sideCar,r=HB(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return y.createElement(a,Oa({},r))};GB.isSideCarExport=!0;function CQ(t,e){return t.useMedium(e),GB}var VB=AQ(),Ab=function(){},Lm=y.forwardRef(function(t,e){var r=y.useRef(null),a=y.useState({onScrollCapture:Ab,onWheelCapture:Ab,onTouchMoveCapture:Ab}),n=a[0],s=a[1],l=t.forwardProps,c=t.children,d=t.className,f=t.removeScrollBar,m=t.enabled,h=t.shards,v=t.sideCar,b=t.noRelative,_=t.noIsolation,S=t.inert,R=t.allowPinchZoom,x=t.as,T=x===void 0?"div":x,A=t.gapMode,C=HB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=v,N=wQ([r,e]),I=Oa(Oa({},C),n);return y.createElement(y.Fragment,null,m&&y.createElement(k,{sideCar:VB,removeScrollBar:f,shards:h,noRelative:b,noIsolation:_,inert:S,setCallbacks:s,allowPinchZoom:!!R,lockRef:r,gapMode:A}),l?y.cloneElement(y.Children.only(c),Oa(Oa({},I),{ref:N})):y.createElement(T,Oa({},I,{className:d,ref:N}),c))});Lm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lm.classNames={fullWidth:pp,zeroRight:fp};var NQ=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kQ(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=NQ();return e&&t.setAttribute("nonce",e),t}function IQ(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function OQ(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var DQ=function(){var t=0,e=null;return{add:function(r){t==0&&(e=kQ())&&(IQ(e,r),OQ(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},LQ=function(){var t=DQ();return function(e,r){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},WB=function(){var t=LQ(),e=function(r){var a=r.styles,n=r.dynamic;return t(a,n),null};return e},MQ={left:0,top:0,right:0,gap:0},Cb=function(t){return parseInt(t||"",10)||0},PQ=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],a=e[t==="padding"?"paddingTop":"marginTop"],n=e[t==="padding"?"paddingRight":"marginRight"];return[Cb(r),Cb(a),Cb(n)]},UQ=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return MQ;var e=PQ(t),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-r+e[2]-e[0])}},jQ=WB(),Ll="data-scroll-locked",FQ=function(t,e,r,a){var n=t.left,s=t.top,l=t.right,c=t.gap;return r===void 0&&(r="margin"),`
|
|
315
315
|
.`.concat(EQ,` {
|
|
316
316
|
overflow: hidden `).concat(a,`;
|
|
317
317
|
padding-right: `).concat(c,"px ").concat(a,`;
|
|
@@ -1717,7 +1717,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1717
1717
|
<\/script>
|
|
1718
1718
|
</body>
|
|
1719
1719
|
</html>`,gq=1,oz=2,vq=3,sz=4,bq=5,lz=Symbol.for("quilt.threads.serialize"),rhe=Symbol.for("quilt.threads.transferable");class nhe extends AbortController{constructor(...e){super();const r=e.find(a=>a.aborted);if(r)this.abort(r.reason);else{const a=s=>this.abort(s.target.reason),n={signal:this.signal};for(const s of e)s.addEventListener("abort",a,n)}}}class cz extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let ahe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function yq(t=21){let e="",r=crypto.getRandomValues(new Uint8Array(t));for(let a=0;a<t;a++)e+=ahe[63&r[a]];return e}var fu,bl,pu,Np,pT,Eq;class ihe{constructor(){ga(this,pT),ga(this,fu,new Map),ga(this,bl,new Map),ga(this,pu,new Map),ga(this,Np,new WeakMap)}get(e){return er(this,bl).get(e)}release(e){const r=er(this,bl).get(e);return r&&(er(this,bl).delete(e),er(this,fu).delete(r)),!!r}serialize(e){let r=er(this,fu).get(e);return r==null&&(r=yq(),er(this,fu).set(e,r),er(this,bl).set(r,e)),r}deserialize(e,r){var a,n;let s=(a=er(this,pu).get(e))==null?void 0:a.deref();return s||(s=(...l)=>{if(!er(this,pu).has(e))throw new Error("You attempted to call a function that was already revoked.");return r.call((c,d,f)=>{r.messages.send([vq,c,e,d],f)},l)},(n=Hr(this,pT,Eq).call(this,r))==null||n.register(s,e),er(this,pu).set(e,new WeakRef(s)),s)}}fu=new WeakMap,bl=new WeakMap,pu=new WeakMap,Np=new WeakMap,pT=new WeakSet,Eq=function(t){let e=er(this,Np).get(t);if(!(typeof FinalizationRegistry>"u"))return e||(e=new FinalizationRegistry(r=>{t.messages.send([bq,r])}),er(this,Np).set(t,e)),e};function ohe(t){return t!=null&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&typeof t.next=="function"}function uz(t){if(t==null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e==null||e===Object.prototype}const j_="_@f",dz="_@i";var Au,Cu,Xn,kp,uo;class she{constructor(e){ga(this,Xn),ga(this,Au),ga(this,Cu),dT(this,Au,e?.serialize),dT(this,Cu,e?.deserialize)}serialize(e,r,a){return Hr(this,Xn,kp).call(this,e,r,a)}deserialize(e,r){return Hr(this,Xn,uo).call(this,e,r)}}Au=new WeakMap,Cu=new WeakMap,Xn=new WeakSet,kp=function(t,e,r,a=new Map,n=!1){if(t==null)return t;if(a.has(t))return a.get(t);if(a.set(t,void 0),typeof t=="object"){if(er(this,Au)&&!n){const c=er(this,Au).call(this,t,d=>Hr(this,Xn,kp).call(this,d,e,r,a,!0),e,r);if(c!==void 0)return a.set(t,c),c}if(t[rhe])return r?.push(t),a.set(t,t),t;const s=c=>Hr(this,Xn,kp).call(this,c,e,r,a);if(typeof t[lz]=="function"){const c=t[lz]({serialize:s});return a.set(t,c),c}if(Array.isArray(t)){const c=t.map(d=>s(d));return a.set(t,c),c}if(t instanceof Map){const c=[...t.entries()].map(([f,m])=>[s(f),s(m)]),d=new Map(c);return a.set(t,d),d}if(t instanceof Set){const c=[...t].map(f=>s(f)),d=new Set(c);return a.set(t,d),d}const l=ohe(t);if(uz(t)||l){const c={};for(const d of Object.keys(t))c[d]=s(t[d]);return l&&(c.next??(c.next=s(t.next.bind(t))),c.return??(c.return=s(t.return.bind(t))),c.throw??(c.throw=s(t.throw.bind(t))),c[dz]=!0),a.set(t,c),c}}if(typeof t=="function"){const s=e.functions.serialize(t,e,r),l={[j_]:s};return a.set(t,l),l}return a.set(t,t),t},uo=function(t,e,r=!1){if(t==null)return t;if(typeof t=="object"){if(er(this,Cu)&&!r){const n=er(this,Cu).call(this,t,s=>Hr(this,Xn,uo).call(this,s,e,!0),e);if(n!==void 0)return n}if(t==null)return t;if(Array.isArray(t))return t.map(n=>Hr(this,Xn,uo).call(this,n,e));if(t instanceof Map)return new Map([...t].map(([n,s])=>[Hr(this,Xn,uo).call(this,n,e),Hr(this,Xn,uo).call(this,s,e)]));if(t instanceof Set)return new Set([...t].map(n=>Hr(this,Xn,uo).call(this,n,e)));if(j_ in t)return e.functions.deserialize(t[j_],e);if(!uz(t))return t;const a={};for(const n of Object.keys(t))n===dz?a[Symbol.asyncIterator]=()=>a:a[n]=Hr(this,Xn,uo).call(this,t[n],e);return a}return t};var yl,cs,fo,mT,Sq,hT,xq;class lhe{constructor(e,{imports:r,exports:a,functions:n=new ihe,serialization:s=new she,signal:l}={}){ga(this,fo),ga(this,yl),ga(this,cs,new Map);var c,d,f,m;this.messages=e,dT(this,yl,l?new nhe(l):new AbortController),this.exports=a??{},this.imports=che(Hr(this,fo,Sq).bind(this),r),this.functions=n,this.serialization=s,(d=(c=this.functions).start)==null||d.call(c,this),(m=(f=this.serialization).start)==null||m.call(f,this),this.signal.addEventListener("abort",()=>{for(const h of er(this,cs).keys())Hr(this,fo,hT).call(this,h,void 0,new cz);er(this,cs).clear()},{once:!0}),e.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const v=h;switch(v[0]){case gq:{const[,b,_,S]=v,R=this.exports[_]??(()=>{throw new Error(`No '${_}' method is exported from this thread`)});await Hr(this,fo,mT).call(this,R,S,(x,T,A)=>{this.messages.send([oz,b,x,T],A)});break}case vq:{const[,b,_,S]=v,R=this.functions.get(_,this)??uhe;await Hr(this,fo,mT).call(this,R,S,(x,T,A)=>{this.messages.send([sz,b,x,T],A)});break}case oz:case sz:{Hr(this,fo,hT).call(this,...v.slice(1));break}case bq:{const b=v[1];this.functions.release(b,this);break}}},{signal:this.signal})}get signal(){return er(this,yl).signal}get closed(){return er(this,yl).signal.aborted}close(){er(this,yl).abort()}call(e,r){if(this.closed)return Promise.reject(new cz);const a=[],n=this.serialization.serialize(r,this,a),s=yq(),l=Hr(this,fo,xq).call(this,s);return e(s,n,a),l}}yl=new WeakMap,cs=new WeakMap,fo=new WeakSet,mT=async function(t,e,r){try{const a=this.functions.call?await this.functions.call(t,e,this):await t(...this.serialization.deserialize(e,this)),n=[],s=this.serialization.serialize(a,this,n);r(s,void 0,n)}catch(a){r(void 0,this.serialization.serialize(a,this))}},Sq=function(t){return(...e)=>{try{if(typeof t!="string"&&typeof t!="number")throw new Error(`Can’t call a symbol method on a thread: ${t.toString()}`);return this.call((r,a,n)=>{this.messages.send([gq,r,t,a],n)},e)}catch(r){return Promise.reject(r)}}},hT=function(...t){const e=t[0],r=er(this,cs).get(e);r&&(r(...t),er(this,cs).delete(e))},xq=function(t){const e=new Promise((r,a)=>{er(this,cs).set(t,(n,s,l)=>{l==null?r(this.serialization.deserialize(s,this)):a(this.serialization.deserialize(l,this))})});return Object.defineProperty(e,Symbol.asyncIterator,{async*value(){const r=await e;Object.defineProperty(r,Symbol.asyncIterator,{value:()=>r}),yield*r}}),e};function che(t,e){let r;if(e==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const a=new Map;r=new Proxy({},{get(n,s){if(a.has(s))return a.get(s);const l=t(s);return a.set(s,l),l}})}else{r={};for(const a of e)Object.defineProperty(r,a,{value:t(a),writable:!1,configurable:!0,enumerable:!0})}return r}function uhe(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const dhe="quilt.threads.ping",fz="quilt.threads.pong";function fhe(t,{targetOrigin:e="*"}={}){let r=!1;const a=function(s,l){t.postMessage(s,e,l)},n=new Promise(s=>{const l=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===t&&c.data===fz&&(r=!0,l.abort(),s())},{signal:l.signal}),l.signal.addEventListener("abort",()=>s(),{once:!0}),a(dhe)});return{send(s,l){return r?a(s,l):n.then(()=>{if(r)return a(s,l)})},listen(s,{signal:l}){self.addEventListener("message",c=>{c.source===t&&c.data!==fz&&s(c.data)},{signal:l})}}}class phe extends lhe{constructor(e,{targetOrigin:r="*",...a}={}){super(fhe(e.contentWindow,{targetOrigin:r}),a),this.iframe=e}}const _q=Ce.forwardRef(({content:t,children:e,...r},a)=>g.jsx("span",{ref:a,...r,children:t||e}));_q.displayName="UIText";const wq=Ce.forwardRef(({label:t,onPress:e,onClick:r,children:a,...n},s)=>g.jsx("button",{ref:s,onClick:l=>{e&&e(),r&&r(l)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...n,children:t||a}));wq.displayName="UIButton";const Tq=Ce.forwardRef(({direction:t="vertical",spacing:e="8",align:r="stretch",justify:a="flex-start",children:n,...s},l)=>g.jsx("div",{ref:l,style:{display:"flex",flexDirection:t==="horizontal"?"row":"column",gap:`${e}px`,alignItems:r,justifyContent:a},...s,children:n}));Tq.displayName="UIStack";const Rq=Ce.forwardRef(({src:t,alt:e,width:r,height:a,children:n,...s},l)=>g.jsx("img",{ref:l,src:t,alt:e,width:r,height:a,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...s}));Rq.displayName="UIImage";const xA={name:"basic",elements:[{tagName:"ui-text",component:_q,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:wq,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:Tq,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:Rq,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},mhe=({receiver:t})=>{const e=y.useRef(null);return y.useEffect(()=>{if(e.current)return t.connect(e.current),()=>{t.disconnect()}},[t]),g.jsx("div",{ref:e,"data-testid":"standard-dom-renderer-container"})},hhe=({resource:t,library:e,remoteElements:r=[],onUIAction:a})=>{const n=y.useRef(null),s=y.useRef(null),[l,c]=y.useState(null),d=y.useMemo(()=>(t.mimeType||"").includes("framework=react")?"react":"webcomponents",[t.mimeType]),f=`${e?.name}-${d}`,{receiver:m,components:h}=y.useMemo(()=>{switch(d){case"react":{const b=new Vme,_=e||xA,S=new Map;return _&&_.elements.forEach(R=>{const x=Qme(R.component);S.set(R.tagName,x)}),{receiver:b,components:S}}case"webcomponents":default:return{receiver:new Wme,components:null}}},[t,e,r]);y.useEffect(()=>{function b(_){var S;if(n.current&&_.source===n.current.contentWindow){const R=_.data;if(!R)return;(S=a?.(R))==null||S.catch(x=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",x)})}}return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[a]),y.useEffect(()=>{const b=s.current;return s.current=null,()=>{b?.close()}},[f]);const v=()=>{const b=n.current;if(!b||s.current)return;const _=new phe(b);s.current=_;const{code:S,error:R}=Ume(t);if(R){c(R);return}if(S&&m!=null&&m.connection){const x={code:S,remoteElements:r,useReactRenderer:d==="react",componentLibrary:e?.name};_.imports.render(x,m.connection).catch(T=>console.error("Error calling remote render:",T))}};return l?g.jsx("p",{className:"text-red-500",children:l}):g.jsxs(g.Fragment,{children:[g.jsx("iframe",{ref:n,srcDoc:the,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:v},f),d==="react"&&h?g.jsx(ehe,{receiver:m,components:h}):g.jsx(mhe,{receiver:m})]})};function ghe(t){var e;if(t.contentType)return t.contentType;if(t.mimeType==="text/html")return"rawHtml";if(t.mimeType==="text/uri-list")return"externalUrl";if((e=t.mimeType)!=null&&e.startsWith("application/vnd.mcp-ui.remote-dom"))return"remoteDom"}const _A=t=>{const{resource:e,onUIAction:r,supportedContentTypes:a,htmlProps:n,remoteDomProps:s}=t,l=ghe(e);if(a&&l&&!a.includes(l))return g.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",l,"."]});switch(l){case"rawHtml":case"externalUrl":return g.jsx(uq,{resource:e,onUIAction:r,...n});case"remoteDom":return g.jsx(hhe,{resource:e,onUIAction:r,library:s?.library||xA,...s});default:return g.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};_A.displayName="UIResourceRenderer";const vhe={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},bhe={tagName:"ui-text",remoteAttributes:["content"]},yhe={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},Ehe={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},She=y.memo(({resource:t})=>{const e=async r=>(r.type==="tool"||r.type==="prompt"||(r.type==="link"?r.payload.url&&window.open(r.payload.url,"_blank"):r.type==="intent"||r.type),{status:"Action received"});return t.uri?.startsWith("ui://")?g.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:g.jsx(_A,{resource:t,onUIAction:e,htmlProps:{style:{maxWidth:"100%",height:"100%",overflow:"auto"},autoResizeIframe:!0,sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}})}):null});function pz({toolName:t,toolArgs:e,result:r,serverId:a,readResource:n}){const[s,l]=y.useState(null),c=y.useMemo(()=>{if(typeof r=="string")try{return JSON.parse(r)}catch(h){return console.error("[ToolResultRenderer] Failed to parse result:",h),r}return r},[r]),d=y.useMemo(()=>!!(c?.content&&Array.isArray(c.content)&&c.content.some(h=>h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType==="text/html+skybridge")),[c]),f=y.useMemo(()=>d&&c.content.find(v=>v.type==="resource"&&v.resource?.uri?.startsWith("ui://")&&v.resource?.mimeType==="text/html+skybridge")?.resource||null,[d,c]);if(y.useEffect(()=>{(()=>{f&&l(f)})()},[f]),d&&s&&a&&n)return g.jsx(vA,{componentUrl:s.uri,toolName:t,toolArgs:e,toolResult:c,serverId:a,readResource:n,noWrapper:!0,className:"my-4"});if(d&&!s)return g.jsx("div",{className:"my-4 p-4 bg-blue-50/30 dark:bg-blue-950/20 border border-blue-200/50 dark:border-blue-800/50 rounded-lg",children:g.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Loading component..."})});const m=[];if(c?.content&&Array.isArray(c.content))for(const h of c.content)h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType!=="text/html+skybridge"&&m.push(h.resource);return m.length>0?g.jsx(g.Fragment,{children:m.map(h=>g.jsx(She,{resource:h},`${t}-mcp-ui-${h.uri}`))}):null}function xhe({content:t,timestamp:e}){return!t||t.length===0?null:g.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:g.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[g.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:g.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:t})}),e&&g.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(e).toLocaleTimeString()})]})})}const _he=y.memo(({messages:t,isLoading:e,serverId:r,readResource:a})=>{const n=y.useRef(null);y.useEffect(()=>{t.length>0&&n.current&&n.current.scrollIntoView({behavior:e?"auto":"smooth",block:"start"})},[t.length,e]);const s=e&&(()=>{if(t.length===0)return!0;const c=t[t.length-1];if(c.role==="user")return!0;if(c.role==="assistant"){const d=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(m=>typeof m=="string"?m:m.text||JSON.stringify(m)).join(""):JSON.stringify(c.content);return!(d&&d.trim().length>0)}return!1})(),l=c=>{if(!e)return!1;const d=t[t.length-1];return c.id===d.id&&d.role==="assistant"};return g.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[t.map(c=>{const d=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(f=>typeof f=="string"?f:f.text||JSON.stringify(f)).join(""):JSON.stringify(c.content);return c.role==="user"?g.jsx(xhe,{content:d,timestamp:c.timestamp},c.id):c.role==="assistant"?g.jsx("div",{className:"space-y-4",children:c.parts&&c.parts.length>0?c.parts.map((f,m)=>{const h=f.type==="text"?`${c.id}-text-${m}-${f.text?.slice(0,20)}`:`${c.id}-tool-${f.toolInvocation?.toolName}-${m}`;return f.type==="text"?g.jsx(QF,{content:f.text||"",timestamp:m===c.parts.length-1?c.timestamp:void 0,_isStreaming:l(c)},h):f.type==="tool-invocation"&&f.toolInvocation?g.jsxs("div",{children:[g.jsx(JF,{toolName:f.toolInvocation.toolName,args:f.toolInvocation.args,result:f.toolInvocation.result,state:f.toolInvocation.result?"result":"call"}),f.toolInvocation.result&&g.jsx(pz,{toolName:f.toolInvocation.toolName,toolArgs:f.toolInvocation.args,result:f.toolInvocation.result,serverId:r,readResource:a})]},h):null}):g.jsxs(g.Fragment,{children:[g.jsx(QF,{content:d,timestamp:c.timestamp,_isStreaming:l(c)}),c.toolCalls&&c.toolCalls.length>0&&g.jsx("div",{className:"space-y-2",children:c.toolCalls.map(f=>{const m=`${c.id}-${f.toolName}-${JSON.stringify(f.args).slice(0,50)}`;return g.jsxs("div",{children:[g.jsx(JF,{toolName:f.toolName,args:f.args,result:f.result,state:f.result?"result":"call"}),f.result&&g.jsx(pz,{toolName:f.toolName,toolArgs:f.args,result:f.result,serverId:r,readResource:a})]},m)})})]})},c.id):null}),s&&g.jsx("div",{className:"flex items-start gap-3",children:g.jsx("div",{className:"flex-1",children:g.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:g.jsx("div",{className:"flex items-center gap-2",children:g.jsx("span",{className:"text-sm",children:g.jsx(Rie,{duration:2,spread:1,children:"Thinking..."})})})})})}),g.jsx("div",{ref:n})]})});function wA(t){let e=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);e=(e<<5)-e+a,e=e&e}return Math.abs(e).toString(16)}function whe({mcpServerUrl:t,llmConfig:e,authConfig:r,isConnected:a}){const[n,s]=y.useState([]),[l,c]=y.useState(!1),d=y.useCallback(async m=>{if(!m.trim()||!e||!a)return;const h={id:`user-${Date.now()}`,role:"user",content:m.trim(),timestamp:Date.now()};s(v=>[...v,h]),c(!0);try{let v=r;if(r?.type==="oauth")try{const C="mcp:auth",k=wA(t),N=`${C}_${k}_tokens`,I=localStorage.getItem(N);if(I){const O=JSON.parse(I);v={...r,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",N)}catch(C){console.warn("Failed to retrieve OAuth tokens:",C)}const b=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:t,llmConfig:e,authConfig:v,messages:[...n,h].map(C=>({role:C.role,content:C.content}))})});if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);const _=`assistant-${Date.now()}`;let S="";const R=[];s(C=>[...C,{id:_,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const x=b.body?.getReader(),T=new TextDecoder;if(!x)throw new Error("No response body");let A="";for(;;){const{done:C,value:k}=await x.read();if(C)break;A+=T.decode(k,{stream:!0});const N=A.split(`
|
|
1720
|
-
`);A=N.pop()||"";for(const I of N)if(I.trim()&&I.startsWith("data: "))try{const O=JSON.parse(I.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){S+=O.content;const P=R[R.length-1];P&&P.type==="text"?P.text=S:R.push({type:"text",text:S}),console.log("[Parts after text]",R.length,"parts, text length:",S.length),s(M=>M.map(U=>U.id===_?{...U,parts:[...R]}:U))}else if(O.type==="tool-call")S&&(S=""),R.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",R.length,"parts, tool:",O.toolName),s(P=>P.map(M=>M.id===_?{...M,parts:[...R]}:M));else if(O.type==="tool-result"){const P=R.find(M=>M.type==="tool-invocation"&&M.toolInvocation?.toolName===O.toolName&&!M.toolInvocation?.result);P&&P.toolInvocation?(P.toolInvocation.result=O.result,P.toolInvocation.state="result",console.log("[Parts after tool-result]",R.length,"parts, updated:",O.toolName),s(M=>M.map(U=>U.id===_?{...U,parts:[...R]}:U))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",R.length),s(P=>P.map(M=>M.id===_?{...M,parts:[...R],content:""}:M));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,I)}}}catch(v){const b={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v instanceof Error?v.message:"Unknown error occurred"}`,timestamp:Date.now()};s(_=>[..._,b])}finally{c(!1)}},[e,a,t,n,r]),f=y.useCallback(()=>{s([])},[]);return{messages:n,isLoading:l,sendMessage:d,clearMessages:f}}function The({mcpServerUrl:t,authConfig:e,mcpConfig:r,llmConfig:a,isConnected:n,readResource:s}){const[l,c]=y.useState([]),[d,f]=y.useState(!1),m=y.useRef(null),h=y.useRef(null),v=y.useRef(null),b=y.useRef(new Map);y.useEffect(()=>()=>{h.current&&h.current.closeAllSessions().catch(console.error)},[r,t,a?.provider,a?.model]);const _=y.useCallback(async R=>{if(!R.trim()||!a||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:R.trim(),timestamp:Date.now()};c(C=>[...C,x]),f(!0),v.current=new AbortController;const T=Date.now();let A=0;try{const{MCPAgent:C,MCPClient:k}=await ep(async()=>{const{MCPAgent:V,MCPClient:Y}=await import("./browser-DEOnoCHR.js").then(j=>j.d);return{MCPAgent:V,MCPClient:Y}},__vite__mapDeps([0,1,2])),N=async(V,Y)=>{if(Y?.type==="oauth")try{const j="mcp:auth",q=wA(V),H=`${j}_${q}_tokens`,Q=localStorage.getItem(H);if(Q){const ie=JSON.parse(Q);return{...Y,oauthTokens:ie}}}catch(j){console.warn("Failed to retrieve OAuth tokens:",j)}return Y},I=(V,Y)=>{if(!Y||Y.type==="none")return V;const j={...V.headers};if(Y.type==="basic"&&Y.username&&Y.password){const q=btoa(`${Y.username}:${Y.password}`);j.Authorization=`Basic ${q}`}else if(Y.type==="bearer"&&Y.token)j.Authorization=`Bearer ${Y.token}`;else if(Y.type==="oauth"&&Y.oauthTokens?.access_token){const q=Y.oauthTokens.token_type?Y.oauthTokens.token_type.charAt(0).toUpperCase()+Y.oauthTokens.token_type.slice(1):"Bearer";j.Authorization=`${q} ${Y.oauthTokens.access_token}`}return{...V,headers:j}};let O;if(r){const V={mcpServers:{}};for(const[Y,j]of Object.entries(r.mcpServers)){const q=j.url||j.ws_url||"",H=await N(q,e||void 0);V.mcpServers[Y]=I(j,H)}O=new k(V)}else if(t){O=new k;const V=await N(t,e||void 0),j=I({url:t},V),q=`inspector-${Date.now()}`;O.addServer(q,j)}else throw new Error("Either mcpConfig or mcpServerUrl must be provided");h.current=O;let P;if(a.provider==="openai"){const{ChatOpenAI:V}=await ep(async()=>{const{ChatOpenAI:Y}=await import("./index-BXWlfrzU.js");return{ChatOpenAI:Y}},__vite__mapDeps([3,4,1,5]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else if(a.provider==="anthropic"){const{ChatAnthropic:V}=await ep(async()=>{const{ChatAnthropic:Y}=await import("./index-BaFfLjLH.js");return{ChatAnthropic:Y}},__vite__mapDeps([6,4,1]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else if(a.provider==="google"){const{ChatGoogleGenerativeAI:V}=await ep(async()=>{const{ChatGoogleGenerativeAI:Y}=await import("./index-gr-gzBTP.js");return{ChatGoogleGenerativeAI:Y}},__vite__mapDeps([7,4,1,2,5]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else throw new Error(`Unsupported LLM provider: ${a.provider}`);const M=new C({llm:P,client:O,maxSteps:10,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."});m.current=M,await M.initialize();try{const V=O;if(V.sessions){const Y=Object.keys(V.sessions);if(Y.length>0){const j=V.sessions[Y[0]];if(j?.tools){const q=Object.values(j.tools);b.current=new Map(q.map(H=>[H.name,H._meta||H.metadata||{}])),console.log("[useChatMessagesClientSide] Stored metadata for tools:",Array.from(b.current.keys()),"sample:",q[0])}}}if(b.current.size===0&&M.client){const Y=M.client;if(Y.sessions){const j=Object.keys(Y.sessions);if(j.length>0){const q=Y.sessions[j[0]];if(q?.tools){const H=Object.values(q.tools);b.current=new Map(H.map(Q=>[Q.name,Q._meta||Q.metadata||{}])),console.log("[useChatMessagesClientSide] Stored metadata from agent for tools:",Array.from(b.current.keys()))}}}}}catch(V){console.warn("[useChatMessagesClientSide] Failed to load tools metadata:",V)}const U=`assistant-${Date.now()}`;let G="";const J=[];c(V=>[...V,{id:U,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);for await(const V of M.streamEvents(R)){if(v.current?.signal.aborted)break;if(V.event==="on_chat_model_stream"&&V.data?.chunk?.text){const Y=V.data.chunk.text;if(typeof Y=="string"&&Y.length>0){G+=Y;const j=J[J.length-1];j&&j.type==="text"?j.text=G:J.push({type:"text",text:G}),c(q=>q.map(H=>H.id===U?{...H,parts:[...J]}:H))}}else if(V.event==="on_tool_start"){G&&(G="");let Y={};V.data?.input?Y=V.data.input:V.data?.tool_input?Y=V.data.tool_input:V.data&&(Y=V.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:V.name,eventData:V.data,extractedArgs:Y}),A++,J.push({type:"tool-invocation",toolInvocation:{toolName:V.name||"unknown",args:Y,state:"pending"}}),c(j=>j.map(q=>q.id===U?{...q,parts:[...J]}:q))}else if(V.event==="on_tool_end"){const Y=J.find(j=>j.type==="tool-invocation"&&j.toolInvocation?.toolName===V.name&&!j.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:V.name,hasToolPart:!!Y,output:V.data?.output}),Y&&Y.toolInvocation){const j=V.data?.output;Y.toolInvocation.result=j,Y.toolInvocation.state="result";let q=j;if(typeof j=="string")try{q=JSON.parse(j)}catch(Q){console.warn("[useChatMessagesClientSide] Failed to parse result:",Q)}const H=q?._meta?.["openai/outputTemplate"];console.log("[useChatMessagesClientSide] Apps SDK check:",{toolName:V.name,hasParsedResult:!!q,hasMeta:!!q?._meta,appsSdkUri:H}),H&&typeof H=="string"&&s&&(console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",H),(async()=>{try{const Q=await s(H);console.log("[useChatMessagesClientSide] Resource fetched:",Q);let ie=null;if(q?.structuredContent)ie=q.structuredContent;else if(Array.isArray(q)&&q[0]){const $=q[0];$.output?.value?.structuredContent?ie=$.output.value.structuredContent:$.structuredContent?ie=$.structuredContent:$.output?.value&&(ie=$.output.value)}if(ie||(ie=q),Q?.contents&&Array.isArray(Q.contents)){const $=Q.contents.map(W=>({type:"resource",resource:W}));if(console.log("[useChatMessagesClientSide] Created MCP resources:",$),Y.toolInvocation){const W={...q,content:[...q.content||[],...$],structuredContent:ie};console.log("[useChatMessagesClientSide] Updated result:",W),Y.toolInvocation.result=JSON.stringify(W),c(F=>F.map(K=>K.id===U?{...K,parts:[...J]}:K)),console.log("[useChatMessagesClientSide] Messages state updated with resource")}}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",Q)}catch(Q){console.error("Failed to fetch Apps SDK resource:",Q)}})()),c(Q=>Q.map(ie=>ie.id===U?{...ie,parts:[...J]}:ie))}}}c(V=>V.map(Y=>Y.id===U?{...Y,parts:[...J],content:""}:Y)),a&&Mr.getInstance().capture(new yO({serverId:t,provider:a.provider,model:a.model,messageCount:l.length+1,toolCallsCount:A,success:!0,executionMode:"client-side",duration:Date.now()-T})).catch(()=>{}),await O.closeAllSessions()}catch(C){console.error("Client-side agent error:",C),a&&Mr.getInstance().capture(new yO({serverId:t,provider:a.provider,model:a.model,messageCount:l.length+1,toolCallsCount:A,success:!1,executionMode:"client-side",duration:Date.now()-T,error:C instanceof Error?C.message:"Unknown error occurred"})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${C instanceof Error?C.message:"Unknown error occurred"}`,timestamp:Date.now()};if(c(N=>[...N,k]),h.current)try{await h.current.closeAllSessions()}catch(N){console.error("Error closing sessions:",N)}}finally{f(!1),m.current=null,h.current=null,v.current=null}},[a,n,r,t,e,s]),S=y.useCallback(()=>{c([])},[]);return{messages:l,isLoading:d,sendMessage:_,clearMessages:S}}const mz={openai:"gpt-4o",anthropic:"claude-3-5-sonnet-20241022",google:"gemini-2.0-flash-exp"};function Rhe({mcpServerUrl:t}){const[e,r]=y.useState(null),[a,n]=y.useState(null),[s,l]=y.useState(!1),[c,d]=y.useState("openai"),[f,m]=y.useState(""),[h,v]=y.useState(mz.openai),[b,_]=y.useState("none"),[S,R]=y.useState(""),[x,T]=y.useState(""),[A,C]=y.useState("");y.useEffect(()=>{const I=localStorage.getItem("mcp-inspector-llm-config");if(I)try{const O=JSON.parse(I);r(O),d(O.provider),m(O.apiKey),v(O.model)}catch(O){console.error("Failed to load LLM config:",O)}},[]),y.useEffect(()=>{const I=localStorage.getItem("mcp-inspector-auth-config");if(I)try{const O=JSON.parse(I);n(O),_(O.type),O.username&&R(O.username),O.password&&T(O.password),O.token&&C(O.token)}catch(O){console.error("Failed to load auth config:",O)}else try{const O="mcp:auth",P=wA(t),M=`${O}_${P}_tokens`;localStorage.getItem(M)&&(n({type:"oauth"}),_("oauth"))}catch(O){console.error("Failed to check for OAuth tokens:",O)}},[t]),y.useEffect(()=>{v(mz[c])},[c]);const k=y.useCallback(()=>{if(!f.trim())return;const I={provider:c,apiKey:f,model:h},O={type:b,...b==="basic"&&{username:S.trim(),password:x.trim()},...b==="bearer"&&{token:A.trim()}};r(I),n(O),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(I)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(O)),l(!1)},[c,f,h,b,S,x,A]),N=y.useCallback(()=>{r(null),n(null),m(""),R(""),T(""),C(""),_("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[]);return{llmConfig:e,authConfig:a,configDialogOpen:s,setConfigDialogOpen:l,tempProvider:c,setTempProvider:d,tempApiKey:f,setTempApiKey:m,tempModel:h,setTempModel:v,tempAuthType:b,saveLLMConfig:k,clearConfig:N}}function Ahe({mcpServerUrl:t,mcpConfig:e,isConnected:r,oauthState:a,oauthError:n,useClientSide:s=!0,readResource:l}){const[c,d]=y.useState(""),f=y.useRef(null),m=t||(e?Object.values(e.mcpServers)[0]?.url:void 0),{llmConfig:h,authConfig:v,configDialogOpen:b,setConfigDialogOpen:_,tempProvider:S,setTempProvider:R,tempApiKey:x,setTempApiKey:T,tempModel:A,setTempModel:C,saveLLMConfig:k,clearConfig:N}=Rhe({mcpServerUrl:m||""}),I={mcpServerUrl:t,mcpConfig:e,llmConfig:h,authConfig:v,isConnected:r,readResource:l},O=whe({mcpServerUrl:t||m||"",llmConfig:h,authConfig:v,isConnected:r}),P=The(I),{messages:M,isLoading:U,sendMessage:G,clearMessages:J}=s?P:O;G2({onNewChat:J}),y.useEffect(()=>{h&&M.length===0&&f.current&&f.current.focus()},[h,M.length]),y.useEffect(()=>{!U&&M.length>0&&f.current&&f.current.focus()},[U,M.length]);const V=y.useCallback(()=>{c.trim()&&(G(c),d(""))},[c,G]),Y=y.useCallback(q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),V())},[V]),j=y.useCallback(()=>{N(),J()},[N,J]);return h&&M.length===0?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"absolute top-4 right-4 z-10",children:g.jsx(M3,{open:b,onOpenChange:_,tempProvider:S,tempModel:A,tempApiKey:x,onProviderChange:R,onModelChange:C,onApiKeyChange:T,onSave:k,onClear:j,showClearButton:!0,buttonLabel:"Change API Key"})}),g.jsx(wie,{mcpServerUrl:m||"",inputValue:c,isConnected:r,isLoading:U,textareaRef:f,llmConfig:h,onInputChange:d,onKeyDown:Y,onSubmit:q=>{q.preventDefault(),V()},onConfigDialogOpenChange:_})]}):g.jsxs("div",{className:"flex flex-col h-full relative",children:[g.jsx(Sie,{llmConfig:h,hasMessages:M.length>0,configDialogOpen:b,onConfigDialogOpenChange:_,onClearChat:J,tempProvider:S,tempModel:A,tempApiKey:x,onProviderChange:R,onModelChange:C,onApiKeyChange:T,onSaveConfig:k,onClearConfig:j}),g.jsx("div",{className:"flex-1 overflow-y-auto p-4 pt-[100px]",children:h?g.jsx(_he,{messages:M,isLoading:U,serverId:m,readResource:l}):g.jsx(Tie,{onConfigureClick:()=>_(!0)})}),h&&g.jsx(xie,{inputValue:c,isConnected:r,isLoading:U,textareaRef:f,onInputChange:d,onKeyDown:Y,onSendMessage:V})]})}const Jm=y.createContext(null);Jm.displayName="PanelGroupContext";const pr={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},TA=10,fs=y.useLayoutEffect,hz=UT.useId,Che=typeof hz=="function"?hz:()=>null;let Nhe=0;function RA(t=null){const e=Che(),r=y.useRef(t||e||null);return r.current===null&&(r.current=""+Nhe++),t??r.current}function Aq({children:t,className:e="",collapsedSize:r,collapsible:a,defaultSize:n,forwardedRef:s,id:l,maxSize:c,minSize:d,onCollapse:f,onExpand:m,onResize:h,order:v,style:b,tagName:_="div",...S}){const R=y.useContext(Jm);if(R===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:T,getPanelSize:A,getPanelStyle:C,groupId:k,isPanelCollapsed:N,reevaluatePanelConstraints:I,registerPanel:O,resizePanel:P,unregisterPanel:M}=R,U=RA(l),G=y.useRef({callbacks:{onCollapse:f,onExpand:m,onResize:h},constraints:{collapsedSize:r,collapsible:a,defaultSize:n,maxSize:c,minSize:d},id:U,idIsFromProps:l!==void 0,order:v});y.useRef({didLogMissingDefaultSizeWarning:!1}),fs(()=>{const{callbacks:V,constraints:Y}=G.current,j={...Y};G.current.id=U,G.current.idIsFromProps=l!==void 0,G.current.order=v,V.onCollapse=f,V.onExpand=m,V.onResize=h,Y.collapsedSize=r,Y.collapsible=a,Y.defaultSize=n,Y.maxSize=c,Y.minSize=d,(j.collapsedSize!==Y.collapsedSize||j.collapsible!==Y.collapsible||j.maxSize!==Y.maxSize||j.minSize!==Y.minSize)&&I(G.current,j)}),fs(()=>{const V=G.current;return O(V),()=>{M(V)}},[v,U,O,M]),y.useImperativeHandle(s,()=>({collapse:()=>{x(G.current)},expand:V=>{T(G.current,V)},getId(){return U},getSize(){return A(G.current)},isCollapsed(){return N(G.current)},isExpanded(){return!N(G.current)},resize:V=>{P(G.current,V)}}),[x,T,A,N,U,P]);const J=C(G.current,n);return y.createElement(_,{...S,children:t,className:e,id:U,style:{...J,...b},[pr.groupId]:k,[pr.panel]:"",[pr.panelCollapsible]:a||void 0,[pr.panelId]:U,[pr.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const Cq=y.forwardRef((t,e)=>y.createElement(Aq,{...t,forwardedRef:e}));Aq.displayName="Panel";Cq.displayName="forwardRef(Panel)";let gT=null,Ip=-1,ho=null;function khe(t,e,r){const a=(e&Dq)!==0,n=(e&Lq)!==0,s=(e&Mq)!==0,l=(e&Pq)!==0;if(e){if(a)return s?"se-resize":l?"ne-resize":"e-resize";if(n)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Ihe(){ho!==null&&(document.head.removeChild(ho),gT=null,ho=null,Ip=-1)}function F_(t,e,r){var a,n;const s=khe(t,e);if(gT!==s){if(gT=s,ho===null&&(ho=document.createElement("style"),document.head.appendChild(ho)),Ip>=0){var l;(l=ho.sheet)===null||l===void 0||l.removeRule(Ip)}Ip=(a=(n=ho.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${s} !important;}`))!==null&&a!==void 0?a:-1}}function Nq(t){return t.type==="keydown"}function kq(t){return t.type.startsWith("pointer")}function Iq(t){return t.type.startsWith("mouse")}function eh(t){if(kq(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Iq(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Ohe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Dhe(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Lhe(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:bz(t),b:bz(e)};let a;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),a=t;ht(a,"Stacking order can only be calculated for elements with a common ancestor");const n={a:vz(gz(r.a)),b:vz(gz(r.b))};if(n.a===n.b){const s=a.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===l.a)return 1;if(d===l.b)return-1}}return Math.sign(n.a-n.b)}const Mhe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Phe(t){var e;const r=getComputedStyle((e=Oq(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Uhe(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Phe(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Mhe.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function gz(t){let e=t.length;for(;e--;){const r=t[e];if(ht(r,"Missing node"),Uhe(r))return r}return null}function vz(t){return t&&Number(getComputedStyle(t).zIndex)||0}function bz(t){const e=[];for(;t;)e.push(t),t=Oq(t);return e}function Oq(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const Dq=1,Lq=2,Mq=4,Pq=8,jhe=Ohe()==="coarse";let ba=[],Pl=!1,go=new Map,th=new Map;const Yu=new Set;function Fhe(t,e,r,a,n){var s;const{ownerDocument:l}=e,c={direction:r,element:e,hitAreaMargins:a,setResizeHandlerState:n},d=(s=go.get(l))!==null&&s!==void 0?s:0;return go.set(l,d+1),Yu.add(c),lm(),function(){var m;th.delete(t),Yu.delete(c);const h=(m=go.get(l))!==null&&m!==void 0?m:1;if(go.set(l,h-1),lm(),h===1&&go.delete(l),ba.includes(c)){const v=ba.indexOf(c);v>=0&&ba.splice(v,1),rh(),n("up",!0,null)}}}function zhe(t){const{target:e}=t,{x:r,y:a}=eh(t);Pl=!0,AA({target:e,x:r,y:a}),lm(),ba.length>0&&(cm("down",t),rh(),t.preventDefault(),Uq(e)||t.stopImmediatePropagation())}function z_(t){const{x:e,y:r}=eh(t);if(Pl&&t.type!=="pointerleave"&&t.buttons===0&&(Pl=!1,cm("up",t)),!Pl){const{target:a}=t;AA({target:a,x:e,y:r})}cm("move",t),rh(),ba.length>0&&t.preventDefault()}function $_(t){const{target:e}=t,{x:r,y:a}=eh(t);th.clear(),Pl=!1,ba.length>0&&(t.preventDefault(),Uq(e)||t.stopImmediatePropagation()),cm("up",t),AA({target:e,x:r,y:a}),rh(),lm()}function Uq(t){let e=t;for(;e;){if(e.hasAttribute(pr.resizeHandle))return!0;e=e.parentElement}return!1}function AA({target:t,x:e,y:r}){ba.splice(0);let a=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(a=t),Yu.forEach(n=>{const{element:s,hitAreaMargins:l}=n,c=s.getBoundingClientRect(),{bottom:d,left:f,right:m,top:h}=c,v=jhe?l.coarse:l.fine;if(e>=f-v&&e<=m+v&&r>=h-v&&r<=d+v){if(a!==null&&document.contains(a)&&s!==a&&!s.contains(a)&&!a.contains(s)&&Lhe(a,s)>0){let _=a,S=!1;for(;_&&!_.contains(s);){if(Dhe(_.getBoundingClientRect(),c)){S=!0;break}_=_.parentElement}if(S)return}ba.push(n)}})}function B_(t,e){th.set(t,e)}function rh(){let t=!1,e=!1;ba.forEach(a=>{const{direction:n}=a;n==="horizontal"?t=!0:e=!0});let r=0;th.forEach(a=>{r|=a}),t&&e?F_("intersection",r):t?F_("horizontal",r):e?F_("vertical",r):Ihe()}let q_;function lm(){var t;(t=q_)===null||t===void 0||t.abort(),q_=new AbortController;const e={capture:!0,signal:q_.signal};Yu.size&&(Pl?(ba.length>0&&go.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("contextmenu",$_,e),n.addEventListener("pointerleave",z_,e),n.addEventListener("pointermove",z_,e))}),go.forEach((r,a)=>{const{body:n}=a;n.addEventListener("pointerup",$_,e),n.addEventListener("pointercancel",$_,e)})):go.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("pointerdown",zhe,e),n.addEventListener("pointermove",z_,e))}))}function cm(t,e){Yu.forEach(r=>{const{setResizeHandlerState:a}=r,n=ba.includes(r);a(t,n,e)})}function $he(){const[t,e]=y.useState(0);return y.useCallback(()=>e(r=>r+1),[])}function ht(t,e){if(!t)throw console.error(e),Error(e)}function xs(t,e,r=TA){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function Ei(t,e,r=TA){return xs(t,e,r)===0}function Dn(t,e,r){return xs(t,e,r)===0}function Bhe(t,e,r){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++){const n=t[a],s=e[a];if(!Dn(n,s,r))return!1}return!0}function kl({panelConstraints:t,panelIndex:e,size:r}){const a=t[e];ht(a!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:n=0,collapsible:s,maxSize:l=100,minSize:c=0}=a;if(xs(r,c)<0)if(s){const d=(n+c)/2;xs(r,d)<0?r=n:r=c}else r=c;return r=Math.min(l,r),r=parseFloat(r.toFixed(TA)),r}function mu({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:a,prevLayout:n,trigger:s}){if(Dn(t,0))return e;const l=[...e],[c,d]=a;ht(c!=null,"Invalid first pivot index"),ht(d!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const h=t<0?d:c,v=r[h];ht(v,`Panel constraints not found for index ${h}`);const{collapsedSize:b=0,collapsible:_,minSize:S=0}=v;if(_){const R=e[h];if(ht(R!=null,`Previous layout not found for panel index ${h}`),Dn(R,b)){const x=S-R;xs(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}{const h=t<0?c:d,v=r[h];ht(v,`No panel constraints found for index ${h}`);const{collapsedSize:b=0,collapsible:_,minSize:S=0}=v;if(_){const R=e[h];if(ht(R!=null,`Previous layout not found for panel index ${h}`),Dn(R,S)){const x=R-b;xs(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}}{const h=t<0?1:-1;let v=t<0?d:c,b=0;for(;;){const S=e[v];ht(S!=null,`Previous layout not found for panel index ${v}`);const x=kl({panelConstraints:r,panelIndex:v,size:100})-S;if(b+=x,v+=h,v<0||v>=r.length)break}const _=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-_:_}{let v=t<0?c:d;for(;v>=0&&v<r.length;){const b=Math.abs(t)-Math.abs(f),_=e[v];ht(_!=null,`Previous layout not found for panel index ${v}`);const S=_-b,R=kl({panelConstraints:r,panelIndex:v,size:S});if(!Dn(_,R)&&(f+=_-R,l[v]=R,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?v--:v++}}if(Bhe(n,l))return n;{const h=t<0?d:c,v=e[h];ht(v!=null,`Previous layout not found for panel index ${h}`);const b=v+f,_=kl({panelConstraints:r,panelIndex:h,size:b});if(l[h]=_,!Dn(_,b)){let S=b-_,x=t<0?d:c;for(;x>=0&&x<r.length;){const T=l[x];ht(T!=null,`Previous layout not found for panel index ${x}`);const A=T+S,C=kl({panelConstraints:r,panelIndex:x,size:A});if(Dn(T,C)||(S-=C-T,l[x]=C),Dn(S,0))break;t>0?x--:x++}}}const m=l.reduce((h,v)=>v+h,0);return Dn(m,100)?l:n}function qhe({layout:t,panelsArray:e,pivotIndices:r}){let a=0,n=100,s=0,l=0;const c=r[0];ht(c!=null,"No pivot index found"),e.forEach((h,v)=>{const{constraints:b}=h,{maxSize:_=100,minSize:S=0}=b;v===c?(a=S,n=_):(s+=S,l+=_)});const d=Math.min(n,100-s),f=Math.max(a,100-l),m=t[c];return{valueMax:d,valueMin:f,valueNow:m}}function Ku(t,e=document){return Array.from(e.querySelectorAll(`[${pr.resizeHandleId}][data-panel-group-id="${t}"]`))}function jq(t,e,r=document){const n=Ku(t,r).findIndex(s=>s.getAttribute(pr.resizeHandleId)===e);return n??null}function Fq(t,e,r){const a=jq(t,e,r);return a!=null?[a,a+1]:[-1,-1]}function Hhe(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function zq(t,e=document){if(Hhe(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function nh(t,e=document){const r=e.querySelector(`[${pr.resizeHandleId}="${t}"]`);return r||null}function Ghe(t,e,r,a=document){var n,s,l,c;const d=nh(e,a),f=Ku(t,a),m=d?f.indexOf(d):-1,h=(n=(s=r[m])===null||s===void 0?void 0:s.id)!==null&&n!==void 0?n:null,v=(l=(c=r[m+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[h,v]}function Vhe({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:a,panelDataArray:n,panelGroupElement:s,setLayout:l}){y.useRef({didWarnAboutMissingResizeHandle:!1}),fs(()=>{if(!s)return;const c=Ku(r,s);for(let d=0;d<n.length-1;d++){const{valueMax:f,valueMin:m,valueNow:h}=qhe({layout:a,panelsArray:n,pivotIndices:[d,d+1]}),v=c[d];if(v!=null){const b=n[d];ht(b,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",b.id),v.setAttribute("aria-valuemax",""+Math.round(f)),v.setAttribute("aria-valuemin",""+Math.round(m)),v.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((d,f)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,a,n,s]),y.useEffect(()=>{if(!s)return;const c=e.current;ht(c,"Eager values not found");const{panelDataArray:d}=c,f=zq(r,s);ht(f!=null,`No group found for id "${r}"`);const m=Ku(r,s);ht(m,`No resize handles found for group id "${r}"`);const h=m.map(v=>{const b=v.getAttribute(pr.resizeHandleId);ht(b,"Resize handle element has no handle id attribute");const[_,S]=Ghe(r,b,d,s);if(_==null||S==null)return()=>{};const R=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const T=d.findIndex(A=>A.id===_);if(T>=0){const A=d[T];ht(A,`No panel data found for index ${T}`);const C=a[T],{collapsedSize:k=0,collapsible:N,minSize:I=0}=A.constraints;if(C!=null&&N){const O=mu({delta:Dn(C,k)?I-k:k-C,initialLayout:a,panelConstraints:d.map(P=>P.constraints),pivotIndices:Fq(r,b,s),prevLayout:a,trigger:"keyboard"});a!==O&&l(O)}}break}}};return v.addEventListener("keydown",R),()=>{v.removeEventListener("keydown",R)}});return()=>{h.forEach(v=>v())}},[s,t,e,r,a,n,l])}function yz(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function $q(t,e){const r=t==="horizontal",{x:a,y:n}=eh(e);return r?a:n}function Whe(t,e,r,a,n){const s=r==="horizontal",l=nh(e,n);ht(l,`No resize handle element found for id "${e}"`);const c=l.getAttribute(pr.groupId);ht(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=a;const f=$q(r,t),m=zq(c,n);ht(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),v=s?h.width:h.height;return(f-d)/v*100}function Yhe(t,e,r,a,n,s){if(Nq(t)){const l=r==="horizontal";let c=0;t.shiftKey?c=100:n!=null?c=n:c=10;let d=0;switch(t.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return a==null?0:Whe(t,e,r,a,s)}function Khe({panelDataArray:t}){const e=Array(t.length),r=t.map(s=>s.constraints);let a=0,n=100;for(let s=0;s<t.length;s++){const l=r[s];ht(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;c!=null&&(a++,e[s]=c,n-=c)}for(let s=0;s<t.length;s++){const l=r[s];ht(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;if(c!=null)continue;const d=t.length-a,f=n/d;a++,e[s]=f,n-=f}return e}function ul(t,e,r){e.forEach((a,n)=>{const s=t[n];ht(s,`Panel data not found for index ${n}`);const{callbacks:l,constraints:c,id:d}=s,{collapsedSize:f=0,collapsible:m}=c,h=r[d];if(h==null||a!==h){r[d]=a;const{onCollapse:v,onExpand:b,onResize:_}=l;_&&_(a,h),m&&(v||b)&&(b&&(h==null||Ei(h,f))&&!Ei(a,f)&&b(),v&&(h==null||!Ei(h,f))&&Ei(a,f)&&v())}})}function ip(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function Zhe({defaultSize:t,dragState:e,layout:r,panelData:a,panelIndex:n,precision:s=3}){const l=r[n];let c;return l==null?c=t!=null?t.toFixed(s):"1":a.length===1?c="1":c=l.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Xhe(t,e=10){let r=null;return(...n)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...n)},e)}}function Ez(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function Bq(t){return`react-resizable-panels:${t}`}function qq(t){return t.map(e=>{const{constraints:r,id:a,idIsFromProps:n,order:s}=e;return n?a:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function Hq(t,e){try{const r=Bq(t),a=e.getItem(r);if(a){const n=JSON.parse(a);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function Qhe(t,e,r){var a,n;const s=(a=Hq(t,r))!==null&&a!==void 0?a:{},l=qq(e);return(n=s[l])!==null&&n!==void 0?n:null}function Jhe(t,e,r,a,n){var s;const l=Bq(t),c=qq(e),d=(s=Hq(t,n))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:a};try{n.setItem(l,JSON.stringify(d))}catch(f){console.error(f)}}function Sz({layout:t,panelConstraints:e}){const r=[...t],a=r.reduce((s,l)=>s+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!Dn(a,100)&&r.length>0)for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=100/a*l;r[s]=c}let n=0;for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=kl({panelConstraints:e,panelIndex:s,size:l});l!=c&&(n+=l-c,r[s]=c)}if(!Dn(n,0))for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=l+n,d=kl({panelConstraints:e,panelIndex:s,size:c});if(l!==d&&(n-=d-l,r[s]=d,Dn(n,0)))break}return r}const ege=100,hu={getItem:t=>(Ez(hu),hu.getItem(t)),setItem:(t,e)=>{Ez(hu),hu.setItem(t,e)}},xz={};function Gq({autoSaveId:t=null,children:e,className:r="",direction:a,forwardedRef:n,id:s=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=hu,style:f,tagName:m="div",...h}){const v=RA(s),b=y.useRef(null),[_,S]=y.useState(null),[R,x]=y.useState([]),T=$he(),A=y.useRef({}),C=y.useRef(new Map),k=y.useRef(0),N=y.useRef({autoSaveId:t,direction:a,dragState:_,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),I=y.useRef({layout:R,panelDataArray:[],panelDataArrayChanged:!1});y.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),y.useImperativeHandle(n,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:F}=I.current;return F},setLayout:F=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:B}=I.current,L=Sz({layout:F,panelConstraints:B.map(X=>X.constraints)});yz(re,L)||(x(L),I.current.layout=L,K&&K(L),ul(B,L,A.current))}}),[]),fs(()=>{N.current.autoSaveId=t,N.current.direction=a,N.current.dragState=_,N.current.id=v,N.current.onLayout=l,N.current.storage=d}),Vhe({committedValuesRef:N,eagerValuesRef:I,groupId:v,layout:R,panelDataArray:I.current.panelDataArray,setLayout:x,panelGroupElement:b.current}),y.useEffect(()=>{const{panelDataArray:F}=I.current;if(t){if(R.length===0||R.length!==F.length)return;let K=xz[t];K==null&&(K=Xhe(Jhe,ege),xz[t]=K);const re=[...F],B=new Map(C.current);K(t,re,B,R,d)}},[t,R,d]),y.useEffect(()=>{});const O=y.useCallback(F=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:B}=I.current;if(F.constraints.collapsible){const L=B.map(ce=>ce.constraints),{collapsedSize:X=0,panelSize:ne,pivotIndices:ee}=ns(B,F,re);if(ht(ne!=null,`Panel size not found for panel "${F.id}"`),!Ei(ne,X)){C.current.set(F.id,ne);const ge=El(B,F)===B.length-1?ne-X:X-ne,Ae=mu({delta:ge,initialLayout:re,panelConstraints:L,pivotIndices:ee,prevLayout:re,trigger:"imperative-api"});ip(re,Ae)||(x(Ae),I.current.layout=Ae,K&&K(Ae),ul(B,Ae,A.current))}}},[]),P=y.useCallback((F,K)=>{const{onLayout:re}=N.current,{layout:B,panelDataArray:L}=I.current;if(F.constraints.collapsible){const X=L.map(ye=>ye.constraints),{collapsedSize:ne=0,panelSize:ee=0,minSize:ce=0,pivotIndices:ge}=ns(L,F,B),Ae=K??ce;if(Ei(ee,ne)){const ye=C.current.get(F.id),Se=ye!=null&&ye>=Ae?ye:Ae,he=El(L,F)===L.length-1?ee-Se:Se-ee,Oe=mu({delta:he,initialLayout:B,panelConstraints:X,pivotIndices:ge,prevLayout:B,trigger:"imperative-api"});ip(B,Oe)||(x(Oe),I.current.layout=Oe,re&&re(Oe),ul(L,Oe,A.current))}}},[]),M=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{panelSize:B}=ns(re,F,K);return ht(B!=null,`Panel size not found for panel "${F.id}"`),B},[]),U=y.useCallback((F,K)=>{const{panelDataArray:re}=I.current,B=El(re,F);return Zhe({defaultSize:K,dragState:_,layout:R,panelData:re,panelIndex:B})},[_,R]),G=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{collapsedSize:B=0,collapsible:L,panelSize:X}=ns(re,F,K);return ht(X!=null,`Panel size not found for panel "${F.id}"`),L===!0&&Ei(X,B)},[]),J=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{collapsedSize:B=0,collapsible:L,panelSize:X}=ns(re,F,K);return ht(X!=null,`Panel size not found for panel "${F.id}"`),!L||xs(X,B)>0},[]),V=y.useCallback(F=>{const{panelDataArray:K}=I.current;K.push(F),K.sort((re,B)=>{const L=re.order,X=B.order;return L==null&&X==null?0:L==null?-1:X==null?1:L-X}),I.current.panelDataArrayChanged=!0,T()},[T]);fs(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:F,onLayout:K,storage:re}=N.current,{layout:B,panelDataArray:L}=I.current;let X=null;if(F){const ee=Qhe(F,L,re);ee&&(C.current=new Map(Object.entries(ee.expandToSizes)),X=ee.layout)}X==null&&(X=Khe({panelDataArray:L}));const ne=Sz({layout:X,panelConstraints:L.map(ee=>ee.constraints)});yz(B,ne)||(x(ne),I.current.layout=ne,K&&K(ne),ul(L,ne,A.current))}}),fs(()=>{const F=I.current;return()=>{F.layout=[]}},[]);const Y=y.useCallback(F=>{let K=!1;const re=b.current;return re&&window.getComputedStyle(re,null).getPropertyValue("direction")==="rtl"&&(K=!0),function(L){L.preventDefault();const X=b.current;if(!X)return()=>null;const{direction:ne,dragState:ee,id:ce,keyboardResizeBy:ge,onLayout:Ae}=N.current,{layout:ye,panelDataArray:Se}=I.current,{initialLayout:Ie}=ee??{},he=Fq(ce,F,X);let Oe=Yhe(L,F,ne,ee,ge,X);const De=ne==="horizontal";De&&K&&(Oe=-Oe);const Qe=Se.map(Re=>Re.constraints),Te=mu({delta:Oe,initialLayout:Ie??ye,panelConstraints:Qe,pivotIndices:he,prevLayout:ye,trigger:Nq(L)?"keyboard":"mouse-or-touch"}),_e=!ip(ye,Te);(kq(L)||Iq(L))&&k.current!=Oe&&(k.current=Oe,!_e&&Oe!==0?De?B_(F,Oe<0?Dq:Lq):B_(F,Oe<0?Mq:Pq):B_(F,0)),_e&&(x(Te),I.current.layout=Te,Ae&&Ae(Te),ul(Se,Te,A.current))}},[]),j=y.useCallback((F,K)=>{const{onLayout:re}=N.current,{layout:B,panelDataArray:L}=I.current,X=L.map(ye=>ye.constraints),{panelSize:ne,pivotIndices:ee}=ns(L,F,B);ht(ne!=null,`Panel size not found for panel "${F.id}"`);const ge=El(L,F)===L.length-1?ne-K:K-ne,Ae=mu({delta:ge,initialLayout:B,panelConstraints:X,pivotIndices:ee,prevLayout:B,trigger:"imperative-api"});ip(B,Ae)||(x(Ae),I.current.layout=Ae,re&&re(Ae),ul(L,Ae,A.current))},[]),q=y.useCallback((F,K)=>{const{layout:re,panelDataArray:B}=I.current,{collapsedSize:L=0,collapsible:X}=K,{collapsedSize:ne=0,collapsible:ee,maxSize:ce=100,minSize:ge=0}=F.constraints,{panelSize:Ae}=ns(B,F,re);Ae!=null&&(X&&ee&&Ei(Ae,L)?Ei(L,ne)||j(F,ne):Ae<ge?j(F,ge):Ae>ce&&j(F,ce))},[j]),H=y.useCallback((F,K)=>{const{direction:re}=N.current,{layout:B}=I.current;if(!b.current)return;const L=nh(F,b.current);ht(L,`Drag handle element not found for id "${F}"`);const X=$q(re,K);S({dragHandleId:F,dragHandleRect:L.getBoundingClientRect(),initialCursorPosition:X,initialLayout:B})},[]),Q=y.useCallback(()=>{S(null)},[]),ie=y.useCallback(F=>{const{panelDataArray:K}=I.current,re=El(K,F);re>=0&&(K.splice(re,1),delete A.current[F.id],I.current.panelDataArrayChanged=!0,T())},[T]),$=y.useMemo(()=>({collapsePanel:O,direction:a,dragState:_,expandPanel:P,getPanelSize:M,getPanelStyle:U,groupId:v,isPanelCollapsed:G,isPanelExpanded:J,reevaluatePanelConstraints:q,registerPanel:V,registerResizeHandle:Y,resizePanel:j,startDragging:H,stopDragging:Q,unregisterPanel:ie,panelGroupElement:b.current}),[O,_,a,P,M,U,v,G,J,q,V,Y,j,H,Q,ie]),W={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return y.createElement(Jm.Provider,{value:$},y.createElement(m,{...h,children:e,className:r,id:s,ref:b,style:{...W,...f},[pr.group]:"",[pr.groupDirection]:a,[pr.groupId]:v}))}const Vq=y.forwardRef((t,e)=>y.createElement(Gq,{...t,forwardedRef:e}));Gq.displayName="PanelGroup";Vq.displayName="forwardRef(PanelGroup)";function El(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function ns(t,e,r){const a=El(t,e),s=a===t.length-1?[a-1,a]:[a,a+1],l=r[a];return{...e.constraints,panelSize:l,pivotIndices:s}}function tge({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:a}){y.useEffect(()=>{if(t||r==null||a==null)return;const n=nh(e,a);if(n==null)return;const s=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const c=n.getAttribute(pr.groupId);ht(c,`No group element found for id "${c}"`);const d=Ku(c,a),f=jq(c,e,a);ht(f!==null,`No resize element found for id "${e}"`);const m=l.shiftKey?f>0?f-1:d.length-1:f+1<d.length?f+1:0;d[m].focus();break}}};return n.addEventListener("keydown",s),()=>{n.removeEventListener("keydown",s)}},[a,t,e,r])}function Wq({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:a,id:n,onBlur:s,onClick:l,onDragging:c,onFocus:d,onPointerDown:f,onPointerUp:m,style:h={},tabIndex:v=0,tagName:b="div",..._}){var S,R;const x=y.useRef(null),T=y.useRef({onClick:l,onDragging:c,onPointerDown:f,onPointerUp:m});y.useEffect(()=>{T.current.onClick=l,T.current.onDragging=c,T.current.onPointerDown=f,T.current.onPointerUp=m});const A=y.useContext(Jm);if(A===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:k,registerResizeHandle:N,startDragging:I,stopDragging:O,panelGroupElement:P}=A,M=RA(n),[U,G]=y.useState("inactive"),[J,V]=y.useState(!1),[Y,j]=y.useState(null),q=y.useRef({state:U});fs(()=>{q.current.state=U}),y.useEffect(()=>{if(r)j(null);else{const $=N(M);j(()=>$)}},[r,M,N]);const H=(S=a?.coarse)!==null&&S!==void 0?S:15,Q=(R=a?.fine)!==null&&R!==void 0?R:5;y.useEffect(()=>{if(r||Y==null)return;const $=x.current;ht($,"Element ref not attached");let W=!1;return Fhe(M,$,C,{coarse:H,fine:Q},(K,re,B)=>{if(!re){G("inactive");return}switch(K){case"down":{G("drag"),W=!1,ht(B,'Expected event to be defined for "down" action'),I(M,B);const{onDragging:L,onPointerDown:X}=T.current;L?.(!0),X?.();break}case"move":{const{state:L}=q.current;W=!0,L!=="drag"&&G("hover"),ht(B,'Expected event to be defined for "move" action'),Y(B);break}case"up":{G("hover"),O();const{onClick:L,onDragging:X,onPointerUp:ne}=T.current;X?.(!1),ne?.(),W||L?.();break}}})},[H,C,r,Q,N,M,Y,I,O]),tge({disabled:r,handleId:M,resizeHandler:Y,panelGroupElement:P});const ie={touchAction:"none",userSelect:"none"};return y.createElement(b,{..._,children:t,className:e,id:n,onBlur:()=>{V(!1),s?.()},onFocus:()=>{V(!0),d?.()},ref:x,role:"separator",style:{...ie,...h},tabIndex:v,[pr.groupDirection]:C,[pr.groupId]:k,[pr.resizeHandle]:"",[pr.resizeHandleActive]:U==="drag"?"pointer":J?"keyboard":void 0,[pr.resizeHandleEnabled]:!r,[pr.resizeHandleId]:M,[pr.resizeHandleState]:U})}Wq.displayName="PanelResizeHandle";function Zu({className:t,...e}){return g.jsx(Vq,{"data-slot":"resizable-panel-group",className:Ue("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function La({...t}){return g.jsx(Cq,{"data-slot":"resizable-panel",...t})}function Xu({withHandle:t,className:e,...r}){return g.jsx(Wq,{"data-slot":"resizable-handle",className:Ue("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...r,children:t&&g.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:g.jsx(tY,{className:"size-2.5"})})})}function Sd({id:t,isSelected:e,isFocused:r,icon:a,title:n,description:s,metadata:l,onClick:c,className:d}){return g.jsx("button",{id:t,type:"button",onClick:c,className:Ue("w-full text-left cursor-pointer p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",d),children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:"flex-shrink-0 mt-1",children:g.jsx("div",{className:Ue("p-2.5 rounded-full transition-colors",e?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"flex items-center gap-2 mb-1",children:g.jsx("h3",{className:Ue("font-medium truncate font-mono text-sm"),children:n})}),s&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function Yq({className:t,...e}){return g.jsx("kbd",{"data-slot":"kbd",className:Ue("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",t),...e})}function Kq({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:a,secondaryTabTitle:n,primaryCount:s,secondaryCount:l,secondaryIcon:c,primaryIcon:d,searchPlaceholder:f="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:v,onTabSwitch:b,searchInputRef:_,primaryTabName:S}){const R=t===S;return g.jsxs("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:[g.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?g.jsx(kr,{ref:_,placeholder:f,value:r,onChange:x=>h(x.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):g.jsxs(g.Fragment,{children:[g.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:R?a:n}),R&&g.jsxs(g.Fragment,{children:[g.jsx(Ba,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:g.jsx(ZT,{className:"h-4 w-4"})})}),g.jsxs(Qr,{side:"bottom",className:"flex gap-2",children:["Search",g.jsx(Yq,{children:"F"})]})]})]})]})}),g.jsxs(at,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",children:[R?g.jsx(c,{}):g.jsx(d,{}),g.jsx("span",{children:R?n:a}),R&&l>0&&g.jsx(Ba,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function rge({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Mu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>g.jsx(Sd,{id:`prompt-${n.name}`,isSelected:e?.name===n.name,isFocused:a===s,icon:g.jsx(Mu,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.arguments&&n.arguments.length>0&&g.jsxs(Ba,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[n.arguments.length," ","args"]}),onClick:()=>r(n)},n.name))})}function nge({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:a,savedPromptsCount:n,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return g.jsx(Kq,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:n,primaryIcon:Mu,secondaryIcon:Bl,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}function age({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:a,focusedIndex:n}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Bl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),g.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((s,l)=>g.jsx(Sd,{id:`saved-prompt-${s.id}`,isSelected:e?.id===s.id,isFocused:n===l,icon:g.jsx(Bl,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>r(s)},s.id))})}function ige({selectedPrompt:t,promptArgs:e,onArgChange:r}){const a=t?.arguments||[];if(!(a.length>0))return g.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=l=>{const c=l.name,d=e[c],f=typeof d=="string"?d:JSON.stringify(d);return l.type==="boolean"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("input",{id:c,type:"checkbox",checked:!!d,onChange:m=>r(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),g.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},c):l.type==="number"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:c,type:"number",value:Number(d)||0,onChange:m=>r(c,Number(m.target.value)),placeholder:l.description||`Enter ${c}`}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):l.type==="array"||l.type==="object"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(Gm,{id:c,value:f,onChange:m=>{try{const h=JSON.parse(m.target.value);r(c,h)}catch{r(c,m.target.value)}},placeholder:l.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:c,value:f,onChange:m=>r(c,m.target.value),placeholder:l.description||`Enter ${c}`}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c)};return g.jsx("div",{className:"space-y-4",children:a.map(l=>s(l))})}function oge({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:s,onSave:l}){return t?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-0",children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(at,{onClick:s,disabled:r||!a,children:r?g.jsxs(g.Fragment,{children:[g.jsx(ki,{className:"mr-2"}),"Executing..."]}):g.jsxs(g.Fragment,{children:[g.jsx(O$,{className:"h-4 w-4 mr-2"}),"Execute"]})}),g.jsxs(at,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[g.jsx(KT,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),g.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:g.jsx(ige,{selectedPrompt:t,promptArgs:e,onArgChange:n})})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function sge({results:t,copiedResult:e,onCopy:r}){const{prismStyle:a}=Qm();return g.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:g.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?g.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,s)=>g.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[g.jsx("h3",{className:"text-sm font-medium",children:"Response"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),g.jsx("div",{className:"flex gap-2 ml-auto",children:g.jsx(at,{variant:"ghost",size:"sm",onClick:()=>r(s,n.result),className:"h-6 px-2",children:e===s?g.jsx(Eo,{className:"h-4 w-4"}):g.jsx(ya,{className:"h-4 w-4"})})})]}),n.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:a,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(n.result,null,2)})})]},s))}):g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"text-center",children:g.jsx(JT,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const _z="mcp-inspector-saved-prompts";function Zq({ref:t,prompts:e,callPrompt:r,serverId:a,isConnected:n}){const[s,l]=y.useState(null),[c,d]=y.useState(null),{selectedPromptName:f,setSelectedPromptName:m}=md(),[h,v]=y.useState({}),[b,_]=y.useState([]),[S,R]=y.useState(!1),[x,T]=y.useState(null),[A,C]=y.useState(""),[k,N]=y.useState("prompts"),[I,O]=y.useState([]),[P,M]=y.useState(!1),[U,G]=y.useState(""),[J,V]=y.useState(!1),[Y,j]=y.useState(-1),q=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{V(!0),setTimeout(()=>{q.current&&q.current.focus()},0)},blurSearch:()=>{C(""),V(!1),q.current&&q.current.blur()}})),y.useEffect(()=>{try{const X=localStorage.getItem(_z);if(X){const ne=JSON.parse(X);O(ne)}}catch(X){console.error("[PromptsTab] Failed to load saved prompts:",X)}},[]);const H=y.useCallback(X=>{try{localStorage.setItem(_z,JSON.stringify(X))}catch(ne){console.error("[PromptsTab] Failed to save prompts:",ne)}},[]);y.useEffect(()=>{J&&q.current&&q.current.focus()},[J]);const Q=y.useCallback(()=>{A.trim()||V(!1)},[A]),ie=y.useMemo(()=>{if(!A.trim())return e;const X=A.toLowerCase();return e.filter(ne=>ne.name.toLowerCase().includes(X)||ne.description?.toLowerCase().includes(X))},[e,A]),$=y.useCallback(X=>{l(X);const ne={};X.arguments&&X.arguments.forEach(ee=>{ee.default!==void 0?ne[ee.name]=ee.default:ee.type==="string"?ne[ee.name]="":ee.type==="number"?ne[ee.name]=0:ee.type==="boolean"?ne[ee.name]=!1:ee.type==="array"?ne[ee.name]=[]:ee.type==="object"&&(ne[ee.name]={})}),v(ne)},[]),W=y.useCallback(X=>{const ne=e.find(ee=>ee.name===X.promptName);ne&&(l(ne),v(X.args),d(X))},[e]);y.useEffect(()=>{j(-1)},[A,k]),y.useEffect(()=>{const X=ne=>{const ee=ne.target;if(ee.tagName==="INPUT"||ee.tagName==="TEXTAREA"||ee.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const ge=k==="prompts"?ie:I;if(ne.key==="ArrowDown")ne.preventDefault(),j(Ae=>{const ye=Ae+1;return ye>=ge.length?0:ye});else if(ne.key==="ArrowUp")ne.preventDefault(),j(Ae=>{const ye=Ae-1;return ye<0?ge.length-1:ye});else if(ne.key==="Enter"&&Y>=0)if(ne.preventDefault(),k==="prompts"){const Ae=ie[Y];Ae&&$(Ae)}else{const Ae=I[Y];Ae&&W(Ae)}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Y,ie,I,k,$,W]),y.useEffect(()=>{if(Y>=0){const X=k==="prompts"?`prompt-${ie[Y]?.name}`:`saved-prompt-${I[Y]?.id}`,ne=document.getElementById(X);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[Y,ie,I,k]),y.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:s?.name}),f&&e.length>0){const X=e.find(ne=>ne.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!X,promptName:X?.name,shouldSelect:X&&s?.name!==X.name}),X&&s?.name!==X.name){console.warn("[PromptsTab] Selecting prompt:",X.name),m(null);const ne=setTimeout(()=>{$(X);const ee=document.getElementById(`prompt-${X.name}`);ee&&(console.warn("[PromptsTab] Scrolling to prompt element"),ee.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(ne)}}},[f,e,s,$,m]);const F=y.useCallback((X,ne)=>{v(ee=>({...ee,[X]:ne}))},[]),K=y.useCallback(async()=>{if(!s||S)return;R(!0);const X=Date.now();try{const ne=await r(s.name,h),ee=Date.now()-X;Mr.getInstance().capture(new bO({promptName:s.name,serverId:a,success:!0})).catch(()=>{}),_(ge=>[{promptName:s.name,args:h,result:ne,timestamp:X,duration:ee},...ge])}catch(ne){Mr.getInstance().capture(new bO({promptName:s.name,serverId:a,success:!1,error:ne instanceof Error?ne.message:"Unknown error"})).catch(()=>{});const ce={promptName:s.name,args:h,result:null,error:ne instanceof Error?ne.message:String(ne),timestamp:X,duration:Date.now()-X};_(ge=>[ce,...ge])}finally{R(!1)}},[s,h,S,r,a]),re=y.useCallback(async(X,ne)=>{try{await navigator.clipboard.writeText(JSON.stringify(ne,null,2)),T(X),setTimeout(()=>T(null),2e3)}catch(ee){console.error("[PromptsTab] Failed to copy result:",ee)}},[]),B=y.useCallback(()=>{s&&(G(""),M(!0))},[s]),L=y.useCallback(X=>{H(I.filter(ne=>ne.id!==X)),c?.id===X&&d(null)},[I,H,c]);return g.jsxs(Zu,{direction:"horizontal",className:"h-full",children:[g.jsxs(La,{defaultSize:33,className:"flex flex-col h-full relative",children:[g.jsx(nge,{activeTab:k,isSearchExpanded:J,searchQuery:A,filteredPromptsCount:ie.length,savedPromptsCount:I.length,onSearchExpand:()=>V(!0),onSearchChange:C,onSearchBlur:Q,onTabSwitch:()=>N(k==="prompts"?"saved":"prompts"),searchInputRef:q}),k==="prompts"?g.jsx(rge,{prompts:ie,selectedPrompt:s,onPromptSelect:$,focusedIndex:Y}):g.jsx(age,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:W,onDeletePrompt:L,focusedIndex:Y})]}),g.jsx(Xu,{withHandle:!0}),g.jsx(La,{defaultSize:67,children:g.jsxs(Zu,{direction:"vertical",children:[g.jsx(La,{defaultSize:40,children:g.jsx(oge,{selectedPrompt:s,promptArgs:h,isExecuting:S,isConnected:n,onArgChange:F,onExecute:K,onSave:B})}),g.jsx(Xu,{withHandle:!0}),g.jsx(La,{defaultSize:60,children:g.jsx("div",{className:"flex flex-col h-full",children:g.jsx(sge,{results:b,copiedResult:x,onCopy:re})})})]})})]})}Zq.displayName="PromptsTab";function Ul(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function lge(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function Xq({resource:t,onUIAction:e,className:r}){const a=async s=>e?.(s),n=lge(t);return g.jsx("div",{className:r,children:g.jsx(_A,{resource:n,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[bhe,vhe,yhe,Ehe],library:xA}})})}function cge({result:t,isLoading:e,previewMode:r,serverId:a,readResource:n,onTogglePreview:s,onCopy:l,onDownload:c,onFullscreen:d}){const{prismStyle:f}=Qm();let m=[],h;if(t?.resourceAnnotations&&(m=Object.keys(t.resourceAnnotations).filter(S=>S.startsWith("openai/")),h=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const S=t.result.contents[0]._meta,R=Object.keys(S).filter(x=>x.startsWith("openai/"));R.length>0&&(m=[...m,...R]),!h&&S["openai/outputTemplate"]&&(h=S["openai/outputTemplate"]),!h&&t.uri&&t.uri.startsWith("ui://widget/")&&(h=t.uri)}const v=!!(m.length>0&&h&&typeof h=="string"&&a&&n);if(e)return g.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:g.jsx(ki,{className:"size-5"})});if(!t)return g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return g.jsx("div",{className:"p-4",children:g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const b=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(S=>S.mimeType&&Ul(S)),_=b?t.result.contents.filter(S=>S.mimeType&&Ul(S)):[];return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const S=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return S!==void 0?g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S,"ms"]})]}):null})(),b&&g.jsx(Ba,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),v&&g.jsx(Ba,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),g.jsxs("div",{className:"flex items-center gap-1",children:[(b||v)&&g.jsxs(at,{variant:"ghost",size:"sm",onClick:s,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?g.jsx(kW,{className:"h-4 w-4 mr-1"}):g.jsx(SW,{className:"h-4 w-4 mr-1"}),r?"JSON":v?"Component":"Preview"]}),g.jsx(at,{variant:"ghost",size:"sm",onClick:l,children:g.jsx(ya,{className:"h-4 w-4"})}),g.jsx(at,{variant:"ghost",size:"sm",onClick:c,children:g.jsx(jW,{className:"h-4 w-4"})}),g.jsx(at,{variant:"ghost",size:"sm",onClick:d,children:g.jsx(oY,{className:"h-4 w-4"})})]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&a&&n&&h?r?g.jsx("div",{className:"flex-1 h-full",children:g.jsx(vA,{componentUrl:h,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:a,readResource:n,className:"w-full h-full relative flex p-4"})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):b?r?g.jsxs("div",{className:"space-y-0 h-full",children:[_.map((S,R)=>g.jsx("div",{className:"mx-0 size-full",children:g.jsx("div",{className:"w-full h-full",children:g.jsx(Xq,{resource:S,className:"w-full h-full"})})},`mcp-ui-${S.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const S=t.result.contents.filter(R=>!(R.mimeType&&Ul(R)));if(S.length>0)return g.jsx("div",{className:"px-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(S,null,2)})})}return null})()]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})})})]})}function uge(t,e){if(!t&&!e)return g.jsx(KW,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?g.jsx(VW,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?g.jsx(HW,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?g.jsx(JW,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?g.jsx(Sm,{className:"h-5 w-5"}):g.jsx(YT,{className:"h-5 w-5"})}function dge({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Sm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>{const l=uge(n.mimeType,n.uri),c=[n.description,n.mimeType&&g.jsx("span",{className:"font-mono",children:n.mimeType},"mime")].filter(Boolean);return g.jsx(Sd,{id:`resource-${n.uri}`,isSelected:e?.uri===n.uri,isFocused:a===s,icon:l,title:n.name,description:c.length>0?g.jsxs("span",{className:"flex flex-col gap-1",children:[n.description&&g.jsx("span",{children:n.description}),n.mimeType&&g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:n.mimeType})]}):void 0,onClick:()=>r(n)},n.uri)})})}function fge({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:a,onSearchChange:n,onSearchBlur:s,searchInputRef:l}){return g.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:g.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?g.jsx(kr,{ref:l,placeholder:"Search resources...",value:e,onChange:c=>n(c.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):g.jsxs(g.Fragment,{children:[g.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),g.jsx(Ba,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:g.jsx(ZT,{className:"h-4 w-4"})})}),g.jsxs(Qr,{side:"bottom",className:"flex gap-2",children:["Search",g.jsx(Yq,{children:"F"})]})]})]})})})}function Qq({ref:t,resources:e,readResource:r,serverId:a,isConnected:n}){const[s,l]=y.useState(null),{selectedResourceUri:c,setSelectedResourceUri:d}=md(),[f,m]=y.useState(null),[h,v]=y.useState(!1),[b,_]=y.useState(""),[S]=y.useState("resources"),[R,x]=y.useState(!0),[T,A]=y.useState(!1),[C,k]=y.useState(-1),N=y.useRef(null),I=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{A(!0),setTimeout(()=>{N.current&&N.current.focus()},0)},blurSearch:()=>{_(""),A(!1),N.current&&N.current.blur()}})),y.useEffect(()=>{T&&N.current&&N.current.focus()},[T]);const O=y.useCallback(()=>{b.trim()||A(!1)},[b]),P=y.useMemo(()=>{if(!b)return e;const V=b.toLowerCase();return e.filter(Y=>Y.name.toLowerCase().includes(V)||Y.description?.toLowerCase().includes(V)||Y.uri.toLowerCase().includes(V))},[e,b]),M=y.useCallback(async V=>{if(l(V),n){v(!0);const Y=Date.now();try{const j=await r(V.uri);Mr.getInstance().capture(new vO({resourceUri:V.uri,serverId:a,success:!0})).catch(()=>{}),m({uri:V.uri,result:j,timestamp:Y,resourceAnnotations:V.annotations})}catch(j){Mr.getInstance().capture(new vO({resourceUri:V.uri,serverId:a,success:!1,error:j instanceof Error?j.message:"Unknown error"})).catch(()=>{}),m({uri:V.uri,result:null,error:j instanceof Error?j.message:"Unknown error",timestamp:Y,resourceAnnotations:V.annotations})}finally{v(!1)}}},[r,a,n]);y.useEffect(()=>{k(-1)},[b,S]),y.useEffect(()=>{const V=Y=>{const j=Y.target;if(j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.contentEditable==="true"||Y.metaKey||Y.ctrlKey||Y.altKey)return;const H=P;if(Y.key==="ArrowDown")Y.preventDefault(),k(Q=>{const ie=Q+1;return ie>=H.length?0:ie});else if(Y.key==="ArrowUp")Y.preventDefault(),k(Q=>{const ie=Q-1;return ie<0?H.length-1:ie});else if(Y.key==="Enter"&&C>=0){Y.preventDefault();const Q=P[C];Q&&M(Q)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[C,P,M]),y.useEffect(()=>{if(C>=0){const V=`resource-${P[C]?.uri}`,Y=document.getElementById(V);Y&&Y.scrollIntoView({behavior:"smooth",block:"nearest"})}},[C,P]),y.useEffect(()=>{if(c&&e.length>0){const V=e.find(Y=>Y.uri===c);V&&s?.uri!==V.uri&&(d(null),setTimeout(()=>{M(V);const Y=document.getElementById(`resource-${V.uri}`);Y&&Y.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,e,s,M,d]);const U=y.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2))}catch(V){console.error("[ResourcesTab] Failed to copy result:",V)}},[f]),G=y.useCallback(()=>{if(f)try{const V=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),Y=URL.createObjectURL(V),j=document.createElement("a");j.href=Y,j.download=`resource-${Date.now()}.json`,document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(Y)}catch(V){console.error("[ResourcesTab] Failed to download result:",V)}},[f]),J=y.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(V){console.error("[ResourcesTab] Failed to toggle fullscreen:",V)}},[]);return g.jsxs(Zu,{direction:"horizontal",className:"h-full",children:[g.jsxs(La,{defaultSize:25,children:[g.jsx(fge,{activeTab:S,isSearchExpanded:T,searchQuery:b,filteredResourcesCount:P.length,onSearchExpand:()=>A(!0),onSearchChange:_,onSearchBlur:O,onTabSwitch:()=>{},searchInputRef:N}),g.jsx("div",{className:"flex flex-col h-full",children:g.jsx(dge,{resources:P,selectedResource:s,onResourceSelect:M,focusedIndex:C})})]}),g.jsx(Xu,{}),g.jsx(La,{defaultSize:50,children:g.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:g.jsx(cge,{result:f,isLoading:h,previewMode:R,serverId:a,readResource:r,onTogglePreview:()=>x(!R),onCopy:U,onDownload:G,onFullscreen:J})})})]})}Qq.displayName="ResourcesTab";function pge({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:a,focusedIndex:n}){if(t.length===0)return g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Sm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const s=(l,c)=>{l.stopPropagation(),c()};return g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,c)=>g.jsxs("div",{className:"relative group",children:[g.jsx(Sd,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:n===c,icon:g.jsx(k$,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:g.jsx("div",{className:"flex flex-col gap-1",children:g.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),g.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"secondary",size:"sm",onClick:d=>s(d,()=>a(l.id)),className:"h-8 w-8 p-0",children:g.jsx(xw,{className:"h-4 w-4"})})}),g.jsx(Qr,{children:g.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function mge({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:a,onSave:n,onCancel:s}){return t?g.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:g.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:l=>l.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx(ir,{htmlFor:"request-name",children:"Request Name (optional)"}),g.jsx(kr,{id:"request-name",value:e,onChange:l=>a(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&n()},autoFocus:!0})]}),g.jsxs("div",{className:"flex justify-end gap-2",children:[g.jsx(at,{variant:"outline",onClick:s,children:"Cancel"}),g.jsxs(at,{onClick:n,children:[g.jsx(KT,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function hge({selectedTool:t,toolArgs:e,onArgChange:r}){const a=t?.inputSchema?.properties||{},n=t?.inputSchema?.required||[];return Object.keys(a).length>0?g.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([l,c])=>{const d=c;d.required=n.includes(l);const f=e[l];let m="";return f!=null&&(typeof f=="string"?m=f:m=JSON.stringify(f,null,2)),d.type==="object"||d.type==="array"||typeof f=="object"&&f!==null?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(Gm,{id:l,value:m,onChange:h=>r(l,h.target.value),placeholder:d?.description||`Enter ${l}`,className:"min-h-[100px]"}),d?.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l):g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:l,value:m,onChange:h=>r(l,h.target.value),placeholder:d?.description||`Enter ${l}`}),d?.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l)})}):g.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function gge({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:s,onSave:l}){return t?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-0",children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(at,{onClick:s,disabled:r||!a,children:r?g.jsxs(g.Fragment,{children:[g.jsx(ki,{className:"mr-2"}),"Executing..."]}):g.jsxs(g.Fragment,{children:[g.jsx(O$,{className:"h-4 w-4 mr-2"}),"Execute"]})}),g.jsxs(at,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[g.jsx(KT,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),g.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:g.jsx(hge,{selectedTool:t,toolArgs:e,onArgChange:n})})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function vge({results:t,copiedResult:e,previewMode:r,serverId:a,readResource:n,onCopy:s,onTogglePreview:l}){const{prismStyle:c}=Qm();return g.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:g.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?g.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((d,f)=>{const m=d.toolMeta?.["openai/outputTemplate"],h=!!(m&&typeof m=="string"&&d.appsSdkResource),v=m,b=d.result?.content||[],_=b.filter(R=>R.type==="resource"&&Ul(R.resource)),S=_.length>0;return g.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[g.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${S||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[g.jsx("h3",{className:"text-sm font-medium",children:"Response"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(d.timestamp).toLocaleTimeString()})]}),d.duration!==void 0&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.duration,"ms"]})]}),h&&g.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI:"," ",v||"No URI"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),g.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),S&&!h&&g.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI:"," ",_[0]?.resource?.uri||"No URI"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),g.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),g.jsx(at,{variant:"ghost",size:"sm",onClick:()=>s(f,d.result),className:"ml-auto",children:e===f?g.jsx(Eo,{className:"h-4 w-4"}):g.jsx(ya,{className:"h-4 w-4"})})]}),d.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:d.error})]}):(()=>{if(h){const R=d.appsSdkResource;return R.isLoading?g.jsx(g.Fragment,{}):R.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:R.error})]}):r?g.jsx("div",{className:"flex-1",children:g.jsx(vA,{componentUrl:v,toolName:d.toolName,toolArgs:d.args,toolResult:d.result,resource:R.resourceData,serverId:a,readResource:n,className:"w-full h-full relative p-4"})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})})}return S?r?g.jsxs("div",{className:"space-y-0 h-full",children:[_.map((R,x)=>g.jsx("div",{className:"mx-0 size-full",children:g.jsx(Xq,{resource:R.resource,onUIAction:T=>{},className:"w-full h-full relative"})},x)),b.filter(R=>!(R.type==="resource"&&Ul(R.resource))).length>0&&g.jsx("div",{className:"px-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(b.filter(R=>!(R.type==="resource"&&Ul(R.resource))),null,2)})})]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})})})()]},f)})}):g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"text-center",children:g.jsx(JT,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function bge({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(gs,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>g.jsx(Sd,{id:`tool-${n.name}`,isSelected:e?.name===n.name,isFocused:a===s,icon:g.jsx(gs,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.inputSchema?.properties&&g.jsxs(Ba,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(n.inputSchema.properties).length," ","params"]}),onClick:()=>r(n)},n.name))})}function yge({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:a,savedRequestsCount:n,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return g.jsx(Kq,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:n,primaryIcon:gs,secondaryIcon:Sm,searchPlaceholder:"Search tools...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}const wz="mcp-inspector-saved-requests";function Jq({ref:t,tools:e,callTool:r,readResource:a,serverId:n,isConnected:s}){const[l,c]=y.useState(null),[d,f]=y.useState(null),{selectedToolName:m,setSelectedToolName:h}=md(),[v,b]=y.useState({}),[_,S]=y.useState([]),[R,x]=y.useState(!1),[T,A]=y.useState(null),[C,k]=y.useState(""),[N,I]=y.useState("tools"),[O,P]=y.useState([]),[M,U]=y.useState(!1),[G,J]=y.useState(""),[V,Y]=y.useState(!0),[j,q]=y.useState(!1),[H,Q]=y.useState(-1),ie=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{q(!0),setTimeout(()=>{ie.current&&ie.current.focus()},0)},blurSearch:()=>{k(""),q(!1),ie.current&&ie.current.blur()}})),y.useEffect(()=>{try{const ye=localStorage.getItem(wz);ye&&P(JSON.parse(ye))}catch(ye){console.error("[ToolsTab] Failed to load saved requests:",ye)}},[]);const $=y.useCallback(ye=>{try{localStorage.setItem(wz,JSON.stringify(ye)),P(ye)}catch(Se){console.error("[ToolsTab] Failed to save requests:",Se)}},[]),W=y.useMemo(()=>{if(!C.trim())return e;const ye=C.toLowerCase();return e.filter(Se=>Se.name.toLowerCase().includes(ye)||Se.description?.toLowerCase().includes(ye))},[e,C]),F=y.useCallback(ye=>{c(ye);const Se={};ye.inputSchema?.properties&&Object.entries(ye.inputSchema.properties).forEach(([Ie,he])=>{const Oe=he;Oe.default!==void 0?Se[Ie]=Oe.default:Oe.type==="string"?Se[Ie]="":Oe.type==="number"?Se[Ie]=0:Oe.type==="boolean"?Se[Ie]=!1:Oe.type==="array"?Se[Ie]=[]:Oe.type==="object"&&(Se[Ie]={})}),b(Se)},[]),K=y.useCallback(ye=>{const Se=e.find(Ie=>Ie.name===ye.toolName);Se&&(c(Se),b(ye.args),f(ye))},[e]);y.useEffect(()=>{j&&ie.current&&ie.current.focus()},[j]);const re=y.useCallback(()=>{C.trim()||q(!1)},[C]);y.useEffect(()=>{N!=="tools"&&q(!1)},[N]),y.useEffect(()=>{Q(-1)},[C,N]),y.useEffect(()=>{const ye=Se=>{const Ie=Se.target;if(Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.contentEditable==="true"||Se.metaKey||Se.ctrlKey||Se.altKey)return;const Oe=N==="tools"?W:O;if(Se.key==="ArrowDown")Se.preventDefault(),Q(De=>{const Qe=De+1;return Qe>=Oe.length?0:Qe});else if(Se.key==="ArrowUp")Se.preventDefault(),Q(De=>{const Qe=De-1;return Qe<0?Oe.length-1:Qe});else if(Se.key==="Enter"&&H>=0)if(Se.preventDefault(),N==="tools"){const De=W[H];De&&F(De)}else{const De=O[H];De&&K(De)}};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[H,W,O,N,F,K]),y.useEffect(()=>{if(H>=0){const ye=N==="tools"?`tool-${W[H]?.name}`:`saved-${O[H]?.id}`,Se=document.getElementById(ye);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,W,O,N]),y.useEffect(()=>{if(m&&e.length>0){const ye=e.find(Se=>Se.name===m);if(ye&&l?.name!==ye.name){h(null);const Se=setTimeout(()=>{F(ye);const Ie=document.getElementById(`tool-${ye.name}`);Ie&&Ie.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Se)}}},[m,e,l,F,h]);const B=y.useCallback((ye,Se)=>{b(Ie=>{const he={...Ie};if(l?.inputSchema?.properties?.[ye])if(l.inputSchema.properties[ye].type==="string")he[ye]=Se;else try{he[ye]=JSON.parse(Se)}catch{he[ye]=Se}else try{he[ye]=JSON.parse(Se)}catch{he[ye]=Se}return he})},[l]),L=y.useCallback(async()=>{if(!l||R)return;x(!0);const ye=Date.now();try{const Se=await r(l.name,v),Ie=Date.now()-ye;Mr.getInstance().capture(new gO({toolName:l.name,serverId:n,success:!0,duration:Ie})).catch(()=>{});const Oe=l?._meta||l?.metadata,De=Oe?.["openai/outputTemplate"];let Qe;if(De&&typeof De=="string"){const Te={toolName:l.name,args:v,result:Se,timestamp:ye,duration:Ie,toolMeta:Oe,appsSdkResource:{uri:De,resourceData:null,isLoading:!0}};S([Te]);try{const _e=await a(De);let Re=null;if(Se?.structuredContent)Re=Se.structuredContent;else if(Array.isArray(Se)&&Se[0]){const We=Se[0];We.output?.value?.structuredContent?Re=We.output.value.structuredContent:We.structuredContent?Re=We.structuredContent:We.output?.value&&(Re=We.output.value)}Re||(Re=Se),Qe={uri:De,resourceData:{..._e,structuredContent:Re},isLoading:!1}}catch(_e){Qe={uri:De,resourceData:null,isLoading:!1,error:_e instanceof Error?_e.message:String(_e)}}S(_e=>_e.map((Re,We)=>We===0?{...Re,appsSdkResource:Qe}:Re))}else S(Te=>[{toolName:l.name,args:v,result:Se,timestamp:ye,duration:Ie,toolMeta:Oe},...Te])}catch(Se){const Ie=Date.now()-ye;Mr.getInstance().capture(new gO({toolName:l.name,serverId:n,success:!1,duration:Ie,error:Se instanceof Error?Se.message:String(Se)})).catch(()=>{});const Oe=l?._meta||l?.metadata,De={toolName:l.name,args:v,result:null,error:Se instanceof Error?Se.message:String(Se),timestamp:ye,duration:Ie,toolMeta:Oe},Qe=Oe?.["openai/outputTemplate"];S(Qe?[De]:Te=>[De,...Te])}finally{x(!1)}},[l,v,R,r,a,n]),X=y.useCallback(async(ye,Se)=>{try{await navigator.clipboard.writeText(JSON.stringify(Se,null,2)),A(ye),setTimeout(()=>A(null),2e3)}catch(Ie){console.error("[ToolsTab] Failed to copy result:",Ie)}},[]),ne=y.useCallback(ye=>{S(Se=>Se.filter((Ie,he)=>he!==ye))},[]),ee=y.useCallback(ye=>{const Se=_[ye];if(Se){const Ie=window.open("","_blank","width=800,height=600");Ie&&(Ie.document.write(`
|
|
1720
|
+
`);A=N.pop()||"";for(const I of N)if(I.trim()&&I.startsWith("data: "))try{const O=JSON.parse(I.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){S+=O.content;const P=R[R.length-1];P&&P.type==="text"?P.text=S:R.push({type:"text",text:S}),console.log("[Parts after text]",R.length,"parts, text length:",S.length),s(M=>M.map(U=>U.id===_?{...U,parts:[...R]}:U))}else if(O.type==="tool-call")S&&(S=""),R.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",R.length,"parts, tool:",O.toolName),s(P=>P.map(M=>M.id===_?{...M,parts:[...R]}:M));else if(O.type==="tool-result"){const P=R.find(M=>M.type==="tool-invocation"&&M.toolInvocation?.toolName===O.toolName&&!M.toolInvocation?.result);P&&P.toolInvocation?(P.toolInvocation.result=O.result,P.toolInvocation.state="result",console.log("[Parts after tool-result]",R.length,"parts, updated:",O.toolName),s(M=>M.map(U=>U.id===_?{...U,parts:[...R]}:U))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",R.length),s(P=>P.map(M=>M.id===_?{...M,parts:[...R],content:""}:M));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,I)}}}catch(v){const b={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v instanceof Error?v.message:"Unknown error occurred"}`,timestamp:Date.now()};s(_=>[..._,b])}finally{c(!1)}},[e,a,t,n,r]),f=y.useCallback(()=>{s([])},[]);return{messages:n,isLoading:l,sendMessage:d,clearMessages:f}}function The({mcpServerUrl:t,authConfig:e,mcpConfig:r,llmConfig:a,isConnected:n,readResource:s}){const[l,c]=y.useState([]),[d,f]=y.useState(!1),m=y.useRef(null),h=y.useRef(null),v=y.useRef(null),b=y.useRef(new Map);y.useEffect(()=>()=>{h.current&&h.current.closeAllSessions().catch(console.error)},[r,t,a?.provider,a?.model]);const _=y.useCallback(async R=>{if(!R.trim()||!a||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:R.trim(),timestamp:Date.now()};c(C=>[...C,x]),f(!0),v.current=new AbortController;const T=Date.now();let A=0;try{const{MCPAgent:C,MCPClient:k}=await ep(async()=>{const{MCPAgent:V,MCPClient:Y}=await import("./browser-BkJdGGVq.js").then(j=>j.d);return{MCPAgent:V,MCPClient:Y}},__vite__mapDeps([0,1,2])),N=async(V,Y)=>{if(Y?.type==="oauth")try{const j="mcp:auth",q=wA(V),H=`${j}_${q}_tokens`,Q=localStorage.getItem(H);if(Q){const ie=JSON.parse(Q);return{...Y,oauthTokens:ie}}}catch(j){console.warn("Failed to retrieve OAuth tokens:",j)}return Y},I=(V,Y)=>{if(!Y||Y.type==="none")return V;const j={...V.headers};if(Y.type==="basic"&&Y.username&&Y.password){const q=btoa(`${Y.username}:${Y.password}`);j.Authorization=`Basic ${q}`}else if(Y.type==="bearer"&&Y.token)j.Authorization=`Bearer ${Y.token}`;else if(Y.type==="oauth"&&Y.oauthTokens?.access_token){const q=Y.oauthTokens.token_type?Y.oauthTokens.token_type.charAt(0).toUpperCase()+Y.oauthTokens.token_type.slice(1):"Bearer";j.Authorization=`${q} ${Y.oauthTokens.access_token}`}return{...V,headers:j}};let O;if(r){const V={mcpServers:{}};for(const[Y,j]of Object.entries(r.mcpServers)){const q=j.url||j.ws_url||"",H=await N(q,e||void 0);V.mcpServers[Y]=I(j,H)}O=new k(V)}else if(t){O=new k;const V=await N(t,e||void 0),j=I({url:t},V),q=`inspector-${Date.now()}`;O.addServer(q,j)}else throw new Error("Either mcpConfig or mcpServerUrl must be provided");h.current=O;let P;if(a.provider==="openai"){const{ChatOpenAI:V}=await ep(async()=>{const{ChatOpenAI:Y}=await import("./index-F8MAAt6D.js");return{ChatOpenAI:Y}},__vite__mapDeps([3,4,1,5]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else if(a.provider==="anthropic"){const{ChatAnthropic:V}=await ep(async()=>{const{ChatAnthropic:Y}=await import("./index-DHsHh1_g.js");return{ChatAnthropic:Y}},__vite__mapDeps([6,4,1]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else if(a.provider==="google"){const{ChatGoogleGenerativeAI:V}=await ep(async()=>{const{ChatGoogleGenerativeAI:Y}=await import("./index-CWYxvW-c.js");return{ChatGoogleGenerativeAI:Y}},__vite__mapDeps([7,4,1,2,5]));P=new V({model:a.model,apiKey:a.apiKey,temperature:a.temperature??0})}else throw new Error(`Unsupported LLM provider: ${a.provider}`);const M=new C({llm:P,client:O,maxSteps:10,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."});m.current=M,await M.initialize();try{const V=O;if(V.sessions){const Y=Object.keys(V.sessions);if(Y.length>0){const j=V.sessions[Y[0]];if(j?.tools){const q=Object.values(j.tools);b.current=new Map(q.map(H=>[H.name,H._meta||H.metadata||{}])),console.log("[useChatMessagesClientSide] Stored metadata for tools:",Array.from(b.current.keys()),"sample:",q[0])}}}if(b.current.size===0&&M.client){const Y=M.client;if(Y.sessions){const j=Object.keys(Y.sessions);if(j.length>0){const q=Y.sessions[j[0]];if(q?.tools){const H=Object.values(q.tools);b.current=new Map(H.map(Q=>[Q.name,Q._meta||Q.metadata||{}])),console.log("[useChatMessagesClientSide] Stored metadata from agent for tools:",Array.from(b.current.keys()))}}}}}catch(V){console.warn("[useChatMessagesClientSide] Failed to load tools metadata:",V)}const U=`assistant-${Date.now()}`;let G="";const J=[];c(V=>[...V,{id:U,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);for await(const V of M.streamEvents(R)){if(v.current?.signal.aborted)break;if(V.event==="on_chat_model_stream"&&V.data?.chunk?.text){const Y=V.data.chunk.text;if(typeof Y=="string"&&Y.length>0){G+=Y;const j=J[J.length-1];j&&j.type==="text"?j.text=G:J.push({type:"text",text:G}),c(q=>q.map(H=>H.id===U?{...H,parts:[...J]}:H))}}else if(V.event==="on_tool_start"){G&&(G="");let Y={};V.data?.input?Y=V.data.input:V.data?.tool_input?Y=V.data.tool_input:V.data&&(Y=V.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:V.name,eventData:V.data,extractedArgs:Y}),A++,J.push({type:"tool-invocation",toolInvocation:{toolName:V.name||"unknown",args:Y,state:"pending"}}),c(j=>j.map(q=>q.id===U?{...q,parts:[...J]}:q))}else if(V.event==="on_tool_end"){const Y=J.find(j=>j.type==="tool-invocation"&&j.toolInvocation?.toolName===V.name&&!j.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:V.name,hasToolPart:!!Y,output:V.data?.output}),Y&&Y.toolInvocation){const j=V.data?.output;Y.toolInvocation.result=j,Y.toolInvocation.state="result";let q=j;if(typeof j=="string")try{q=JSON.parse(j)}catch(Q){console.warn("[useChatMessagesClientSide] Failed to parse result:",Q)}const H=q?._meta?.["openai/outputTemplate"];console.log("[useChatMessagesClientSide] Apps SDK check:",{toolName:V.name,hasParsedResult:!!q,hasMeta:!!q?._meta,appsSdkUri:H}),H&&typeof H=="string"&&s&&(console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",H),(async()=>{try{const Q=await s(H);console.log("[useChatMessagesClientSide] Resource fetched:",Q);let ie=null;if(q?.structuredContent)ie=q.structuredContent;else if(Array.isArray(q)&&q[0]){const $=q[0];$.output?.value?.structuredContent?ie=$.output.value.structuredContent:$.structuredContent?ie=$.structuredContent:$.output?.value&&(ie=$.output.value)}if(ie||(ie=q),Q?.contents&&Array.isArray(Q.contents)){const $=Q.contents.map(W=>({type:"resource",resource:W}));if(console.log("[useChatMessagesClientSide] Created MCP resources:",$),Y.toolInvocation){const W={...q,content:[...q.content||[],...$],structuredContent:ie};console.log("[useChatMessagesClientSide] Updated result:",W),Y.toolInvocation.result=JSON.stringify(W),c(F=>F.map(K=>K.id===U?{...K,parts:[...J]}:K)),console.log("[useChatMessagesClientSide] Messages state updated with resource")}}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",Q)}catch(Q){console.error("Failed to fetch Apps SDK resource:",Q)}})()),c(Q=>Q.map(ie=>ie.id===U?{...ie,parts:[...J]}:ie))}}}c(V=>V.map(Y=>Y.id===U?{...Y,parts:[...J],content:""}:Y)),a&&Mr.getInstance().capture(new yO({serverId:t,provider:a.provider,model:a.model,messageCount:l.length+1,toolCallsCount:A,success:!0,executionMode:"client-side",duration:Date.now()-T})).catch(()=>{}),await O.closeAllSessions()}catch(C){console.error("Client-side agent error:",C),a&&Mr.getInstance().capture(new yO({serverId:t,provider:a.provider,model:a.model,messageCount:l.length+1,toolCallsCount:A,success:!1,executionMode:"client-side",duration:Date.now()-T,error:C instanceof Error?C.message:"Unknown error occurred"})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${C instanceof Error?C.message:"Unknown error occurred"}`,timestamp:Date.now()};if(c(N=>[...N,k]),h.current)try{await h.current.closeAllSessions()}catch(N){console.error("Error closing sessions:",N)}}finally{f(!1),m.current=null,h.current=null,v.current=null}},[a,n,r,t,e,s]),S=y.useCallback(()=>{c([])},[]);return{messages:l,isLoading:d,sendMessage:_,clearMessages:S}}const mz={openai:"gpt-4o",anthropic:"claude-3-5-sonnet-20241022",google:"gemini-2.0-flash-exp"};function Rhe({mcpServerUrl:t}){const[e,r]=y.useState(null),[a,n]=y.useState(null),[s,l]=y.useState(!1),[c,d]=y.useState("openai"),[f,m]=y.useState(""),[h,v]=y.useState(mz.openai),[b,_]=y.useState("none"),[S,R]=y.useState(""),[x,T]=y.useState(""),[A,C]=y.useState("");y.useEffect(()=>{const I=localStorage.getItem("mcp-inspector-llm-config");if(I)try{const O=JSON.parse(I);r(O),d(O.provider),m(O.apiKey),v(O.model)}catch(O){console.error("Failed to load LLM config:",O)}},[]),y.useEffect(()=>{const I=localStorage.getItem("mcp-inspector-auth-config");if(I)try{const O=JSON.parse(I);n(O),_(O.type),O.username&&R(O.username),O.password&&T(O.password),O.token&&C(O.token)}catch(O){console.error("Failed to load auth config:",O)}else try{const O="mcp:auth",P=wA(t),M=`${O}_${P}_tokens`;localStorage.getItem(M)&&(n({type:"oauth"}),_("oauth"))}catch(O){console.error("Failed to check for OAuth tokens:",O)}},[t]),y.useEffect(()=>{v(mz[c])},[c]);const k=y.useCallback(()=>{if(!f.trim())return;const I={provider:c,apiKey:f,model:h},O={type:b,...b==="basic"&&{username:S.trim(),password:x.trim()},...b==="bearer"&&{token:A.trim()}};r(I),n(O),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(I)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(O)),l(!1)},[c,f,h,b,S,x,A]),N=y.useCallback(()=>{r(null),n(null),m(""),R(""),T(""),C(""),_("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[]);return{llmConfig:e,authConfig:a,configDialogOpen:s,setConfigDialogOpen:l,tempProvider:c,setTempProvider:d,tempApiKey:f,setTempApiKey:m,tempModel:h,setTempModel:v,tempAuthType:b,saveLLMConfig:k,clearConfig:N}}function Ahe({mcpServerUrl:t,mcpConfig:e,isConnected:r,oauthState:a,oauthError:n,useClientSide:s=!0,readResource:l}){const[c,d]=y.useState(""),f=y.useRef(null),m=t||(e?Object.values(e.mcpServers)[0]?.url:void 0),{llmConfig:h,authConfig:v,configDialogOpen:b,setConfigDialogOpen:_,tempProvider:S,setTempProvider:R,tempApiKey:x,setTempApiKey:T,tempModel:A,setTempModel:C,saveLLMConfig:k,clearConfig:N}=Rhe({mcpServerUrl:m||""}),I={mcpServerUrl:t,mcpConfig:e,llmConfig:h,authConfig:v,isConnected:r,readResource:l},O=whe({mcpServerUrl:t||m||"",llmConfig:h,authConfig:v,isConnected:r}),P=The(I),{messages:M,isLoading:U,sendMessage:G,clearMessages:J}=s?P:O;G2({onNewChat:J}),y.useEffect(()=>{h&&M.length===0&&f.current&&f.current.focus()},[h,M.length]),y.useEffect(()=>{!U&&M.length>0&&f.current&&f.current.focus()},[U,M.length]);const V=y.useCallback(()=>{c.trim()&&(G(c),d(""))},[c,G]),Y=y.useCallback(q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),V())},[V]),j=y.useCallback(()=>{N(),J()},[N,J]);return h&&M.length===0?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"absolute top-4 right-4 z-10",children:g.jsx(M3,{open:b,onOpenChange:_,tempProvider:S,tempModel:A,tempApiKey:x,onProviderChange:R,onModelChange:C,onApiKeyChange:T,onSave:k,onClear:j,showClearButton:!0,buttonLabel:"Change API Key"})}),g.jsx(wie,{mcpServerUrl:m||"",inputValue:c,isConnected:r,isLoading:U,textareaRef:f,llmConfig:h,onInputChange:d,onKeyDown:Y,onSubmit:q=>{q.preventDefault(),V()},onConfigDialogOpenChange:_})]}):g.jsxs("div",{className:"flex flex-col h-full relative",children:[g.jsx(Sie,{llmConfig:h,hasMessages:M.length>0,configDialogOpen:b,onConfigDialogOpenChange:_,onClearChat:J,tempProvider:S,tempModel:A,tempApiKey:x,onProviderChange:R,onModelChange:C,onApiKeyChange:T,onSaveConfig:k,onClearConfig:j}),g.jsx("div",{className:"flex-1 overflow-y-auto p-4 pt-[100px]",children:h?g.jsx(_he,{messages:M,isLoading:U,serverId:m,readResource:l}):g.jsx(Tie,{onConfigureClick:()=>_(!0)})}),h&&g.jsx(xie,{inputValue:c,isConnected:r,isLoading:U,textareaRef:f,onInputChange:d,onKeyDown:Y,onSendMessage:V})]})}const Jm=y.createContext(null);Jm.displayName="PanelGroupContext";const pr={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},TA=10,fs=y.useLayoutEffect,hz=UT.useId,Che=typeof hz=="function"?hz:()=>null;let Nhe=0;function RA(t=null){const e=Che(),r=y.useRef(t||e||null);return r.current===null&&(r.current=""+Nhe++),t??r.current}function Aq({children:t,className:e="",collapsedSize:r,collapsible:a,defaultSize:n,forwardedRef:s,id:l,maxSize:c,minSize:d,onCollapse:f,onExpand:m,onResize:h,order:v,style:b,tagName:_="div",...S}){const R=y.useContext(Jm);if(R===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:T,getPanelSize:A,getPanelStyle:C,groupId:k,isPanelCollapsed:N,reevaluatePanelConstraints:I,registerPanel:O,resizePanel:P,unregisterPanel:M}=R,U=RA(l),G=y.useRef({callbacks:{onCollapse:f,onExpand:m,onResize:h},constraints:{collapsedSize:r,collapsible:a,defaultSize:n,maxSize:c,minSize:d},id:U,idIsFromProps:l!==void 0,order:v});y.useRef({didLogMissingDefaultSizeWarning:!1}),fs(()=>{const{callbacks:V,constraints:Y}=G.current,j={...Y};G.current.id=U,G.current.idIsFromProps=l!==void 0,G.current.order=v,V.onCollapse=f,V.onExpand=m,V.onResize=h,Y.collapsedSize=r,Y.collapsible=a,Y.defaultSize=n,Y.maxSize=c,Y.minSize=d,(j.collapsedSize!==Y.collapsedSize||j.collapsible!==Y.collapsible||j.maxSize!==Y.maxSize||j.minSize!==Y.minSize)&&I(G.current,j)}),fs(()=>{const V=G.current;return O(V),()=>{M(V)}},[v,U,O,M]),y.useImperativeHandle(s,()=>({collapse:()=>{x(G.current)},expand:V=>{T(G.current,V)},getId(){return U},getSize(){return A(G.current)},isCollapsed(){return N(G.current)},isExpanded(){return!N(G.current)},resize:V=>{P(G.current,V)}}),[x,T,A,N,U,P]);const J=C(G.current,n);return y.createElement(_,{...S,children:t,className:e,id:U,style:{...J,...b},[pr.groupId]:k,[pr.panel]:"",[pr.panelCollapsible]:a||void 0,[pr.panelId]:U,[pr.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const Cq=y.forwardRef((t,e)=>y.createElement(Aq,{...t,forwardedRef:e}));Aq.displayName="Panel";Cq.displayName="forwardRef(Panel)";let gT=null,Ip=-1,ho=null;function khe(t,e,r){const a=(e&Dq)!==0,n=(e&Lq)!==0,s=(e&Mq)!==0,l=(e&Pq)!==0;if(e){if(a)return s?"se-resize":l?"ne-resize":"e-resize";if(n)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Ihe(){ho!==null&&(document.head.removeChild(ho),gT=null,ho=null,Ip=-1)}function F_(t,e,r){var a,n;const s=khe(t,e);if(gT!==s){if(gT=s,ho===null&&(ho=document.createElement("style"),document.head.appendChild(ho)),Ip>=0){var l;(l=ho.sheet)===null||l===void 0||l.removeRule(Ip)}Ip=(a=(n=ho.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${s} !important;}`))!==null&&a!==void 0?a:-1}}function Nq(t){return t.type==="keydown"}function kq(t){return t.type.startsWith("pointer")}function Iq(t){return t.type.startsWith("mouse")}function eh(t){if(kq(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Iq(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Ohe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Dhe(t,e,r){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Lhe(t,e){if(t===e)throw new Error("Cannot compare node with itself");const r={a:bz(t),b:bz(e)};let a;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),a=t;ht(a,"Stacking order can only be calculated for elements with a common ancestor");const n={a:vz(gz(r.a)),b:vz(gz(r.b))};if(n.a===n.b){const s=a.childNodes,l={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===l.a)return 1;if(d===l.b)return-1}}return Math.sign(n.a-n.b)}const Mhe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Phe(t){var e;const r=getComputedStyle((e=Oq(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Uhe(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Phe(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||Mhe.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function gz(t){let e=t.length;for(;e--;){const r=t[e];if(ht(r,"Missing node"),Uhe(r))return r}return null}function vz(t){return t&&Number(getComputedStyle(t).zIndex)||0}function bz(t){const e=[];for(;t;)e.push(t),t=Oq(t);return e}function Oq(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const Dq=1,Lq=2,Mq=4,Pq=8,jhe=Ohe()==="coarse";let ba=[],Pl=!1,go=new Map,th=new Map;const Yu=new Set;function Fhe(t,e,r,a,n){var s;const{ownerDocument:l}=e,c={direction:r,element:e,hitAreaMargins:a,setResizeHandlerState:n},d=(s=go.get(l))!==null&&s!==void 0?s:0;return go.set(l,d+1),Yu.add(c),lm(),function(){var m;th.delete(t),Yu.delete(c);const h=(m=go.get(l))!==null&&m!==void 0?m:1;if(go.set(l,h-1),lm(),h===1&&go.delete(l),ba.includes(c)){const v=ba.indexOf(c);v>=0&&ba.splice(v,1),rh(),n("up",!0,null)}}}function zhe(t){const{target:e}=t,{x:r,y:a}=eh(t);Pl=!0,AA({target:e,x:r,y:a}),lm(),ba.length>0&&(cm("down",t),rh(),t.preventDefault(),Uq(e)||t.stopImmediatePropagation())}function z_(t){const{x:e,y:r}=eh(t);if(Pl&&t.type!=="pointerleave"&&t.buttons===0&&(Pl=!1,cm("up",t)),!Pl){const{target:a}=t;AA({target:a,x:e,y:r})}cm("move",t),rh(),ba.length>0&&t.preventDefault()}function $_(t){const{target:e}=t,{x:r,y:a}=eh(t);th.clear(),Pl=!1,ba.length>0&&(t.preventDefault(),Uq(e)||t.stopImmediatePropagation()),cm("up",t),AA({target:e,x:r,y:a}),rh(),lm()}function Uq(t){let e=t;for(;e;){if(e.hasAttribute(pr.resizeHandle))return!0;e=e.parentElement}return!1}function AA({target:t,x:e,y:r}){ba.splice(0);let a=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(a=t),Yu.forEach(n=>{const{element:s,hitAreaMargins:l}=n,c=s.getBoundingClientRect(),{bottom:d,left:f,right:m,top:h}=c,v=jhe?l.coarse:l.fine;if(e>=f-v&&e<=m+v&&r>=h-v&&r<=d+v){if(a!==null&&document.contains(a)&&s!==a&&!s.contains(a)&&!a.contains(s)&&Lhe(a,s)>0){let _=a,S=!1;for(;_&&!_.contains(s);){if(Dhe(_.getBoundingClientRect(),c)){S=!0;break}_=_.parentElement}if(S)return}ba.push(n)}})}function B_(t,e){th.set(t,e)}function rh(){let t=!1,e=!1;ba.forEach(a=>{const{direction:n}=a;n==="horizontal"?t=!0:e=!0});let r=0;th.forEach(a=>{r|=a}),t&&e?F_("intersection",r):t?F_("horizontal",r):e?F_("vertical",r):Ihe()}let q_;function lm(){var t;(t=q_)===null||t===void 0||t.abort(),q_=new AbortController;const e={capture:!0,signal:q_.signal};Yu.size&&(Pl?(ba.length>0&&go.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("contextmenu",$_,e),n.addEventListener("pointerleave",z_,e),n.addEventListener("pointermove",z_,e))}),go.forEach((r,a)=>{const{body:n}=a;n.addEventListener("pointerup",$_,e),n.addEventListener("pointercancel",$_,e)})):go.forEach((r,a)=>{const{body:n}=a;r>0&&(n.addEventListener("pointerdown",zhe,e),n.addEventListener("pointermove",z_,e))}))}function cm(t,e){Yu.forEach(r=>{const{setResizeHandlerState:a}=r,n=ba.includes(r);a(t,n,e)})}function $he(){const[t,e]=y.useState(0);return y.useCallback(()=>e(r=>r+1),[])}function ht(t,e){if(!t)throw console.error(e),Error(e)}function xs(t,e,r=TA){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function Ei(t,e,r=TA){return xs(t,e,r)===0}function Dn(t,e,r){return xs(t,e,r)===0}function Bhe(t,e,r){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++){const n=t[a],s=e[a];if(!Dn(n,s,r))return!1}return!0}function kl({panelConstraints:t,panelIndex:e,size:r}){const a=t[e];ht(a!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:n=0,collapsible:s,maxSize:l=100,minSize:c=0}=a;if(xs(r,c)<0)if(s){const d=(n+c)/2;xs(r,d)<0?r=n:r=c}else r=c;return r=Math.min(l,r),r=parseFloat(r.toFixed(TA)),r}function mu({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:a,prevLayout:n,trigger:s}){if(Dn(t,0))return e;const l=[...e],[c,d]=a;ht(c!=null,"Invalid first pivot index"),ht(d!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const h=t<0?d:c,v=r[h];ht(v,`Panel constraints not found for index ${h}`);const{collapsedSize:b=0,collapsible:_,minSize:S=0}=v;if(_){const R=e[h];if(ht(R!=null,`Previous layout not found for panel index ${h}`),Dn(R,b)){const x=S-R;xs(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}{const h=t<0?c:d,v=r[h];ht(v,`No panel constraints found for index ${h}`);const{collapsedSize:b=0,collapsible:_,minSize:S=0}=v;if(_){const R=e[h];if(ht(R!=null,`Previous layout not found for panel index ${h}`),Dn(R,S)){const x=R-b;xs(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}}{const h=t<0?1:-1;let v=t<0?d:c,b=0;for(;;){const S=e[v];ht(S!=null,`Previous layout not found for panel index ${v}`);const x=kl({panelConstraints:r,panelIndex:v,size:100})-S;if(b+=x,v+=h,v<0||v>=r.length)break}const _=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-_:_}{let v=t<0?c:d;for(;v>=0&&v<r.length;){const b=Math.abs(t)-Math.abs(f),_=e[v];ht(_!=null,`Previous layout not found for panel index ${v}`);const S=_-b,R=kl({panelConstraints:r,panelIndex:v,size:S});if(!Dn(_,R)&&(f+=_-R,l[v]=R,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?v--:v++}}if(Bhe(n,l))return n;{const h=t<0?d:c,v=e[h];ht(v!=null,`Previous layout not found for panel index ${h}`);const b=v+f,_=kl({panelConstraints:r,panelIndex:h,size:b});if(l[h]=_,!Dn(_,b)){let S=b-_,x=t<0?d:c;for(;x>=0&&x<r.length;){const T=l[x];ht(T!=null,`Previous layout not found for panel index ${x}`);const A=T+S,C=kl({panelConstraints:r,panelIndex:x,size:A});if(Dn(T,C)||(S-=C-T,l[x]=C),Dn(S,0))break;t>0?x--:x++}}}const m=l.reduce((h,v)=>v+h,0);return Dn(m,100)?l:n}function qhe({layout:t,panelsArray:e,pivotIndices:r}){let a=0,n=100,s=0,l=0;const c=r[0];ht(c!=null,"No pivot index found"),e.forEach((h,v)=>{const{constraints:b}=h,{maxSize:_=100,minSize:S=0}=b;v===c?(a=S,n=_):(s+=S,l+=_)});const d=Math.min(n,100-s),f=Math.max(a,100-l),m=t[c];return{valueMax:d,valueMin:f,valueNow:m}}function Ku(t,e=document){return Array.from(e.querySelectorAll(`[${pr.resizeHandleId}][data-panel-group-id="${t}"]`))}function jq(t,e,r=document){const n=Ku(t,r).findIndex(s=>s.getAttribute(pr.resizeHandleId)===e);return n??null}function Fq(t,e,r){const a=jq(t,e,r);return a!=null?[a,a+1]:[-1,-1]}function Hhe(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function zq(t,e=document){if(Hhe(e)&&e.dataset.panelGroupId==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function nh(t,e=document){const r=e.querySelector(`[${pr.resizeHandleId}="${t}"]`);return r||null}function Ghe(t,e,r,a=document){var n,s,l,c;const d=nh(e,a),f=Ku(t,a),m=d?f.indexOf(d):-1,h=(n=(s=r[m])===null||s===void 0?void 0:s.id)!==null&&n!==void 0?n:null,v=(l=(c=r[m+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[h,v]}function Vhe({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:a,panelDataArray:n,panelGroupElement:s,setLayout:l}){y.useRef({didWarnAboutMissingResizeHandle:!1}),fs(()=>{if(!s)return;const c=Ku(r,s);for(let d=0;d<n.length-1;d++){const{valueMax:f,valueMin:m,valueNow:h}=qhe({layout:a,panelsArray:n,pivotIndices:[d,d+1]}),v=c[d];if(v!=null){const b=n[d];ht(b,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",b.id),v.setAttribute("aria-valuemax",""+Math.round(f)),v.setAttribute("aria-valuemin",""+Math.round(m)),v.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((d,f)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,a,n,s]),y.useEffect(()=>{if(!s)return;const c=e.current;ht(c,"Eager values not found");const{panelDataArray:d}=c,f=zq(r,s);ht(f!=null,`No group found for id "${r}"`);const m=Ku(r,s);ht(m,`No resize handles found for group id "${r}"`);const h=m.map(v=>{const b=v.getAttribute(pr.resizeHandleId);ht(b,"Resize handle element has no handle id attribute");const[_,S]=Ghe(r,b,d,s);if(_==null||S==null)return()=>{};const R=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const T=d.findIndex(A=>A.id===_);if(T>=0){const A=d[T];ht(A,`No panel data found for index ${T}`);const C=a[T],{collapsedSize:k=0,collapsible:N,minSize:I=0}=A.constraints;if(C!=null&&N){const O=mu({delta:Dn(C,k)?I-k:k-C,initialLayout:a,panelConstraints:d.map(P=>P.constraints),pivotIndices:Fq(r,b,s),prevLayout:a,trigger:"keyboard"});a!==O&&l(O)}}break}}};return v.addEventListener("keydown",R),()=>{v.removeEventListener("keydown",R)}});return()=>{h.forEach(v=>v())}},[s,t,e,r,a,n,l])}function yz(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function $q(t,e){const r=t==="horizontal",{x:a,y:n}=eh(e);return r?a:n}function Whe(t,e,r,a,n){const s=r==="horizontal",l=nh(e,n);ht(l,`No resize handle element found for id "${e}"`);const c=l.getAttribute(pr.groupId);ht(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=a;const f=$q(r,t),m=zq(c,n);ht(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),v=s?h.width:h.height;return(f-d)/v*100}function Yhe(t,e,r,a,n,s){if(Nq(t)){const l=r==="horizontal";let c=0;t.shiftKey?c=100:n!=null?c=n:c=10;let d=0;switch(t.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return a==null?0:Whe(t,e,r,a,s)}function Khe({panelDataArray:t}){const e=Array(t.length),r=t.map(s=>s.constraints);let a=0,n=100;for(let s=0;s<t.length;s++){const l=r[s];ht(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;c!=null&&(a++,e[s]=c,n-=c)}for(let s=0;s<t.length;s++){const l=r[s];ht(l,`Panel constraints not found for index ${s}`);const{defaultSize:c}=l;if(c!=null)continue;const d=t.length-a,f=n/d;a++,e[s]=f,n-=f}return e}function ul(t,e,r){e.forEach((a,n)=>{const s=t[n];ht(s,`Panel data not found for index ${n}`);const{callbacks:l,constraints:c,id:d}=s,{collapsedSize:f=0,collapsible:m}=c,h=r[d];if(h==null||a!==h){r[d]=a;const{onCollapse:v,onExpand:b,onResize:_}=l;_&&_(a,h),m&&(v||b)&&(b&&(h==null||Ei(h,f))&&!Ei(a,f)&&b(),v&&(h==null||!Ei(h,f))&&Ei(a,f)&&v())}})}function ip(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function Zhe({defaultSize:t,dragState:e,layout:r,panelData:a,panelIndex:n,precision:s=3}){const l=r[n];let c;return l==null?c=t!=null?t.toFixed(s):"1":a.length===1?c="1":c=l.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function Xhe(t,e=10){let r=null;return(...n)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...n)},e)}}function Ez(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function Bq(t){return`react-resizable-panels:${t}`}function qq(t){return t.map(e=>{const{constraints:r,id:a,idIsFromProps:n,order:s}=e;return n?a:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function Hq(t,e){try{const r=Bq(t),a=e.getItem(r);if(a){const n=JSON.parse(a);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function Qhe(t,e,r){var a,n;const s=(a=Hq(t,r))!==null&&a!==void 0?a:{},l=qq(e);return(n=s[l])!==null&&n!==void 0?n:null}function Jhe(t,e,r,a,n){var s;const l=Bq(t),c=qq(e),d=(s=Hq(t,n))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:a};try{n.setItem(l,JSON.stringify(d))}catch(f){console.error(f)}}function Sz({layout:t,panelConstraints:e}){const r=[...t],a=r.reduce((s,l)=>s+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!Dn(a,100)&&r.length>0)for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=100/a*l;r[s]=c}let n=0;for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=kl({panelConstraints:e,panelIndex:s,size:l});l!=c&&(n+=l-c,r[s]=c)}if(!Dn(n,0))for(let s=0;s<e.length;s++){const l=r[s];ht(l!=null,`No layout data found for index ${s}`);const c=l+n,d=kl({panelConstraints:e,panelIndex:s,size:c});if(l!==d&&(n-=d-l,r[s]=d,Dn(n,0)))break}return r}const ege=100,hu={getItem:t=>(Ez(hu),hu.getItem(t)),setItem:(t,e)=>{Ez(hu),hu.setItem(t,e)}},xz={};function Gq({autoSaveId:t=null,children:e,className:r="",direction:a,forwardedRef:n,id:s=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=hu,style:f,tagName:m="div",...h}){const v=RA(s),b=y.useRef(null),[_,S]=y.useState(null),[R,x]=y.useState([]),T=$he(),A=y.useRef({}),C=y.useRef(new Map),k=y.useRef(0),N=y.useRef({autoSaveId:t,direction:a,dragState:_,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),I=y.useRef({layout:R,panelDataArray:[],panelDataArrayChanged:!1});y.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),y.useImperativeHandle(n,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:F}=I.current;return F},setLayout:F=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:B}=I.current,L=Sz({layout:F,panelConstraints:B.map(X=>X.constraints)});yz(re,L)||(x(L),I.current.layout=L,K&&K(L),ul(B,L,A.current))}}),[]),fs(()=>{N.current.autoSaveId=t,N.current.direction=a,N.current.dragState=_,N.current.id=v,N.current.onLayout=l,N.current.storage=d}),Vhe({committedValuesRef:N,eagerValuesRef:I,groupId:v,layout:R,panelDataArray:I.current.panelDataArray,setLayout:x,panelGroupElement:b.current}),y.useEffect(()=>{const{panelDataArray:F}=I.current;if(t){if(R.length===0||R.length!==F.length)return;let K=xz[t];K==null&&(K=Xhe(Jhe,ege),xz[t]=K);const re=[...F],B=new Map(C.current);K(t,re,B,R,d)}},[t,R,d]),y.useEffect(()=>{});const O=y.useCallback(F=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:B}=I.current;if(F.constraints.collapsible){const L=B.map(ce=>ce.constraints),{collapsedSize:X=0,panelSize:ne,pivotIndices:ee}=ns(B,F,re);if(ht(ne!=null,`Panel size not found for panel "${F.id}"`),!Ei(ne,X)){C.current.set(F.id,ne);const ge=El(B,F)===B.length-1?ne-X:X-ne,Ae=mu({delta:ge,initialLayout:re,panelConstraints:L,pivotIndices:ee,prevLayout:re,trigger:"imperative-api"});ip(re,Ae)||(x(Ae),I.current.layout=Ae,K&&K(Ae),ul(B,Ae,A.current))}}},[]),P=y.useCallback((F,K)=>{const{onLayout:re}=N.current,{layout:B,panelDataArray:L}=I.current;if(F.constraints.collapsible){const X=L.map(ye=>ye.constraints),{collapsedSize:ne=0,panelSize:ee=0,minSize:ce=0,pivotIndices:ge}=ns(L,F,B),Ae=K??ce;if(Ei(ee,ne)){const ye=C.current.get(F.id),Se=ye!=null&&ye>=Ae?ye:Ae,he=El(L,F)===L.length-1?ee-Se:Se-ee,Oe=mu({delta:he,initialLayout:B,panelConstraints:X,pivotIndices:ge,prevLayout:B,trigger:"imperative-api"});ip(B,Oe)||(x(Oe),I.current.layout=Oe,re&&re(Oe),ul(L,Oe,A.current))}}},[]),M=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{panelSize:B}=ns(re,F,K);return ht(B!=null,`Panel size not found for panel "${F.id}"`),B},[]),U=y.useCallback((F,K)=>{const{panelDataArray:re}=I.current,B=El(re,F);return Zhe({defaultSize:K,dragState:_,layout:R,panelData:re,panelIndex:B})},[_,R]),G=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{collapsedSize:B=0,collapsible:L,panelSize:X}=ns(re,F,K);return ht(X!=null,`Panel size not found for panel "${F.id}"`),L===!0&&Ei(X,B)},[]),J=y.useCallback(F=>{const{layout:K,panelDataArray:re}=I.current,{collapsedSize:B=0,collapsible:L,panelSize:X}=ns(re,F,K);return ht(X!=null,`Panel size not found for panel "${F.id}"`),!L||xs(X,B)>0},[]),V=y.useCallback(F=>{const{panelDataArray:K}=I.current;K.push(F),K.sort((re,B)=>{const L=re.order,X=B.order;return L==null&&X==null?0:L==null?-1:X==null?1:L-X}),I.current.panelDataArrayChanged=!0,T()},[T]);fs(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:F,onLayout:K,storage:re}=N.current,{layout:B,panelDataArray:L}=I.current;let X=null;if(F){const ee=Qhe(F,L,re);ee&&(C.current=new Map(Object.entries(ee.expandToSizes)),X=ee.layout)}X==null&&(X=Khe({panelDataArray:L}));const ne=Sz({layout:X,panelConstraints:L.map(ee=>ee.constraints)});yz(B,ne)||(x(ne),I.current.layout=ne,K&&K(ne),ul(L,ne,A.current))}}),fs(()=>{const F=I.current;return()=>{F.layout=[]}},[]);const Y=y.useCallback(F=>{let K=!1;const re=b.current;return re&&window.getComputedStyle(re,null).getPropertyValue("direction")==="rtl"&&(K=!0),function(L){L.preventDefault();const X=b.current;if(!X)return()=>null;const{direction:ne,dragState:ee,id:ce,keyboardResizeBy:ge,onLayout:Ae}=N.current,{layout:ye,panelDataArray:Se}=I.current,{initialLayout:Ie}=ee??{},he=Fq(ce,F,X);let Oe=Yhe(L,F,ne,ee,ge,X);const De=ne==="horizontal";De&&K&&(Oe=-Oe);const Qe=Se.map(Re=>Re.constraints),Te=mu({delta:Oe,initialLayout:Ie??ye,panelConstraints:Qe,pivotIndices:he,prevLayout:ye,trigger:Nq(L)?"keyboard":"mouse-or-touch"}),_e=!ip(ye,Te);(kq(L)||Iq(L))&&k.current!=Oe&&(k.current=Oe,!_e&&Oe!==0?De?B_(F,Oe<0?Dq:Lq):B_(F,Oe<0?Mq:Pq):B_(F,0)),_e&&(x(Te),I.current.layout=Te,Ae&&Ae(Te),ul(Se,Te,A.current))}},[]),j=y.useCallback((F,K)=>{const{onLayout:re}=N.current,{layout:B,panelDataArray:L}=I.current,X=L.map(ye=>ye.constraints),{panelSize:ne,pivotIndices:ee}=ns(L,F,B);ht(ne!=null,`Panel size not found for panel "${F.id}"`);const ge=El(L,F)===L.length-1?ne-K:K-ne,Ae=mu({delta:ge,initialLayout:B,panelConstraints:X,pivotIndices:ee,prevLayout:B,trigger:"imperative-api"});ip(B,Ae)||(x(Ae),I.current.layout=Ae,re&&re(Ae),ul(L,Ae,A.current))},[]),q=y.useCallback((F,K)=>{const{layout:re,panelDataArray:B}=I.current,{collapsedSize:L=0,collapsible:X}=K,{collapsedSize:ne=0,collapsible:ee,maxSize:ce=100,minSize:ge=0}=F.constraints,{panelSize:Ae}=ns(B,F,re);Ae!=null&&(X&&ee&&Ei(Ae,L)?Ei(L,ne)||j(F,ne):Ae<ge?j(F,ge):Ae>ce&&j(F,ce))},[j]),H=y.useCallback((F,K)=>{const{direction:re}=N.current,{layout:B}=I.current;if(!b.current)return;const L=nh(F,b.current);ht(L,`Drag handle element not found for id "${F}"`);const X=$q(re,K);S({dragHandleId:F,dragHandleRect:L.getBoundingClientRect(),initialCursorPosition:X,initialLayout:B})},[]),Q=y.useCallback(()=>{S(null)},[]),ie=y.useCallback(F=>{const{panelDataArray:K}=I.current,re=El(K,F);re>=0&&(K.splice(re,1),delete A.current[F.id],I.current.panelDataArrayChanged=!0,T())},[T]),$=y.useMemo(()=>({collapsePanel:O,direction:a,dragState:_,expandPanel:P,getPanelSize:M,getPanelStyle:U,groupId:v,isPanelCollapsed:G,isPanelExpanded:J,reevaluatePanelConstraints:q,registerPanel:V,registerResizeHandle:Y,resizePanel:j,startDragging:H,stopDragging:Q,unregisterPanel:ie,panelGroupElement:b.current}),[O,_,a,P,M,U,v,G,J,q,V,Y,j,H,Q,ie]),W={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return y.createElement(Jm.Provider,{value:$},y.createElement(m,{...h,children:e,className:r,id:s,ref:b,style:{...W,...f},[pr.group]:"",[pr.groupDirection]:a,[pr.groupId]:v}))}const Vq=y.forwardRef((t,e)=>y.createElement(Gq,{...t,forwardedRef:e}));Gq.displayName="PanelGroup";Vq.displayName="forwardRef(PanelGroup)";function El(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function ns(t,e,r){const a=El(t,e),s=a===t.length-1?[a-1,a]:[a,a+1],l=r[a];return{...e.constraints,panelSize:l,pivotIndices:s}}function tge({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:a}){y.useEffect(()=>{if(t||r==null||a==null)return;const n=nh(e,a);if(n==null)return;const s=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),r(l);break}case"F6":{l.preventDefault();const c=n.getAttribute(pr.groupId);ht(c,`No group element found for id "${c}"`);const d=Ku(c,a),f=jq(c,e,a);ht(f!==null,`No resize element found for id "${e}"`);const m=l.shiftKey?f>0?f-1:d.length-1:f+1<d.length?f+1:0;d[m].focus();break}}};return n.addEventListener("keydown",s),()=>{n.removeEventListener("keydown",s)}},[a,t,e,r])}function Wq({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:a,id:n,onBlur:s,onClick:l,onDragging:c,onFocus:d,onPointerDown:f,onPointerUp:m,style:h={},tabIndex:v=0,tagName:b="div",..._}){var S,R;const x=y.useRef(null),T=y.useRef({onClick:l,onDragging:c,onPointerDown:f,onPointerUp:m});y.useEffect(()=>{T.current.onClick=l,T.current.onDragging=c,T.current.onPointerDown=f,T.current.onPointerUp=m});const A=y.useContext(Jm);if(A===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:k,registerResizeHandle:N,startDragging:I,stopDragging:O,panelGroupElement:P}=A,M=RA(n),[U,G]=y.useState("inactive"),[J,V]=y.useState(!1),[Y,j]=y.useState(null),q=y.useRef({state:U});fs(()=>{q.current.state=U}),y.useEffect(()=>{if(r)j(null);else{const $=N(M);j(()=>$)}},[r,M,N]);const H=(S=a?.coarse)!==null&&S!==void 0?S:15,Q=(R=a?.fine)!==null&&R!==void 0?R:5;y.useEffect(()=>{if(r||Y==null)return;const $=x.current;ht($,"Element ref not attached");let W=!1;return Fhe(M,$,C,{coarse:H,fine:Q},(K,re,B)=>{if(!re){G("inactive");return}switch(K){case"down":{G("drag"),W=!1,ht(B,'Expected event to be defined for "down" action'),I(M,B);const{onDragging:L,onPointerDown:X}=T.current;L?.(!0),X?.();break}case"move":{const{state:L}=q.current;W=!0,L!=="drag"&&G("hover"),ht(B,'Expected event to be defined for "move" action'),Y(B);break}case"up":{G("hover"),O();const{onClick:L,onDragging:X,onPointerUp:ne}=T.current;X?.(!1),ne?.(),W||L?.();break}}})},[H,C,r,Q,N,M,Y,I,O]),tge({disabled:r,handleId:M,resizeHandler:Y,panelGroupElement:P});const ie={touchAction:"none",userSelect:"none"};return y.createElement(b,{..._,children:t,className:e,id:n,onBlur:()=>{V(!1),s?.()},onFocus:()=>{V(!0),d?.()},ref:x,role:"separator",style:{...ie,...h},tabIndex:v,[pr.groupDirection]:C,[pr.groupId]:k,[pr.resizeHandle]:"",[pr.resizeHandleActive]:U==="drag"?"pointer":J?"keyboard":void 0,[pr.resizeHandleEnabled]:!r,[pr.resizeHandleId]:M,[pr.resizeHandleState]:U})}Wq.displayName="PanelResizeHandle";function Zu({className:t,...e}){return g.jsx(Vq,{"data-slot":"resizable-panel-group",className:Ue("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e})}function La({...t}){return g.jsx(Cq,{"data-slot":"resizable-panel",...t})}function Xu({withHandle:t,className:e,...r}){return g.jsx(Wq,{"data-slot":"resizable-handle",className:Ue("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...r,children:t&&g.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:g.jsx(tY,{className:"size-2.5"})})})}function Sd({id:t,isSelected:e,isFocused:r,icon:a,title:n,description:s,metadata:l,onClick:c,className:d}){return g.jsx("button",{id:t,type:"button",onClick:c,className:Ue("w-full text-left cursor-pointer p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",e&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",r&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",d),children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:"flex-shrink-0 mt-1",children:g.jsx("div",{className:Ue("p-2.5 rounded-full transition-colors",e?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"flex items-center gap-2 mb-1",children:g.jsx("h3",{className:Ue("font-medium truncate font-mono text-sm"),children:n})}),s&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function Yq({className:t,...e}){return g.jsx("kbd",{"data-slot":"kbd",className:Ue("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",t),...e})}function Kq({activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabTitle:a,secondaryTabTitle:n,primaryCount:s,secondaryCount:l,secondaryIcon:c,primaryIcon:d,searchPlaceholder:f="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:v,onTabSwitch:b,searchInputRef:_,primaryTabName:S}){const R=t===S;return g.jsxs("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:[g.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?g.jsx(kr,{ref:_,placeholder:f,value:r,onChange:x=>h(x.target.value),onBlur:v,className:"h-8 border-gray-300 dark:border-zinc-600"}):g.jsxs(g.Fragment,{children:[g.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:R?a:n}),R&&g.jsxs(g.Fragment,{children:[g.jsx(Ba,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:g.jsx(ZT,{className:"h-4 w-4"})})}),g.jsxs(Qr,{side:"bottom",className:"flex gap-2",children:["Search",g.jsx(Yq,{children:"F"})]})]})]})]})}),g.jsxs(at,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",children:[R?g.jsx(c,{}):g.jsx(d,{}),g.jsx("span",{children:R?n:a}),R&&l>0&&g.jsx(Ba,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:l})]})]})}function rge({prompts:t,selectedPrompt:e,onPromptSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Mu,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>g.jsx(Sd,{id:`prompt-${n.name}`,isSelected:e?.name===n.name,isFocused:a===s,icon:g.jsx(Mu,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.arguments&&n.arguments.length>0&&g.jsxs(Ba,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[n.arguments.length," ","args"]}),onClick:()=>r(n)},n.name))})}function nge({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredPromptsCount:a,savedPromptsCount:n,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return g.jsx(Kq,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:n,primaryIcon:Mu,secondaryIcon:Bl,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}function age({savedPrompts:t,selectedPrompt:e,onLoadPrompt:r,onDeletePrompt:a,focusedIndex:n}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Bl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),g.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((s,l)=>g.jsx(Sd,{id:`saved-prompt-${s.id}`,isSelected:e?.id===s.id,isFocused:n===l,icon:g.jsx(Bl,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>r(s)},s.id))})}function ige({selectedPrompt:t,promptArgs:e,onArgChange:r}){const a=t?.arguments||[];if(!(a.length>0))return g.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=l=>{const c=l.name,d=e[c],f=typeof d=="string"?d:JSON.stringify(d);return l.type==="boolean"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("input",{id:c,type:"checkbox",checked:!!d,onChange:m=>r(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),g.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:l.description})]})]},c):l.type==="number"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:c,type:"number",value:Number(d)||0,onChange:m=>r(c,Number(m.target.value)),placeholder:l.description||`Enter ${c}`}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):l.type==="array"||l.type==="object"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(Gm,{id:c,value:f,onChange:m=>{try{const h=JSON.parse(m.target.value);r(c,h)}catch{r(c,m.target.value)}},placeholder:l.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c):g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:c,className:"text-sm font-medium",children:[c,l.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:c,value:f,onChange:m=>r(c,m.target.value),placeholder:l.description||`Enter ${c}`}),l.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l.description})]},c)};return g.jsx("div",{className:"space-y-4",children:a.map(l=>s(l))})}function oge({selectedPrompt:t,promptArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:s,onSave:l}){return t?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-0",children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(at,{onClick:s,disabled:r||!a,children:r?g.jsxs(g.Fragment,{children:[g.jsx(ki,{className:"mr-2"}),"Executing..."]}):g.jsxs(g.Fragment,{children:[g.jsx(O$,{className:"h-4 w-4 mr-2"}),"Execute"]})}),g.jsxs(at,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[g.jsx(KT,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),g.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:g.jsx(ige,{selectedPrompt:t,promptArgs:e,onArgChange:n})})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function sge({results:t,copiedResult:e,onCopy:r}){const{prismStyle:a}=Qm();return g.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:g.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?g.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((n,s)=>g.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[g.jsx("h3",{className:"text-sm font-medium",children:"Response"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(n.timestamp).toLocaleTimeString()})]}),n.duration!==void 0&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.duration,"ms"]})]}),g.jsx("div",{className:"flex gap-2 ml-auto",children:g.jsx(at,{variant:"ghost",size:"sm",onClick:()=>r(s,n.result),className:"h-6 px-2",children:e===s?g.jsx(Eo,{className:"h-4 w-4"}):g.jsx(ya,{className:"h-4 w-4"})})})]}),n.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:n.error})]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:a,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(n.result,null,2)})})]},s))}):g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"text-center",children:g.jsx(JT,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}const _z="mcp-inspector-saved-prompts";function Zq({ref:t,prompts:e,callPrompt:r,serverId:a,isConnected:n}){const[s,l]=y.useState(null),[c,d]=y.useState(null),{selectedPromptName:f,setSelectedPromptName:m}=md(),[h,v]=y.useState({}),[b,_]=y.useState([]),[S,R]=y.useState(!1),[x,T]=y.useState(null),[A,C]=y.useState(""),[k,N]=y.useState("prompts"),[I,O]=y.useState([]),[P,M]=y.useState(!1),[U,G]=y.useState(""),[J,V]=y.useState(!1),[Y,j]=y.useState(-1),q=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{V(!0),setTimeout(()=>{q.current&&q.current.focus()},0)},blurSearch:()=>{C(""),V(!1),q.current&&q.current.blur()}})),y.useEffect(()=>{try{const X=localStorage.getItem(_z);if(X){const ne=JSON.parse(X);O(ne)}}catch(X){console.error("[PromptsTab] Failed to load saved prompts:",X)}},[]);const H=y.useCallback(X=>{try{localStorage.setItem(_z,JSON.stringify(X))}catch(ne){console.error("[PromptsTab] Failed to save prompts:",ne)}},[]);y.useEffect(()=>{J&&q.current&&q.current.focus()},[J]);const Q=y.useCallback(()=>{A.trim()||V(!1)},[A]),ie=y.useMemo(()=>{if(!A.trim())return e;const X=A.toLowerCase();return e.filter(ne=>ne.name.toLowerCase().includes(X)||ne.description?.toLowerCase().includes(X))},[e,A]),$=y.useCallback(X=>{l(X);const ne={};X.arguments&&X.arguments.forEach(ee=>{ee.default!==void 0?ne[ee.name]=ee.default:ee.type==="string"?ne[ee.name]="":ee.type==="number"?ne[ee.name]=0:ee.type==="boolean"?ne[ee.name]=!1:ee.type==="array"?ne[ee.name]=[]:ee.type==="object"&&(ne[ee.name]={})}),v(ne)},[]),W=y.useCallback(X=>{const ne=e.find(ee=>ee.name===X.promptName);ne&&(l(ne),v(X.args),d(X))},[e]);y.useEffect(()=>{j(-1)},[A,k]),y.useEffect(()=>{const X=ne=>{const ee=ne.target;if(ee.tagName==="INPUT"||ee.tagName==="TEXTAREA"||ee.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const ge=k==="prompts"?ie:I;if(ne.key==="ArrowDown")ne.preventDefault(),j(Ae=>{const ye=Ae+1;return ye>=ge.length?0:ye});else if(ne.key==="ArrowUp")ne.preventDefault(),j(Ae=>{const ye=Ae-1;return ye<0?ge.length-1:ye});else if(ne.key==="Enter"&&Y>=0)if(ne.preventDefault(),k==="prompts"){const Ae=ie[Y];Ae&&$(Ae)}else{const Ae=I[Y];Ae&&W(Ae)}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Y,ie,I,k,$,W]),y.useEffect(()=>{if(Y>=0){const X=k==="prompts"?`prompt-${ie[Y]?.name}`:`saved-prompt-${I[Y]?.id}`,ne=document.getElementById(X);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[Y,ie,I,k]),y.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:e.length,currentSelectedPrompt:s?.name}),f&&e.length>0){const X=e.find(ne=>ne.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!X,promptName:X?.name,shouldSelect:X&&s?.name!==X.name}),X&&s?.name!==X.name){console.warn("[PromptsTab] Selecting prompt:",X.name),m(null);const ne=setTimeout(()=>{$(X);const ee=document.getElementById(`prompt-${X.name}`);ee&&(console.warn("[PromptsTab] Scrolling to prompt element"),ee.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(ne)}}},[f,e,s,$,m]);const F=y.useCallback((X,ne)=>{v(ee=>({...ee,[X]:ne}))},[]),K=y.useCallback(async()=>{if(!s||S)return;R(!0);const X=Date.now();try{const ne=await r(s.name,h),ee=Date.now()-X;Mr.getInstance().capture(new bO({promptName:s.name,serverId:a,success:!0})).catch(()=>{}),_(ge=>[{promptName:s.name,args:h,result:ne,timestamp:X,duration:ee},...ge])}catch(ne){Mr.getInstance().capture(new bO({promptName:s.name,serverId:a,success:!1,error:ne instanceof Error?ne.message:"Unknown error"})).catch(()=>{});const ce={promptName:s.name,args:h,result:null,error:ne instanceof Error?ne.message:String(ne),timestamp:X,duration:Date.now()-X};_(ge=>[ce,...ge])}finally{R(!1)}},[s,h,S,r,a]),re=y.useCallback(async(X,ne)=>{try{await navigator.clipboard.writeText(JSON.stringify(ne,null,2)),T(X),setTimeout(()=>T(null),2e3)}catch(ee){console.error("[PromptsTab] Failed to copy result:",ee)}},[]),B=y.useCallback(()=>{s&&(G(""),M(!0))},[s]),L=y.useCallback(X=>{H(I.filter(ne=>ne.id!==X)),c?.id===X&&d(null)},[I,H,c]);return g.jsxs(Zu,{direction:"horizontal",className:"h-full",children:[g.jsxs(La,{defaultSize:33,className:"flex flex-col h-full relative",children:[g.jsx(nge,{activeTab:k,isSearchExpanded:J,searchQuery:A,filteredPromptsCount:ie.length,savedPromptsCount:I.length,onSearchExpand:()=>V(!0),onSearchChange:C,onSearchBlur:Q,onTabSwitch:()=>N(k==="prompts"?"saved":"prompts"),searchInputRef:q}),k==="prompts"?g.jsx(rge,{prompts:ie,selectedPrompt:s,onPromptSelect:$,focusedIndex:Y}):g.jsx(age,{savedPrompts:I,selectedPrompt:c,onLoadPrompt:W,onDeletePrompt:L,focusedIndex:Y})]}),g.jsx(Xu,{withHandle:!0}),g.jsx(La,{defaultSize:67,children:g.jsxs(Zu,{direction:"vertical",children:[g.jsx(La,{defaultSize:40,children:g.jsx(oge,{selectedPrompt:s,promptArgs:h,isExecuting:S,isConnected:n,onArgChange:F,onExecute:K,onSave:B})}),g.jsx(Xu,{withHandle:!0}),g.jsx(La,{defaultSize:60,children:g.jsx("div",{className:"flex flex-col h-full",children:g.jsx(sge,{results:b,copiedResult:x,onCopy:re})})})]})})]})}Zq.displayName="PromptsTab";function Ul(t){if(!t?.mimeType)return!1;const e=t.mimeType.toLowerCase();return e==="text/html"||e==="text/html+skybridge"||e==="text/uri-list"||e.startsWith("application/vnd.mcp-ui.remote-dom")}function lge(t){return{uri:t.uri,mimeType:t.mimeType,text:t.text,blob:t.blob}}function Xq({resource:t,onUIAction:e,className:r}){const a=async s=>e?.(s),n=lge(t);return g.jsx("div",{className:r,children:g.jsx(_A,{resource:n,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[bhe,vhe,yhe,Ehe],library:xA}})})}function cge({result:t,isLoading:e,previewMode:r,serverId:a,readResource:n,onTogglePreview:s,onCopy:l,onDownload:c,onFullscreen:d}){const{prismStyle:f}=Qm();let m=[],h;if(t?.resourceAnnotations&&(m=Object.keys(t.resourceAnnotations).filter(S=>S.startsWith("openai/")),h=t.resourceAnnotations["openai/outputTemplate"]),t?.result?.contents?.[0]?._meta){const S=t.result.contents[0]._meta,R=Object.keys(S).filter(x=>x.startsWith("openai/"));R.length>0&&(m=[...m,...R]),!h&&S["openai/outputTemplate"]&&(h=S["openai/outputTemplate"]),!h&&t.uri&&t.uri.startsWith("ui://widget/")&&(h=t.uri)}const v=!!(m.length>0&&h&&typeof h=="string"&&a&&n);if(e)return g.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:g.jsx(ki,{className:"size-5"})});if(!t)return g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(t.error)return g.jsx("div",{className:"p-4",children:g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:t.error})]})});const b=t?.result?.contents&&Array.isArray(t.result.contents)&&t.result.contents.some(S=>S.mimeType&&Ul(S)),_=b?t.result.contents.filter(S=>S.mimeType&&Ul(S)):[];return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.timestamp).toLocaleTimeString()})]}),(()=>{const S=t?.duration??t.result?.duration??t.result?.metrics?.durationMs;return S!==void 0?g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[S,"ms"]})]}):null})(),b&&g.jsx(Ba,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),v&&g.jsx(Ba,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),g.jsxs("div",{className:"flex items-center gap-1",children:[(b||v)&&g.jsxs(at,{variant:"ghost",size:"sm",onClick:s,className:r?"":"text-purple-600 dark:text-purple-400",children:[r?g.jsx(kW,{className:"h-4 w-4 mr-1"}):g.jsx(SW,{className:"h-4 w-4 mr-1"}),r?"JSON":v?"Component":"Preview"]}),g.jsx(at,{variant:"ghost",size:"sm",onClick:l,children:g.jsx(ya,{className:"h-4 w-4"})}),g.jsx(at,{variant:"ghost",size:"sm",onClick:c,children:g.jsx(jW,{className:"h-4 w-4"})}),g.jsx(at,{variant:"ghost",size:"sm",onClick:d,children:g.jsx(oY,{className:"h-4 w-4"})})]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto",children:v&&a&&n&&h?r?g.jsx("div",{className:"flex-1 h-full",children:g.jsx(vA,{componentUrl:h,toolName:t.uri,toolArgs:{},toolResult:t.result,serverId:a,readResource:n,className:"w-full h-full relative flex p-4"})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):b?r?g.jsxs("div",{className:"space-y-0 h-full",children:[_.map((S,R)=>g.jsx("div",{className:"mx-0 size-full",children:g.jsx("div",{className:"w-full h-full",children:g.jsx(Xq,{resource:S,className:"w-full h-full"})})},`mcp-ui-${S.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(t.result.contents&&Array.isArray(t.result.contents)){const S=t.result.contents.filter(R=>!(R.mimeType&&Ul(R)));if(S.length>0)return g.jsx("div",{className:"px-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(S,null,2)})})}return null})()]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:f,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(t.result,null,2)})})})]})}function uge(t,e){if(!t&&!e)return g.jsx(KW,{className:"h-5 w-5"});const r=(t||e||"").toLowerCase();return r.includes("image")?g.jsx(VW,{className:"h-5 w-5"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?g.jsx(HW,{className:"h-5 w-5"}):r.includes("html")||r.includes("xml")?g.jsx(JW,{className:"h-5 w-5"}):r.includes("database")||r.includes("sql")?g.jsx(Sm,{className:"h-5 w-5"}):g.jsx(YT,{className:"h-5 w-5"})}function dge({resources:t,selectedResource:e,onResourceSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Sm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>{const l=uge(n.mimeType,n.uri),c=[n.description,n.mimeType&&g.jsx("span",{className:"font-mono",children:n.mimeType},"mime")].filter(Boolean);return g.jsx(Sd,{id:`resource-${n.uri}`,isSelected:e?.uri===n.uri,isFocused:a===s,icon:l,title:n.name,description:c.length>0?g.jsxs("span",{className:"flex flex-col gap-1",children:[n.description&&g.jsx("span",{children:n.description}),n.mimeType&&g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:n.mimeType})]}):void 0,onClick:()=>r(n)},n.uri)})})}function fge({isSearchExpanded:t,searchQuery:e,filteredResourcesCount:r,onSearchExpand:a,onSearchChange:n,onSearchBlur:s,searchInputRef:l}){return g.jsx("div",{className:"flex items-center justify-between p-4 py-3 border-r dark:border-zinc-700",children:g.jsx("div",{className:"flex items-center gap-2 flex-1",children:t?g.jsx(kr,{ref:l,placeholder:"Search resources...",value:e,onChange:c=>n(c.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):g.jsxs(g.Fragment,{children:[g.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),g.jsx(Ba,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:r}),g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:g.jsx(ZT,{className:"h-4 w-4"})})}),g.jsxs(Qr,{side:"bottom",className:"flex gap-2",children:["Search",g.jsx(Yq,{children:"F"})]})]})]})})})}function Qq({ref:t,resources:e,readResource:r,serverId:a,isConnected:n}){const[s,l]=y.useState(null),{selectedResourceUri:c,setSelectedResourceUri:d}=md(),[f,m]=y.useState(null),[h,v]=y.useState(!1),[b,_]=y.useState(""),[S]=y.useState("resources"),[R,x]=y.useState(!0),[T,A]=y.useState(!1),[C,k]=y.useState(-1),N=y.useRef(null),I=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{A(!0),setTimeout(()=>{N.current&&N.current.focus()},0)},blurSearch:()=>{_(""),A(!1),N.current&&N.current.blur()}})),y.useEffect(()=>{T&&N.current&&N.current.focus()},[T]);const O=y.useCallback(()=>{b.trim()||A(!1)},[b]),P=y.useMemo(()=>{if(!b)return e;const V=b.toLowerCase();return e.filter(Y=>Y.name.toLowerCase().includes(V)||Y.description?.toLowerCase().includes(V)||Y.uri.toLowerCase().includes(V))},[e,b]),M=y.useCallback(async V=>{if(l(V),n){v(!0);const Y=Date.now();try{const j=await r(V.uri);Mr.getInstance().capture(new vO({resourceUri:V.uri,serverId:a,success:!0})).catch(()=>{}),m({uri:V.uri,result:j,timestamp:Y,resourceAnnotations:V.annotations})}catch(j){Mr.getInstance().capture(new vO({resourceUri:V.uri,serverId:a,success:!1,error:j instanceof Error?j.message:"Unknown error"})).catch(()=>{}),m({uri:V.uri,result:null,error:j instanceof Error?j.message:"Unknown error",timestamp:Y,resourceAnnotations:V.annotations})}finally{v(!1)}}},[r,a,n]);y.useEffect(()=>{k(-1)},[b,S]),y.useEffect(()=>{const V=Y=>{const j=Y.target;if(j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.contentEditable==="true"||Y.metaKey||Y.ctrlKey||Y.altKey)return;const H=P;if(Y.key==="ArrowDown")Y.preventDefault(),k(Q=>{const ie=Q+1;return ie>=H.length?0:ie});else if(Y.key==="ArrowUp")Y.preventDefault(),k(Q=>{const ie=Q-1;return ie<0?H.length-1:ie});else if(Y.key==="Enter"&&C>=0){Y.preventDefault();const Q=P[C];Q&&M(Q)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[C,P,M]),y.useEffect(()=>{if(C>=0){const V=`resource-${P[C]?.uri}`,Y=document.getElementById(V);Y&&Y.scrollIntoView({behavior:"smooth",block:"nearest"})}},[C,P]),y.useEffect(()=>{if(c&&e.length>0){const V=e.find(Y=>Y.uri===c);V&&s?.uri!==V.uri&&(d(null),setTimeout(()=>{M(V);const Y=document.getElementById(`resource-${V.uri}`);Y&&Y.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,e,s,M,d]);const U=y.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2))}catch(V){console.error("[ResourcesTab] Failed to copy result:",V)}},[f]),G=y.useCallback(()=>{if(f)try{const V=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),Y=URL.createObjectURL(V),j=document.createElement("a");j.href=Y,j.download=`resource-${Date.now()}.json`,document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(Y)}catch(V){console.error("[ResourcesTab] Failed to download result:",V)}},[f]),J=y.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(V){console.error("[ResourcesTab] Failed to toggle fullscreen:",V)}},[]);return g.jsxs(Zu,{direction:"horizontal",className:"h-full",children:[g.jsxs(La,{defaultSize:25,children:[g.jsx(fge,{activeTab:S,isSearchExpanded:T,searchQuery:b,filteredResourcesCount:P.length,onSearchExpand:()=>A(!0),onSearchChange:_,onSearchBlur:O,onTabSwitch:()=>{},searchInputRef:N}),g.jsx("div",{className:"flex flex-col h-full",children:g.jsx(dge,{resources:P,selectedResource:s,onResourceSelect:M,focusedIndex:C})})]}),g.jsx(Xu,{}),g.jsx(La,{defaultSize:50,children:g.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:g.jsx(cge,{result:f,isLoading:h,previewMode:R,serverId:a,readResource:r,onTogglePreview:()=>x(!R),onCopy:U,onDownload:G,onFullscreen:J})})})]})}Qq.displayName="ResourcesTab";function pge({savedRequests:t,selectedRequest:e,onLoadRequest:r,onDeleteRequest:a,focusedIndex:n}){if(t.length===0)return g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(Sm,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const s=(l,c)=>{l.stopPropagation(),c()};return g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((l,c)=>g.jsxs("div",{className:"relative group",children:[g.jsx(Sd,{id:`saved-${l.id}`,isSelected:e?.id===l.id,isFocused:n===c,icon:g.jsx(k$,{className:"h-4 w-4"}),title:l.name,description:l.toolName,metadata:g.jsx("div",{className:"flex flex-col gap-1",children:g.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(l.savedAt).toLocaleString()})}),onClick:()=>r(l)}),g.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:g.jsxs(Zr,{children:[g.jsx(Xr,{asChild:!0,children:g.jsx(at,{variant:"secondary",size:"sm",onClick:d=>s(d,()=>a(l.id)),className:"h-8 w-8 p-0",children:g.jsx(xw,{className:"h-4 w-4"})})}),g.jsx(Qr,{children:g.jsx("p",{children:"Delete saved request"})})]})})]},l.id))})}function mge({isOpen:t,requestName:e,defaultPlaceholder:r,onRequestNameChange:a,onSave:n,onCancel:s}){return t?g.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:g.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:l=>l.stopPropagation(),children:[g.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx(ir,{htmlFor:"request-name",children:"Request Name (optional)"}),g.jsx(kr,{id:"request-name",value:e,onChange:l=>a(l.target.value),placeholder:r,className:"mt-2",onKeyDown:l=>{l.key==="Enter"&&n()},autoFocus:!0})]}),g.jsxs("div",{className:"flex justify-end gap-2",children:[g.jsx(at,{variant:"outline",onClick:s,children:"Cancel"}),g.jsxs(at,{onClick:n,children:[g.jsx(KT,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function hge({selectedTool:t,toolArgs:e,onArgChange:r}){const a=t?.inputSchema?.properties||{},n=t?.inputSchema?.required||[];return Object.keys(a).length>0?g.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([l,c])=>{const d=c;d.required=n.includes(l);const f=e[l];let m="";return f!=null&&(typeof f=="string"?m=f:m=JSON.stringify(f,null,2)),d.type==="object"||d.type==="array"||typeof f=="object"&&f!==null?g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(Gm,{id:l,value:m,onChange:h=>r(l,h.target.value),placeholder:d?.description||`Enter ${l}`,className:"min-h-[100px]"}),d?.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l):g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ir,{htmlFor:l,className:"text-sm font-medium",children:[l,d?.required&&g.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),g.jsx(kr,{id:l,value:m,onChange:h=>r(l,h.target.value),placeholder:d?.description||`Enter ${l}`}),d?.description&&g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d.description})]},l)})}):g.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function gge({selectedTool:t,toolArgs:e,isExecuting:r,isConnected:a,onArgChange:n,onExecute:s,onSave:l}){return t?g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsx("div",{className:"flex-shrink-0 p-6 pt-3 pb-4 pr-3",children:g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-0",children:[g.jsx("h3",{className:"text-lg font-semibold mb-2",children:t.name}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(at,{onClick:s,disabled:r||!a,children:r?g.jsxs(g.Fragment,{children:[g.jsx(ki,{className:"mr-2"}),"Executing..."]}):g.jsxs(g.Fragment,{children:[g.jsx(O$,{className:"h-4 w-4 mr-2"}),"Execute"]})}),g.jsxs(at,{variant:"outline",onClick:l,disabled:r,className:"gap-2",children:[g.jsx(KT,{className:"h-4 w-4"}),"Save"]})]})]}),t.description&&g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:t.description})]})}),g.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4 pr-3",children:g.jsx(hge,{selectedTool:t,toolArgs:e,onArgChange:n})})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),g.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function vge({results:t,copiedResult:e,previewMode:r,serverId:a,readResource:n,onCopy:s,onTogglePreview:l}){const{prismStyle:c}=Qm();return g.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:g.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:t.length>0?g.jsx("div",{className:"space-y-4 flex-1 h-full",children:t.map((d,f)=>{const m=d.toolMeta?.["openai/outputTemplate"],h=!!(m&&typeof m=="string"&&d.appsSdkResource),v=m,b=d.result?.content||[],_=b.filter(R=>R.type==="resource"&&Ul(R.resource)),S=_.length>0;return g.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[g.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${S||h?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[g.jsx("h3",{className:"text-sm font-medium",children:"Response"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Bl,{className:"h-3 w-3 text-gray-400"}),g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(d.timestamp).toLocaleTimeString()})]}),d.duration!==void 0&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Pu,{className:"h-3 w-3 text-gray-400"}),g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.duration,"ms"]})]}),h&&g.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI:"," ",v||"No URI"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),g.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),S&&!h&&g.jsxs("div",{className:"flex items-center gap-4 ml-4",children:[g.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["URI:"," ",_[0]?.resource?.uri||"No URI"]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),g.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),g.jsx("button",{onClick:()=>l(),className:`text-xs font-medium ${r?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),g.jsx(at,{variant:"ghost",size:"sm",onClick:()=>s(f,d.result),className:"ml-auto",children:e===f?g.jsx(Eo,{className:"h-4 w-4"}):g.jsx(ya,{className:"h-4 w-4"})})]}),d.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:d.error})]}):(()=>{if(h){const R=d.appsSdkResource;return R.isLoading?g.jsx(g.Fragment,{}):R.error?g.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[g.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),g.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:R.error})]}):r?g.jsx("div",{className:"flex-1",children:g.jsx(vA,{componentUrl:v,toolName:d.toolName,toolArgs:d.args,toolResult:d.result,resource:R.resourceData,serverId:a,readResource:n,className:"w-full h-full relative p-4"})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})})}return S?r?g.jsxs("div",{className:"space-y-0 h-full",children:[_.map((R,x)=>g.jsx("div",{className:"mx-0 size-full",children:g.jsx(Xq,{resource:R.resource,onUIAction:T=>{},className:"w-full h-full relative"})},x)),b.filter(R=>!(R.type==="resource"&&Ul(R.resource))).length>0&&g.jsx("div",{className:"px-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(b.filter(R=>!(R.type==="resource"&&Ul(R.resource))),null,2)})})]}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})}):g.jsx("div",{className:"px-4 pt-4",children:g.jsx(va,{language:"json",style:c,customStyle:{margin:0,padding:0,border:"none",borderRadius:0,fontSize:"1rem",background:"transparent"},className:"text-gray-900 dark:text-gray-100",children:JSON.stringify(d.result,null,2)})})})()]},f)})}):g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"text-center",children:g.jsx(JT,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function bge({tools:t,selectedTool:e,onToolSelect:r,focusedIndex:a}){return t.length===0?g.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[g.jsx(gs,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),g.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):g.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:t.map((n,s)=>g.jsx(Sd,{id:`tool-${n.name}`,isSelected:e?.name===n.name,isFocused:a===s,icon:g.jsx(gs,{className:"h-4 w-4"}),title:n.name,description:n.description,metadata:n.inputSchema?.properties&&g.jsxs(Ba,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(n.inputSchema.properties).length," ","params"]}),onClick:()=>r(n)},n.name))})}function yge({activeTab:t,isSearchExpanded:e,searchQuery:r,filteredToolsCount:a,savedRequestsCount:n,onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f}){return g.jsx(Kq,{activeTab:t,isSearchExpanded:e,searchQuery:r,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:n,primaryIcon:gs,secondaryIcon:Sm,searchPlaceholder:"Search tools...",onSearchExpand:s,onSearchChange:l,onSearchBlur:c,onTabSwitch:d,searchInputRef:f})}const wz="mcp-inspector-saved-requests";function Jq({ref:t,tools:e,callTool:r,readResource:a,serverId:n,isConnected:s}){const[l,c]=y.useState(null),[d,f]=y.useState(null),{selectedToolName:m,setSelectedToolName:h}=md(),[v,b]=y.useState({}),[_,S]=y.useState([]),[R,x]=y.useState(!1),[T,A]=y.useState(null),[C,k]=y.useState(""),[N,I]=y.useState("tools"),[O,P]=y.useState([]),[M,U]=y.useState(!1),[G,J]=y.useState(""),[V,Y]=y.useState(!0),[j,q]=y.useState(!1),[H,Q]=y.useState(-1),ie=y.useRef(null);y.useImperativeHandle(t,()=>({focusSearch:()=>{q(!0),setTimeout(()=>{ie.current&&ie.current.focus()},0)},blurSearch:()=>{k(""),q(!1),ie.current&&ie.current.blur()}})),y.useEffect(()=>{try{const ye=localStorage.getItem(wz);ye&&P(JSON.parse(ye))}catch(ye){console.error("[ToolsTab] Failed to load saved requests:",ye)}},[]);const $=y.useCallback(ye=>{try{localStorage.setItem(wz,JSON.stringify(ye)),P(ye)}catch(Se){console.error("[ToolsTab] Failed to save requests:",Se)}},[]),W=y.useMemo(()=>{if(!C.trim())return e;const ye=C.toLowerCase();return e.filter(Se=>Se.name.toLowerCase().includes(ye)||Se.description?.toLowerCase().includes(ye))},[e,C]),F=y.useCallback(ye=>{c(ye);const Se={};ye.inputSchema?.properties&&Object.entries(ye.inputSchema.properties).forEach(([Ie,he])=>{const Oe=he;Oe.default!==void 0?Se[Ie]=Oe.default:Oe.type==="string"?Se[Ie]="":Oe.type==="number"?Se[Ie]=0:Oe.type==="boolean"?Se[Ie]=!1:Oe.type==="array"?Se[Ie]=[]:Oe.type==="object"&&(Se[Ie]={})}),b(Se)},[]),K=y.useCallback(ye=>{const Se=e.find(Ie=>Ie.name===ye.toolName);Se&&(c(Se),b(ye.args),f(ye))},[e]);y.useEffect(()=>{j&&ie.current&&ie.current.focus()},[j]);const re=y.useCallback(()=>{C.trim()||q(!1)},[C]);y.useEffect(()=>{N!=="tools"&&q(!1)},[N]),y.useEffect(()=>{Q(-1)},[C,N]),y.useEffect(()=>{const ye=Se=>{const Ie=Se.target;if(Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.contentEditable==="true"||Se.metaKey||Se.ctrlKey||Se.altKey)return;const Oe=N==="tools"?W:O;if(Se.key==="ArrowDown")Se.preventDefault(),Q(De=>{const Qe=De+1;return Qe>=Oe.length?0:Qe});else if(Se.key==="ArrowUp")Se.preventDefault(),Q(De=>{const Qe=De-1;return Qe<0?Oe.length-1:Qe});else if(Se.key==="Enter"&&H>=0)if(Se.preventDefault(),N==="tools"){const De=W[H];De&&F(De)}else{const De=O[H];De&&K(De)}};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[H,W,O,N,F,K]),y.useEffect(()=>{if(H>=0){const ye=N==="tools"?`tool-${W[H]?.name}`:`saved-${O[H]?.id}`,Se=document.getElementById(ye);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest"})}},[H,W,O,N]),y.useEffect(()=>{if(m&&e.length>0){const ye=e.find(Se=>Se.name===m);if(ye&&l?.name!==ye.name){h(null);const Se=setTimeout(()=>{F(ye);const Ie=document.getElementById(`tool-${ye.name}`);Ie&&Ie.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Se)}}},[m,e,l,F,h]);const B=y.useCallback((ye,Se)=>{b(Ie=>{const he={...Ie};if(l?.inputSchema?.properties?.[ye])if(l.inputSchema.properties[ye].type==="string")he[ye]=Se;else try{he[ye]=JSON.parse(Se)}catch{he[ye]=Se}else try{he[ye]=JSON.parse(Se)}catch{he[ye]=Se}return he})},[l]),L=y.useCallback(async()=>{if(!l||R)return;x(!0);const ye=Date.now();try{const Se=await r(l.name,v),Ie=Date.now()-ye;Mr.getInstance().capture(new gO({toolName:l.name,serverId:n,success:!0,duration:Ie})).catch(()=>{});const Oe=l?._meta||l?.metadata,De=Oe?.["openai/outputTemplate"];let Qe;if(De&&typeof De=="string"){const Te={toolName:l.name,args:v,result:Se,timestamp:ye,duration:Ie,toolMeta:Oe,appsSdkResource:{uri:De,resourceData:null,isLoading:!0}};S([Te]);try{const _e=await a(De);let Re=null;if(Se?.structuredContent)Re=Se.structuredContent;else if(Array.isArray(Se)&&Se[0]){const We=Se[0];We.output?.value?.structuredContent?Re=We.output.value.structuredContent:We.structuredContent?Re=We.structuredContent:We.output?.value&&(Re=We.output.value)}Re||(Re=Se),Qe={uri:De,resourceData:{..._e,structuredContent:Re},isLoading:!1}}catch(_e){Qe={uri:De,resourceData:null,isLoading:!1,error:_e instanceof Error?_e.message:String(_e)}}S(_e=>_e.map((Re,We)=>We===0?{...Re,appsSdkResource:Qe}:Re))}else S(Te=>[{toolName:l.name,args:v,result:Se,timestamp:ye,duration:Ie,toolMeta:Oe},...Te])}catch(Se){const Ie=Date.now()-ye;Mr.getInstance().capture(new gO({toolName:l.name,serverId:n,success:!1,duration:Ie,error:Se instanceof Error?Se.message:String(Se)})).catch(()=>{});const Oe=l?._meta||l?.metadata,De={toolName:l.name,args:v,result:null,error:Se instanceof Error?Se.message:String(Se),timestamp:ye,duration:Ie,toolMeta:Oe},Qe=Oe?.["openai/outputTemplate"];S(Qe?[De]:Te=>[De,...Te])}finally{x(!1)}},[l,v,R,r,a,n]),X=y.useCallback(async(ye,Se)=>{try{await navigator.clipboard.writeText(JSON.stringify(Se,null,2)),A(ye),setTimeout(()=>A(null),2e3)}catch(Ie){console.error("[ToolsTab] Failed to copy result:",Ie)}},[]),ne=y.useCallback(ye=>{S(Se=>Se.filter((Ie,he)=>he!==ye))},[]),ee=y.useCallback(ye=>{const Se=_[ye];if(Se){const Ie=window.open("","_blank","width=800,height=600");Ie&&(Ie.document.write(`
|
|
1721
1721
|
<html>
|
|
1722
1722
|
<head>
|
|
1723
1723
|
<title>${Se.toolName} Result</title>
|