@mcp-use/inspector 7.0.0-canary.20 → 7.0.0-canary.21
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/cdn/inspector.js +13 -7
- package/dist/client/components/chat/AssistantMessage.d.ts.map +1 -1
- package/dist/client/components/chat/CopyButton.d.ts +10 -0
- package/dist/client/components/chat/CopyButton.d.ts.map +1 -0
- package/dist/client/components/chat/UserMessage.d.ts.map +1 -1
- package/dist/client/index.js +140 -133
- package/dist/web/assets/{index-6jnmzWqZ.js → index-53RzvJuE.js} +15 -15
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
|
@@ -337,7 +337,7 @@ void main() {
|
|
|
337
337
|
|
|
338
338
|
fragColor = vec4(color, opacity);
|
|
339
339
|
}
|
|
340
|
-
`;function Eu(e){if(Array.isArray(e))return e.length===4?e:e.length===3?[...e,1]:Mu;if(typeof e!=`string`)return Mu;let t,n,r,i=1;if(e.startsWith(`#`))[t,n,r,i]=Du(e);else if(e.startsWith(`rgb`))[t,n,r,i]=Ou(e);else if(e.startsWith(`hsl`))[t,n,r,i]=Au(ku(e));else return console.error(`Unsupported color format`,e),Mu;return[ju(t,0,1),ju(n,0,1),ju(r,0,1),ju(i,0,1)]}function Du(e){return e=e.replace(/^#/,``),e.length===3&&(e=e.split(``).map(e=>e+e).join(``)),e.length===6&&(e+=`ff`),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255,parseInt(e.slice(6,8),16)/255]}function Ou(e){let t=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`)/255,parseInt(t[2]??`0`)/255,parseInt(t[3]??`0`)/255,t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function ku(e){let t=e.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`),parseInt(t[2]??`0`),parseInt(t[3]??`0`),t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Au(e){let[t,n,r,i]=e,a=t/360,o=n/100,s=r/100,c,l,u;if(n===0)c=l=u=s;else{let e=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),t=s<.5?s*(1+o):s+o-s*o,n=2*s-t;c=e(n,t,a+1/3),l=e(n,t,a),u=e(n,t,a-1/3)}return[c,l,u,i]}var ju=(e,t,n)=>Math.min(Math.max(e,t),n),Mu=[0,0,0,1];function Nu(e){let t=w.useRef(void 0),n=w.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return w.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Pu(e){if(e.naturalWidth<1024&&e.naturalHeight<1024){if(e.naturalWidth<1||e.naturalHeight<1)return;let t=e.naturalWidth/e.naturalHeight;e.width=Math.round(t>1?1024*t:1024),e.height=Math.round(t>1?1024:1024/t)}}async function Fu(e){let t={},n=[],r=e=>{try{return e.startsWith(`/`)||new URL(e),!0}catch{return!1}},i=e=>{try{return e.startsWith(`/`)?!1:new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}};return Object.entries(e).forEach(([e,a])=>{if(typeof a==`string`){let o=a||`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`;if(!r(o)){console.warn(`Uniform "${e}" has invalid URL "${o}". Skipping image loading.`);return}let s=new Promise((n,r)=>{let a=new Image;i(o)&&(a.crossOrigin=`anonymous`),a.onload=()=>{Pu(a),t[e]=a,n()},a.onerror=()=>{console.error(`Could not set uniforms. Failed to load image at ${o}`),r()},a.src=o});n.push(s)}else a instanceof HTMLImageElement&&Pu(a),t[e]=a}),await Promise.all(n),t}var Iu=(0,w.forwardRef)(function({fragmentShader:e,uniforms:t,webGlContextAttributes:n,speed:r=0,frame:i=0,width:a,height:o,minPixelRatio:s,maxPixelCount:c,mipmaps:l,style:u,...d},f){let[p,m]=(0,w.useState)(!1),h=(0,w.useRef)(null),g=(0,w.useRef)(null),_=(0,w.useRef)(n);return(0,w.useEffect)(()=>((async()=>{let n=await Fu(t);h.current&&!g.current&&(g.current=new pu(h.current,e,n,_.current,r,i,s,c,l),m(!0))})(),()=>{g.current?.dispose(),g.current=null}),[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{let n=await Fu(t);e||g.current?.setUniforms(n)})(),()=>{e=!0}},[t,p]),(0,w.useEffect)(()=>{g.current?.setSpeed(r)},[r,p]),(0,w.useEffect)(()=>{g.current?.setMaxPixelCount(c)},[c,p]),(0,w.useEffect)(()=>{g.current?.setMinPixelRatio(s)},[s,p]),(0,w.useEffect)(()=>{g.current?.setFrame(i)},[i,p]),(0,S.jsx)(`div`,{ref:Nu([h,f]),style:a!==void 0||o!==void 0?{width:typeof a==`string`&&isNaN(+a)===!1?+a:a,height:typeof o==`string`&&isNaN(+o)===!1?+o:o,...u}:u,...d})});Iu.displayName=`ShaderMount`;function Lu(e,t){for(let n in e){if(n===`colors`){let n=Array.isArray(e.colors),r=Array.isArray(t.colors);if(!n||!r){if(Object.is(e.colors,t.colors)===!1)return!1;continue}if(e.colors?.length!==t.colors?.length||!e.colors?.every((e,n)=>e===t.colors?.[n]))return!1;continue}if(Object.is(e[n],t[n])===!1)return!1}return!0}var Ru={name:`Default`,params:{...yu,speed:1,frame:0,colors:[`#e0eaff`,`#241d9a`,`#f75092`,`#9f50d3`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:0}};({...yu}),{...yu},{...yu};var zu=(0,w.memo)(function({speed:e=Ru.params.speed,frame:t=Ru.params.frame,colors:n=Ru.params.colors,distortion:r=Ru.params.distortion,swirl:i=Ru.params.swirl,grainMixer:a=Ru.params.grainMixer,grainOverlay:o=Ru.params.grainOverlay,fit:s=Ru.params.fit,rotation:c=Ru.params.rotation,scale:l=Ru.params.scale,originX:u=Ru.params.originX,originY:d=Ru.params.originY,offsetX:f=Ru.params.offsetX,offsetY:p=Ru.params.offsetY,worldWidth:m=Ru.params.worldWidth,worldHeight:h=Ru.params.worldHeight,...g}){let _={u_colors:n.map(Eu),u_colorsCount:n.length,u_distortion:r,u_swirl:i,u_grainMixer:a,u_grainOverlay:o,u_fit:bu[s],u_rotation:c,u_scale:l,u_offsetX:f,u_offsetY:p,u_originX:u,u_originY:d,u_worldWidth:m,u_worldHeight:h};return(0,S.jsx)(Iu,{...g,speed:e,frame:t,fragmentShader:Tu,uniforms:_})},Lu),Bu=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`}),Vu=`VisuallyHidden`,Hu=w.forwardRef((e,t)=>(0,S.jsx)(Jt.span,{...e,ref:t,style:{...Bu,...e.style}}));Hu.displayName=Vu;var Uu=Hu,[Wu,nee]=Nt(`Tooltip`,[oa]),Gu=oa(),Ku=`TooltipProvider`,qu=700,Ju=`tooltip.open`,[Yu,Xu]=Wu(Ku),Zu=e=>{let{__scopeTooltip:t,delayDuration:n=qu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=w.useRef(!0),s=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)(Yu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:w.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Zu.displayName=Ku;var Qu=`Tooltip`,[$u,ed]=Wu(Qu),td=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Xu(Qu,e.__scopeTooltip),l=Gu(t),[u,d]=w.useState(null),f=In(),p=w.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=w.useRef(!1),[_,v]=Lt({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ju))):c.onClose(),a?.(e)},caller:Qu}),y=w.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=w.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return w.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,S.jsx)(Sa,{...l,children:(0,S.jsx)($u,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:w.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};td.displayName=Qu;var nd=`TooltipTrigger`,rd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ed(nd,n),a=Xu(nd,n),o=Gu(n),s=D(t,w.useRef(null),i.onTriggerChange),c=w.useRef(!1),l=w.useRef(!1),u=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,S.jsx)(Ca,{asChild:!0,...o,children:(0,S.jsx)(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:jt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:jt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:jt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:jt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:jt(e.onBlur,i.onClose),onClick:jt(e.onClick,i.onClose)})})});rd.displayName=nd;var id=`TooltipPortal`,[ad,od]=Wu(id,{forceMount:void 0}),sd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ed(id,t);return(0,S.jsx)(ad,{scope:t,forceMount:n,children:(0,S.jsx)(ka,{present:n||a.open,children:(0,S.jsx)(Da,{asChild:!0,container:i,children:r})})})};sd.displayName=id;var cd=`TooltipContent`,ld=w.forwardRef((e,t)=>{let n=od(cd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ed(cd,e.__scopeTooltip);return(0,S.jsx)(ka,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(md,{side:i,...a,ref:t}):(0,S.jsx)(ud,{side:i,...a,ref:t})})}),ud=w.forwardRef((e,t)=>{let n=ed(cd,e.__scopeTooltip),r=Xu(cd,e.__scopeTooltip),i=w.useRef(null),a=D(t,i),[o,s]=w.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=w.useCallback(()=>{s(null),d(!1)},[d]),p=w.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=vd(r,_d(r,n.getBoundingClientRect())),a=yd(t.getBoundingClientRect());s(xd([...i,...a])),d(!0)},[d]);return w.useEffect(()=>()=>f(),[f]),w.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),w.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!bd(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,S.jsx)(md,{...e,ref:a})}),[dd,fd]=Wu(Qu,{isInside:!1}),pd=Wt(`TooltipContent`),md=w.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ed(cd,n),l=Gu(n),{onClose:u}=c;return w.useEffect(()=>(document.addEventListener(Ju,u),()=>document.removeEventListener(Ju,u)),[u]),w.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,S.jsx)(cn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(wa,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,S.jsx)(pd,{children:r}),(0,S.jsx)(dd,{scope:n,isInside:!0,children:(0,S.jsx)(Uu,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ld.displayName=cd;var hd=`TooltipArrow`,gd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Gu(n);return fd(hd,n).isInside?null:(0,S.jsx)(Ta,{...i,...r,ref:t})});gd.displayName=hd;function _d(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function vd(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function yd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function bd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xd(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Sd(t)}function Sd(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ree=Zu,Cd=td,wd=rd,Td=sd,Ed=ld,Dd=gd;function Od({delayDuration:e=0,...t}){return(0,S.jsx)(ree,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function kd({...e}){return(0,S.jsx)(Od,{children:(0,S.jsx)(Cd,{"data-slot":`tooltip`,...e})})}function Ad({...e}){return(0,S.jsx)(wd,{"data-slot":`tooltip-trigger`,...e})}function jd({className:e,sideOffset:t=0,children:n,...r}){return(0,S.jsx)(Td,{children:(0,S.jsxs)(Ed,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`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`,e),...r,children:[n,(0,S.jsx)(Dd,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Md=class{name=`mcp_inspector_open`;properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}},Nd=class{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}}},Pd=class{name=`mcp_resource_read`;properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}},Fd=class{name=`mcp_prompt_call`;properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}},Id=class{name=`mcp_server_connection`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,success:e.success,connection_type:e.connectionType,error:e.error}}},Ld=class{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}}},Rd=class{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}}},zd=class{name=`mcp_server_removed`;properties;constructor(e){this.properties={server_id:e.serverId}}},Bd=class{name=`mcp_command_palette_open`;properties;constructor(e){this.properties={trigger:e.trigger}}},Vd=class{name=`mcp_tool_saved`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}},Hd=class{name=`mcp_tunnel_action`;properties;constructor(e){this.properties={action:e.action,success:e.success,tunnel_url:e.tunnelUrl}}},Ud=class{name=`mcp_deploy_click`;properties;constructor(e){this.properties={referrer:e.referrer}}},Wd=class{name=`mcp_chat_configured`;properties;constructor(e){this.properties={provider:e.provider,model:e.model}}},Gd=class{name=`mcp_tab_navigation`;properties;constructor(e){this.properties={tab:e.tab,previous_tab:e.previousTab}}},Kd=class{name=`mcp_add_to_client`;properties;constructor(e){this.properties={client:e.client}}},qd=class{name=`mcp_session_duration`;properties;constructor(e){this.properties={duration_seconds:e.durationSeconds,tabs_visited:e.tabsVisited,tools_executed:e.toolsExecuted}}};function Jd(){try{return`7.0.0-canary.20`}catch{return`0.0.0`}}function Yd(){try{return typeof window<`u`&&typeof document<`u`}catch{return!1}}var Xd=class{endpoint;timeout;constructor(e,t=3e3){this.endpoint=e,this.timeout=t}async logEvent(e){try{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout),r=await fetch(this.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(clearTimeout(n),!r.ok)throw Error(`HTTP error! status: ${r.status}`)}catch{}}};function Zd(e){return`mcp_inspector_telemetry_${e}`}function Qd(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}function $d(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`}var ef=class e{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`;_mode=`standalone`;constructor(){let e=Yd(),t=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||`inspector`,this._mode=Qd(),t)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new Xd(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Xd(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return!!(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||$d()&&localStorage.getItem(Zd(`disabled`))===`true`||typeof process<`u`&&{}?.MCP_USE_ANONYMIZED_TELEMETRY===`false`)}getStoredSource(){return $d()?localStorage.getItem(Zd(`source`)):null}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e,$d()&&localStorage.setItem(Zd(`source`),e)}getSource(){return this._source}getMode(){return this._mode}get userId(){if(this._currUserId)return this._currUserId;if(!Yd())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{if(!$d())throw Error(`localStorage is not available or not functional`);let e=localStorage.getItem(Zd(`user_id`));if(e)this._currUserId=e;else{let e=this.generateUserId();localStorage.setItem(Zd(`user_id`),e),this._currUserId=e}this.trackPackageDownload({triggered_by:`user_id_property`}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){let e=window.crypto;if(e){let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);return n.slice(0,8)+`-`+n.slice(8,12)+`-`+n.slice(12,16)+`-`+n.slice(16,20)+`-`+n.slice(20,32)}else return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{let t={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:Jd(),language:`typescript`,source:this._source,package:`inspector`,mode:this._mode}};await this._posthogClient.logEvent(t)}catch{}if(this._scarfClient)try{let t={};t.mcp_use_version=Jd(),t.user_id=this.userId,t.event=e.name,t.language=`typescript`,t.source=this._source,t.package=`inspector`,t.mode=this._mode,await this._scarfClient.logEvent(t)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&Yd())try{if(!$d())throw Error(`localStorage is not available or not functional`);let t=Jd(),n=!1,r=!1,i=localStorage.getItem(Zd(`download_version`));if(i?t>i&&(n=!0,r=!1,localStorage.setItem(Zd(`download_version`),t)):(n=!0,r=!0,localStorage.setItem(Zd(`download_version`),t)),n){let n={...e||{}};n.mcp_use_version=t,n.user_id=this.userId,n.event=`package_download`,n.first_download=r,n.language=`typescript`,n.source=this._source,n.package=`inspector`,n.mode=this._mode,await this._scarfClient.logEvent(n)}}catch{}}async trackInspectorOpen(e){let t=new Md(e);await this.capture(t)}},tf=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rf=e=>{let t=nf(e);return t.charAt(0).toUpperCase()+t.slice(1)},af=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),of=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},sf={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},cf=(0,w.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,w.createElement)(`svg`,{ref:c,...sf,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:af(`lucide`,i),...!a&&!of(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])),lf=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(cf,{ref:i,iconNode:t,className:af(`lucide-${tf(rf(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rf(e),n},uf=lf(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),df=lf(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),ff=lf(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),iee=lf(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),pf=lf(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),mf=lf(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),hf=lf(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),gf=lf(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),_f=lf(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),vf=lf(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yf=lf(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bf=lf(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xf=lf(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Sf=lf(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Cf=lf(`chevrons-left-right-ellipsis`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`m17 7 5 5-5 5`,key:`1xlxn0`}],[`path`,{d:`m7 7-5 5 5 5`,key:`19njba`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]),wf=lf(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Tf=lf(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ef=lf(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Df=lf(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Of=lf(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),kf=lf(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),Af=lf(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),jf=lf(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Mf=lf(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Nf=lf(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Pf=lf(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ff=lf(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),If=lf(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Lf=lf(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Rf=lf(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),zf=lf(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Bf=lf(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Vf=lf(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Hf=lf(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Uf=lf(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Wf=lf(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Gf=lf(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Kf=lf(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),qf=lf(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Jf=lf(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Yf=lf(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Xf=lf(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Zf=lf(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qf=lf(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),$f=lf(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),ep=lf(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),tp=lf(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),np=lf(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),rp=lf(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),ip=lf(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),ap=lf(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),op=lf(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),sp=lf(`picture-in-picture`,[[`path`,{d:`M2 10h6V4`,key:`zwrco`}],[`path`,{d:`m2 4 6 6`,key:`ug085t`}],[`path`,{d:`M21 10V7a2 2 0 0 0-2-2h-7`,key:`git5jr`}],[`path`,{d:`M3 14v2a2 2 0 0 0 2 2h3`,key:`1f7fh3`}],[`rect`,{x:`12`,y:`14`,width:`10`,height:`7`,rx:`1`,key:`1wjs3o`}]]),cp=lf(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),lp=lf(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),up=lf(`pointer`,[[`path`,{d:`M22 14a8 8 0 0 1-8 8`,key:`56vcr3`}],[`path`,{d:`M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1agjmk`}],[`path`,{d:`M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1`,key:`wdbh2u`}],[`path`,{d:`M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10`,key:`1ibuk9`}],[`path`,{d:`M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`g6ys72`}]]),dp=lf(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),fp=lf(`rocket`,[[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z`,key:`m3kijz`}],[`path`,{d:`m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z`,key:`1fmvmk`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0`,key:`1f8sc4`}],[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}]]),pp=lf(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),mp=lf(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),hp=lf(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),gp=lf(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),_p=lf(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),vp=lf(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),yp=lf(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),bp=lf(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),xp=lf(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Sp=lf(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Cp=lf(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),wp=lf(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Tp=lf(`square-dashed-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]]),Ep=lf(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Dp=lf(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Op=lf(`sun-dim`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]),kp=lf(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ap=lf(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),jp=lf(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Mp=lf(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Np=lf(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Pp=lf(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Fp=lf(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ip=lf(`zap`,[[`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`}]]),Lp=Object.freeze({status:`aborted`});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Rp=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},zp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Bp={};function Vp(e){return e&&Object.assign(Bp,e),Bp}function Hp(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Up(e,t){return typeof t==`bigint`?t.toString():t}function Wp(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Gp(e){return e==null}function Kp(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function aee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var oee=Symbol(`evaluating`);function qp(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==oee)return r===void 0&&(r=oee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Jp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yp(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function see(e){return JSON.stringify(e)}function cee(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var lee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Xp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var uee=Wp(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Zp(e){if(Xp(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Xp(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function dee(e){return Zp(e)?{...e}:Array.isArray(e)?[...e]:e}var fee=new Set([`string`,`number`,`symbol`]);function Qp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $p(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function em(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function pee(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var mee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function hee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return $p(e,Yp(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Jp(this,`shape`,e),e},checks:[]}))}function gee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return $p(e,Yp(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Jp(this,`shape`,r),r},checks:[]}))}function _ee(e,t){if(!Zp(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jp(this,`shape`,n),n}}))}function vee(e,t){if(!Zp(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jp(this,`shape`,n),n}}))}function yee(e,t){return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Jp(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function bee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return $p(t,Yp(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Jp(this,`shape`,i),i},checks:[]}))}function xee(e,t,n){return $p(t,Yp(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Jp(this,`shape`,i),i}}))}function tm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nm(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function rm(e){return typeof e==`string`?e:e?.message}function im(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=rm(e.inst?._zod.def?.error?.(e))??rm(t?.error?.(e))??rm(n.customError?.(e))??rm(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function am(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function om(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var sm=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Up,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},cm=W(`$ZodError`,sm),lm=W(`$ZodError`,sm,{Parent:Error});function See(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Cee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var um=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Rp;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>im(e,a,Vp())));throw lee(t,i?.callee),t}return o.value},dm=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>im(e,a,Vp())));throw lee(t,i?.callee),t}return o.value},fm=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Rp;return a.issues.length?{success:!1,error:new(e??cm)(a.issues.map(e=>im(e,i,Vp())))}:{success:!0,data:a.value}},wee=fm(lm),pm=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>im(e,i,Vp())))}:{success:!0,data:a.value}},Tee=pm(lm),Eee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return um(e)(t,n,i)},Dee=e=>(t,n,r)=>um(e)(t,n,r),Oee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dm(e)(t,n,i)},kee=e=>async(t,n,r)=>dm(e)(t,n,r),Aee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fm(e)(t,n,i)},jee=e=>(t,n,r)=>fm(e)(t,n,r),Mee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pm(e)(t,n,i)},Nee=e=>async(t,n,r)=>pm(e)(t,n,r),Pee=/^[cC][^\s-]{8,}$/,Fee=/^[0-9a-z]+$/,Iee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lee=/^[0-9a-vA-V]{20}$/,Ree=/^[A-Za-z0-9]{27}$/,zee=/^[a-zA-Z0-9_-]{21}$/,Bee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hee=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Uee=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Wee(){return new RegExp(Uee,`u`)}var Gee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,qee=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Jee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hm=/^[A-Za-z0-9_-]*$/,Xee=/^\+[1-9]\d{6,14}$/,gm=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Zee=RegExp(`^${gm}$`);function _m(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qee(e){return RegExp(`^${_m(e)}$`)}function $ee(e){let t=_m({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${gm}T(?:${r})$`)}var ete=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},tte=/^-?\d+$/,vm=/^-?\d+(?:\.\d+)?$/,nte=/^(?:true|false)$/i,rte=/^null$/i,ite=/^[^A-Z]*$/,ate=/^[^a-z]*$/,ym=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bm={number:`number`,bigint:`bigint`,object:`date`},xm=W(`$ZodCheckLessThan`,(e,t)=>{ym.init(e,t);let n=bm[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sm=W(`$ZodCheckGreaterThan`,(e,t)=>{ym.init(e,t);let n=bm[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ote=W(`$ZodCheckMultipleOf`,(e,t)=>{ym.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):aee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ste=W(`$ZodCheckNumberFormat`,(e,t)=>{ym.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=mee[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=tte)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),cte=W(`$ZodCheckMaxLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=am(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lte=W(`$ZodCheckMinLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=am(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ute=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=am(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Cm=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ym.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dte=W(`$ZodCheckRegex`,(e,t)=>{Cm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fte=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ite,Cm.init(e,t)}),pte=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ate,Cm.init(e,t)}),mte=W(`$ZodCheckIncludes`,(e,t)=>{ym.init(e,t);let n=Qp(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hte=W(`$ZodCheckStartsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`^${Qp(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gte=W(`$ZodCheckEndsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`.*${Qp(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_te=W(`$ZodCheckOverwrite`,(e,t)=>{ym.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),vte=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
340
|
+
`;function Eu(e){if(Array.isArray(e))return e.length===4?e:e.length===3?[...e,1]:Mu;if(typeof e!=`string`)return Mu;let t,n,r,i=1;if(e.startsWith(`#`))[t,n,r,i]=Du(e);else if(e.startsWith(`rgb`))[t,n,r,i]=Ou(e);else if(e.startsWith(`hsl`))[t,n,r,i]=Au(ku(e));else return console.error(`Unsupported color format`,e),Mu;return[ju(t,0,1),ju(n,0,1),ju(r,0,1),ju(i,0,1)]}function Du(e){return e=e.replace(/^#/,``),e.length===3&&(e=e.split(``).map(e=>e+e).join(``)),e.length===6&&(e+=`ff`),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255,parseInt(e.slice(6,8),16)/255]}function Ou(e){let t=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`)/255,parseInt(t[2]??`0`)/255,parseInt(t[3]??`0`)/255,t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function ku(e){let t=e.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`),parseInt(t[2]??`0`),parseInt(t[3]??`0`),t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Au(e){let[t,n,r,i]=e,a=t/360,o=n/100,s=r/100,c,l,u;if(n===0)c=l=u=s;else{let e=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),t=s<.5?s*(1+o):s+o-s*o,n=2*s-t;c=e(n,t,a+1/3),l=e(n,t,a),u=e(n,t,a-1/3)}return[c,l,u,i]}var ju=(e,t,n)=>Math.min(Math.max(e,t),n),Mu=[0,0,0,1];function Nu(e){let t=w.useRef(void 0),n=w.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return w.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Pu(e){if(e.naturalWidth<1024&&e.naturalHeight<1024){if(e.naturalWidth<1||e.naturalHeight<1)return;let t=e.naturalWidth/e.naturalHeight;e.width=Math.round(t>1?1024*t:1024),e.height=Math.round(t>1?1024:1024/t)}}async function Fu(e){let t={},n=[],r=e=>{try{return e.startsWith(`/`)||new URL(e),!0}catch{return!1}},i=e=>{try{return e.startsWith(`/`)?!1:new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}};return Object.entries(e).forEach(([e,a])=>{if(typeof a==`string`){let o=a||`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`;if(!r(o)){console.warn(`Uniform "${e}" has invalid URL "${o}". Skipping image loading.`);return}let s=new Promise((n,r)=>{let a=new Image;i(o)&&(a.crossOrigin=`anonymous`),a.onload=()=>{Pu(a),t[e]=a,n()},a.onerror=()=>{console.error(`Could not set uniforms. Failed to load image at ${o}`),r()},a.src=o});n.push(s)}else a instanceof HTMLImageElement&&Pu(a),t[e]=a}),await Promise.all(n),t}var Iu=(0,w.forwardRef)(function({fragmentShader:e,uniforms:t,webGlContextAttributes:n,speed:r=0,frame:i=0,width:a,height:o,minPixelRatio:s,maxPixelCount:c,mipmaps:l,style:u,...d},f){let[p,m]=(0,w.useState)(!1),h=(0,w.useRef)(null),g=(0,w.useRef)(null),_=(0,w.useRef)(n);return(0,w.useEffect)(()=>((async()=>{let n=await Fu(t);h.current&&!g.current&&(g.current=new pu(h.current,e,n,_.current,r,i,s,c,l),m(!0))})(),()=>{g.current?.dispose(),g.current=null}),[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{let n=await Fu(t);e||g.current?.setUniforms(n)})(),()=>{e=!0}},[t,p]),(0,w.useEffect)(()=>{g.current?.setSpeed(r)},[r,p]),(0,w.useEffect)(()=>{g.current?.setMaxPixelCount(c)},[c,p]),(0,w.useEffect)(()=>{g.current?.setMinPixelRatio(s)},[s,p]),(0,w.useEffect)(()=>{g.current?.setFrame(i)},[i,p]),(0,S.jsx)(`div`,{ref:Nu([h,f]),style:a!==void 0||o!==void 0?{width:typeof a==`string`&&isNaN(+a)===!1?+a:a,height:typeof o==`string`&&isNaN(+o)===!1?+o:o,...u}:u,...d})});Iu.displayName=`ShaderMount`;function Lu(e,t){for(let n in e){if(n===`colors`){let n=Array.isArray(e.colors),r=Array.isArray(t.colors);if(!n||!r){if(Object.is(e.colors,t.colors)===!1)return!1;continue}if(e.colors?.length!==t.colors?.length||!e.colors?.every((e,n)=>e===t.colors?.[n]))return!1;continue}if(Object.is(e[n],t[n])===!1)return!1}return!0}var Ru={name:`Default`,params:{...yu,speed:1,frame:0,colors:[`#e0eaff`,`#241d9a`,`#f75092`,`#9f50d3`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:0}};({...yu}),{...yu},{...yu};var zu=(0,w.memo)(function({speed:e=Ru.params.speed,frame:t=Ru.params.frame,colors:n=Ru.params.colors,distortion:r=Ru.params.distortion,swirl:i=Ru.params.swirl,grainMixer:a=Ru.params.grainMixer,grainOverlay:o=Ru.params.grainOverlay,fit:s=Ru.params.fit,rotation:c=Ru.params.rotation,scale:l=Ru.params.scale,originX:u=Ru.params.originX,originY:d=Ru.params.originY,offsetX:f=Ru.params.offsetX,offsetY:p=Ru.params.offsetY,worldWidth:m=Ru.params.worldWidth,worldHeight:h=Ru.params.worldHeight,...g}){let _={u_colors:n.map(Eu),u_colorsCount:n.length,u_distortion:r,u_swirl:i,u_grainMixer:a,u_grainOverlay:o,u_fit:bu[s],u_rotation:c,u_scale:l,u_offsetX:f,u_offsetY:p,u_originX:u,u_originY:d,u_worldWidth:m,u_worldHeight:h};return(0,S.jsx)(Iu,{...g,speed:e,frame:t,fragmentShader:Tu,uniforms:_})},Lu),Bu=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`}),Vu=`VisuallyHidden`,Hu=w.forwardRef((e,t)=>(0,S.jsx)(Jt.span,{...e,ref:t,style:{...Bu,...e.style}}));Hu.displayName=Vu;var Uu=Hu,[Wu,nee]=Nt(`Tooltip`,[oa]),Gu=oa(),Ku=`TooltipProvider`,qu=700,Ju=`tooltip.open`,[Yu,Xu]=Wu(Ku),Zu=e=>{let{__scopeTooltip:t,delayDuration:n=qu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=w.useRef(!0),s=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)(Yu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:w.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Zu.displayName=Ku;var Qu=`Tooltip`,[$u,ed]=Wu(Qu),td=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Xu(Qu,e.__scopeTooltip),l=Gu(t),[u,d]=w.useState(null),f=In(),p=w.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=w.useRef(!1),[_,v]=Lt({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ju))):c.onClose(),a?.(e)},caller:Qu}),y=w.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=w.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return w.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,S.jsx)(Sa,{...l,children:(0,S.jsx)($u,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:w.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};td.displayName=Qu;var nd=`TooltipTrigger`,rd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ed(nd,n),a=Xu(nd,n),o=Gu(n),s=D(t,w.useRef(null),i.onTriggerChange),c=w.useRef(!1),l=w.useRef(!1),u=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,S.jsx)(Ca,{asChild:!0,...o,children:(0,S.jsx)(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:jt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:jt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:jt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:jt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:jt(e.onBlur,i.onClose),onClick:jt(e.onClick,i.onClose)})})});rd.displayName=nd;var id=`TooltipPortal`,[ad,od]=Wu(id,{forceMount:void 0}),sd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ed(id,t);return(0,S.jsx)(ad,{scope:t,forceMount:n,children:(0,S.jsx)(ka,{present:n||a.open,children:(0,S.jsx)(Da,{asChild:!0,container:i,children:r})})})};sd.displayName=id;var cd=`TooltipContent`,ld=w.forwardRef((e,t)=>{let n=od(cd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ed(cd,e.__scopeTooltip);return(0,S.jsx)(ka,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(md,{side:i,...a,ref:t}):(0,S.jsx)(ud,{side:i,...a,ref:t})})}),ud=w.forwardRef((e,t)=>{let n=ed(cd,e.__scopeTooltip),r=Xu(cd,e.__scopeTooltip),i=w.useRef(null),a=D(t,i),[o,s]=w.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=w.useCallback(()=>{s(null),d(!1)},[d]),p=w.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=vd(r,_d(r,n.getBoundingClientRect())),a=yd(t.getBoundingClientRect());s(xd([...i,...a])),d(!0)},[d]);return w.useEffect(()=>()=>f(),[f]),w.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),w.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!bd(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,S.jsx)(md,{...e,ref:a})}),[dd,fd]=Wu(Qu,{isInside:!1}),pd=Wt(`TooltipContent`),md=w.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ed(cd,n),l=Gu(n),{onClose:u}=c;return w.useEffect(()=>(document.addEventListener(Ju,u),()=>document.removeEventListener(Ju,u)),[u]),w.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,S.jsx)(cn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(wa,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,S.jsx)(pd,{children:r}),(0,S.jsx)(dd,{scope:n,isInside:!0,children:(0,S.jsx)(Uu,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ld.displayName=cd;var hd=`TooltipArrow`,gd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Gu(n);return fd(hd,n).isInside?null:(0,S.jsx)(Ta,{...i,...r,ref:t})});gd.displayName=hd;function _d(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function vd(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function yd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function bd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xd(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Sd(t)}function Sd(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ree=Zu,Cd=td,wd=rd,Td=sd,Ed=ld,Dd=gd;function Od({delayDuration:e=0,...t}){return(0,S.jsx)(ree,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function kd({...e}){return(0,S.jsx)(Od,{children:(0,S.jsx)(Cd,{"data-slot":`tooltip`,...e})})}function Ad({...e}){return(0,S.jsx)(wd,{"data-slot":`tooltip-trigger`,...e})}function jd({className:e,sideOffset:t=0,children:n,...r}){return(0,S.jsx)(Td,{children:(0,S.jsxs)(Ed,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`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`,e),...r,children:[n,(0,S.jsx)(Dd,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Md=class{name=`mcp_inspector_open`;properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}},Nd=class{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}}},Pd=class{name=`mcp_resource_read`;properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}},Fd=class{name=`mcp_prompt_call`;properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}},Id=class{name=`mcp_server_connection`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,success:e.success,connection_type:e.connectionType,error:e.error}}},Ld=class{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}}},Rd=class{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}}},zd=class{name=`mcp_server_removed`;properties;constructor(e){this.properties={server_id:e.serverId}}},Bd=class{name=`mcp_command_palette_open`;properties;constructor(e){this.properties={trigger:e.trigger}}},Vd=class{name=`mcp_tool_saved`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}},Hd=class{name=`mcp_tunnel_action`;properties;constructor(e){this.properties={action:e.action,success:e.success,tunnel_url:e.tunnelUrl}}},Ud=class{name=`mcp_deploy_click`;properties;constructor(e){this.properties={referrer:e.referrer}}},Wd=class{name=`mcp_chat_configured`;properties;constructor(e){this.properties={provider:e.provider,model:e.model}}},Gd=class{name=`mcp_tab_navigation`;properties;constructor(e){this.properties={tab:e.tab,previous_tab:e.previousTab}}},Kd=class{name=`mcp_add_to_client`;properties;constructor(e){this.properties={client:e.client}}},qd=class{name=`mcp_session_duration`;properties;constructor(e){this.properties={duration_seconds:e.durationSeconds,tabs_visited:e.tabsVisited,tools_executed:e.toolsExecuted}}};function Jd(){try{return`7.0.0-canary.21`}catch{return`0.0.0`}}function Yd(){try{return typeof window<`u`&&typeof document<`u`}catch{return!1}}var Xd=class{endpoint;timeout;constructor(e,t=3e3){this.endpoint=e,this.timeout=t}async logEvent(e){try{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout),r=await fetch(this.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(clearTimeout(n),!r.ok)throw Error(`HTTP error! status: ${r.status}`)}catch{}}};function Zd(e){return`mcp_inspector_telemetry_${e}`}function Qd(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}function $d(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`}var ef=class e{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`;_mode=`standalone`;constructor(){let e=Yd(),t=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||`inspector`,this._mode=Qd(),t)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new Xd(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Xd(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return!!(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||$d()&&localStorage.getItem(Zd(`disabled`))===`true`||typeof process<`u`&&{}?.MCP_USE_ANONYMIZED_TELEMETRY===`false`)}getStoredSource(){return $d()?localStorage.getItem(Zd(`source`)):null}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e,$d()&&localStorage.setItem(Zd(`source`),e)}getSource(){return this._source}getMode(){return this._mode}get userId(){if(this._currUserId)return this._currUserId;if(!Yd())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{if(!$d())throw Error(`localStorage is not available or not functional`);let e=localStorage.getItem(Zd(`user_id`));if(e)this._currUserId=e;else{let e=this.generateUserId();localStorage.setItem(Zd(`user_id`),e),this._currUserId=e}this.trackPackageDownload({triggered_by:`user_id_property`}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){let e=window.crypto;if(e){let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);return n.slice(0,8)+`-`+n.slice(8,12)+`-`+n.slice(12,16)+`-`+n.slice(16,20)+`-`+n.slice(20,32)}else return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{let t={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:Jd(),language:`typescript`,source:this._source,package:`inspector`,mode:this._mode}};await this._posthogClient.logEvent(t)}catch{}if(this._scarfClient)try{let t={};t.mcp_use_version=Jd(),t.user_id=this.userId,t.event=e.name,t.language=`typescript`,t.source=this._source,t.package=`inspector`,t.mode=this._mode,await this._scarfClient.logEvent(t)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&Yd())try{if(!$d())throw Error(`localStorage is not available or not functional`);let t=Jd(),n=!1,r=!1,i=localStorage.getItem(Zd(`download_version`));if(i?t>i&&(n=!0,r=!1,localStorage.setItem(Zd(`download_version`),t)):(n=!0,r=!0,localStorage.setItem(Zd(`download_version`),t)),n){let n={...e||{}};n.mcp_use_version=t,n.user_id=this.userId,n.event=`package_download`,n.first_download=r,n.language=`typescript`,n.source=this._source,n.package=`inspector`,n.mode=this._mode,await this._scarfClient.logEvent(n)}}catch{}}async trackInspectorOpen(e){let t=new Md(e);await this.capture(t)}},tf=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rf=e=>{let t=nf(e);return t.charAt(0).toUpperCase()+t.slice(1)},af=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),of=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},sf={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},cf=(0,w.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,w.createElement)(`svg`,{ref:c,...sf,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:af(`lucide`,i),...!a&&!of(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])),lf=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(cf,{ref:i,iconNode:t,className:af(`lucide-${tf(rf(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rf(e),n},uf=lf(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),df=lf(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),ff=lf(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),iee=lf(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),pf=lf(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),mf=lf(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),hf=lf(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),gf=lf(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),_f=lf(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),vf=lf(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yf=lf(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bf=lf(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xf=lf(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Sf=lf(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Cf=lf(`chevrons-left-right-ellipsis`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`m17 7 5 5-5 5`,key:`1xlxn0`}],[`path`,{d:`m7 7-5 5 5 5`,key:`19njba`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]),wf=lf(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Tf=lf(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ef=lf(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Df=lf(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Of=lf(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),kf=lf(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),Af=lf(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),jf=lf(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Mf=lf(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Nf=lf(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Pf=lf(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ff=lf(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),If=lf(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Lf=lf(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Rf=lf(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),zf=lf(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Bf=lf(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Vf=lf(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Hf=lf(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Uf=lf(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Wf=lf(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Gf=lf(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Kf=lf(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),qf=lf(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Jf=lf(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Yf=lf(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Xf=lf(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Zf=lf(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Qf=lf(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),$f=lf(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),ep=lf(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),tp=lf(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),np=lf(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),rp=lf(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),ip=lf(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),ap=lf(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),op=lf(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),sp=lf(`picture-in-picture`,[[`path`,{d:`M2 10h6V4`,key:`zwrco`}],[`path`,{d:`m2 4 6 6`,key:`ug085t`}],[`path`,{d:`M21 10V7a2 2 0 0 0-2-2h-7`,key:`git5jr`}],[`path`,{d:`M3 14v2a2 2 0 0 0 2 2h3`,key:`1f7fh3`}],[`rect`,{x:`12`,y:`14`,width:`10`,height:`7`,rx:`1`,key:`1wjs3o`}]]),cp=lf(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),lp=lf(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),up=lf(`pointer`,[[`path`,{d:`M22 14a8 8 0 0 1-8 8`,key:`56vcr3`}],[`path`,{d:`M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1agjmk`}],[`path`,{d:`M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1`,key:`wdbh2u`}],[`path`,{d:`M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10`,key:`1ibuk9`}],[`path`,{d:`M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`g6ys72`}]]),dp=lf(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),fp=lf(`rocket`,[[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z`,key:`m3kijz`}],[`path`,{d:`m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z`,key:`1fmvmk`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0`,key:`1f8sc4`}],[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}]]),pp=lf(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),mp=lf(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),hp=lf(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),gp=lf(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),_p=lf(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),vp=lf(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),yp=lf(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),bp=lf(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),xp=lf(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Sp=lf(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Cp=lf(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),wp=lf(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Tp=lf(`square-dashed-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]]),Ep=lf(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Dp=lf(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Op=lf(`sun-dim`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]),kp=lf(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ap=lf(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),jp=lf(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Mp=lf(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Np=lf(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Pp=lf(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Fp=lf(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ip=lf(`zap`,[[`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`}]]),Lp=Object.freeze({status:`aborted`});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Rp=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},zp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Bp={};function Vp(e){return e&&Object.assign(Bp,e),Bp}function Hp(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Up(e,t){return typeof t==`bigint`?t.toString():t}function Wp(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Gp(e){return e==null}function Kp(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function aee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var oee=Symbol(`evaluating`);function qp(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==oee)return r===void 0&&(r=oee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Jp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yp(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function see(e){return JSON.stringify(e)}function cee(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var lee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Xp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var uee=Wp(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Zp(e){if(Xp(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Xp(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function dee(e){return Zp(e)?{...e}:Array.isArray(e)?[...e]:e}var fee=new Set([`string`,`number`,`symbol`]);function Qp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $p(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function em(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function pee(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var mee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function hee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return $p(e,Yp(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Jp(this,`shape`,e),e},checks:[]}))}function gee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return $p(e,Yp(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Jp(this,`shape`,r),r},checks:[]}))}function _ee(e,t){if(!Zp(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jp(this,`shape`,n),n}}))}function vee(e,t){if(!Zp(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jp(this,`shape`,n),n}}))}function yee(e,t){return $p(e,Yp(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Jp(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function bee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return $p(t,Yp(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Jp(this,`shape`,i),i},checks:[]}))}function xee(e,t,n){return $p(t,Yp(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Jp(this,`shape`,i),i}}))}function tm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nm(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function rm(e){return typeof e==`string`?e:e?.message}function im(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=rm(e.inst?._zod.def?.error?.(e))??rm(t?.error?.(e))??rm(n.customError?.(e))??rm(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function am(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function om(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var sm=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Up,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},cm=W(`$ZodError`,sm),lm=W(`$ZodError`,sm,{Parent:Error});function See(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Cee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var um=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Rp;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>im(e,a,Vp())));throw lee(t,i?.callee),t}return o.value},dm=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>im(e,a,Vp())));throw lee(t,i?.callee),t}return o.value},fm=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Rp;return a.issues.length?{success:!1,error:new(e??cm)(a.issues.map(e=>im(e,i,Vp())))}:{success:!0,data:a.value}},wee=fm(lm),pm=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>im(e,i,Vp())))}:{success:!0,data:a.value}},Tee=pm(lm),Eee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return um(e)(t,n,i)},Dee=e=>(t,n,r)=>um(e)(t,n,r),Oee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dm(e)(t,n,i)},kee=e=>async(t,n,r)=>dm(e)(t,n,r),Aee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fm(e)(t,n,i)},jee=e=>(t,n,r)=>fm(e)(t,n,r),Mee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pm(e)(t,n,i)},Nee=e=>async(t,n,r)=>pm(e)(t,n,r),Pee=/^[cC][^\s-]{8,}$/,Fee=/^[0-9a-z]+$/,Iee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lee=/^[0-9a-vA-V]{20}$/,Ree=/^[A-Za-z0-9]{27}$/,zee=/^[a-zA-Z0-9_-]{21}$/,Bee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hee=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Uee=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Wee(){return new RegExp(Uee,`u`)}var Gee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,qee=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Jee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hm=/^[A-Za-z0-9_-]*$/,Xee=/^\+[1-9]\d{6,14}$/,gm=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Zee=RegExp(`^${gm}$`);function _m(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qee(e){return RegExp(`^${_m(e)}$`)}function $ee(e){let t=_m({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${gm}T(?:${r})$`)}var ete=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},tte=/^-?\d+$/,vm=/^-?\d+(?:\.\d+)?$/,nte=/^(?:true|false)$/i,rte=/^null$/i,ite=/^[^A-Z]*$/,ate=/^[^a-z]*$/,ym=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bm={number:`number`,bigint:`bigint`,object:`date`},xm=W(`$ZodCheckLessThan`,(e,t)=>{ym.init(e,t);let n=bm[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sm=W(`$ZodCheckGreaterThan`,(e,t)=>{ym.init(e,t);let n=bm[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ote=W(`$ZodCheckMultipleOf`,(e,t)=>{ym.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):aee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ste=W(`$ZodCheckNumberFormat`,(e,t)=>{ym.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=mee[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=tte)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),cte=W(`$ZodCheckMaxLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=am(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lte=W(`$ZodCheckMinLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=am(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ute=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Gp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=am(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Cm=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ym.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),dte=W(`$ZodCheckRegex`,(e,t)=>{Cm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fte=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ite,Cm.init(e,t)}),pte=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ate,Cm.init(e,t)}),mte=W(`$ZodCheckIncludes`,(e,t)=>{ym.init(e,t);let n=Qp(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hte=W(`$ZodCheckStartsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`^${Qp(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gte=W(`$ZodCheckEndsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`.*${Qp(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_te=W(`$ZodCheckOverwrite`,(e,t)=>{ym.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),vte=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
341
341
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
342
342
|
`))}},yte={major:4,minor:3,patch:5},wm=W(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yte;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=tm(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Rp;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=tm(e,t))});else{if(e.issues.length===t)continue;r||=tm(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(tm(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Rp;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Rp;return o.then(e=>t(e,r,a))}return t(o,r,a)}}qp(e,`~standard`,()=>({validate:t=>{try{let n=wee(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Tee(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Tm=W(`$ZodString`,(e,t)=>{wm.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ete(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Em=W(`$ZodStringFormat`,(e,t)=>{Cm.init(e,t),Tm.init(e,t)}),bte=W(`$ZodGUID`,(e,t)=>{t.pattern??=Vee,Em.init(e,t)}),xte=W(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=mm(e)}else t.pattern??=mm();Em.init(e,t)}),Ste=W(`$ZodEmail`,(e,t)=>{t.pattern??=Hee,Em.init(e,t)}),Cte=W(`$ZodURL`,(e,t)=>{Em.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),wte=W(`$ZodEmoji`,(e,t)=>{t.pattern??=Wee(),Em.init(e,t)}),Tte=W(`$ZodNanoID`,(e,t)=>{t.pattern??=zee,Em.init(e,t)}),Ete=W(`$ZodCUID`,(e,t)=>{t.pattern??=Pee,Em.init(e,t)}),Dte=W(`$ZodCUID2`,(e,t)=>{t.pattern??=Fee,Em.init(e,t)}),Ote=W(`$ZodULID`,(e,t)=>{t.pattern??=Iee,Em.init(e,t)}),kte=W(`$ZodXID`,(e,t)=>{t.pattern??=Lee,Em.init(e,t)}),Ate=W(`$ZodKSUID`,(e,t)=>{t.pattern??=Ree,Em.init(e,t)}),jte=W(`$ZodISODateTime`,(e,t)=>{t.pattern??=$ee(t),Em.init(e,t)}),Mte=W(`$ZodISODate`,(e,t)=>{t.pattern??=Zee,Em.init(e,t)}),Nte=W(`$ZodISOTime`,(e,t)=>{t.pattern??=Qee(t),Em.init(e,t)}),Pte=W(`$ZodISODuration`,(e,t)=>{t.pattern??=Bee,Em.init(e,t)}),Fte=W(`$ZodIPv4`,(e,t)=>{t.pattern??=Gee,Em.init(e,t),e._zod.bag.format=`ipv4`}),Ite=W(`$ZodIPv6`,(e,t)=>{t.pattern??=Kee,Em.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Lte=W(`$ZodCIDRv4`,(e,t)=>{t.pattern??=qee,Em.init(e,t)}),Rte=W(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Jee,Em.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Dm(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var zte=W(`$ZodBase64`,(e,t)=>{t.pattern??=Yee,Em.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Dm(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Bte(e){if(!hm.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Dm(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Vte=W(`$ZodBase64URL`,(e,t)=>{t.pattern??=hm,Em.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Bte(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Hte=W(`$ZodE164`,(e,t)=>{t.pattern??=Xee,Em.init(e,t)});function Ute(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Wte=W(`$ZodJWT`,(e,t)=>{Em.init(e,t),e._zod.check=n=>{Ute(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Om=W(`$ZodNumber`,(e,t)=>{wm.init(e,t),e._zod.pattern=e._zod.bag.pattern??vm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Gte=W(`$ZodNumberFormat`,(e,t)=>{ste.init(e,t),Om.init(e,t)}),Kte=W(`$ZodBoolean`,(e,t)=>{wm.init(e,t),e._zod.pattern=nte,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),qte=W(`$ZodNull`,(e,t)=>{wm.init(e,t),e._zod.pattern=rte,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Jte=W(`$ZodAny`,(e,t)=>{wm.init(e,t),e._zod.parse=e=>e}),Yte=W(`$ZodUnknown`,(e,t)=>{wm.init(e,t),e._zod.parse=e=>e}),Xte=W(`$ZodNever`,(e,t)=>{wm.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function km(e,t,n){e.issues.length&&t.issues.push(...nm(n,e.issues)),t.value[n]=e.value}var Zte=W(`$ZodArray`,(e,t)=>{wm.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>km(t,n,e))):km(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Am(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...nm(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function jm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=pee(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Mm(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Am(e,n,i,t,u))):Am(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Qte=W(`$ZodObject`,(e,t)=>{if(wm.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Wp(()=>jm(t));qp(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Xp,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Am(n,t,e,s,r))):Am(i,t,e,s,r)}return i?Mm(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),$te=W(`$ZodObjectJIT`,(e,t)=>{Qte.init(e,t);let n=e._zod.parse,r=Wp(()=>jm(t)),i=e=>{let t=new vte([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=see(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=see(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
343
343
|
if (${n}.issues.length) {
|
|
@@ -435,7 +435,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
435
435
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);K.object({method:K.literal(`ui/open-link`),params:K.object({url:K.string().describe(`URL to open in the host's browser`)})}),K.object({isError:K.boolean().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),K.object({isError:K.boolean().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough(),K.object({method:K.literal(`ui/notifications/sandbox-proxy-ready`),params:K.object({})});var QD=K.object({connectDomains:K.array(K.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).`),resourceDomains:K.array(K.string()).optional().describe(`Origins for static resources (scripts, images, styles, fonts).`),frameDomains:K.array(K.string()).optional().describe(`Origins for nested iframes (frame-src directive).`),baseUriDomains:K.array(K.string()).optional().describe(`Allowed base URIs for the document (base-uri directive).`)}),$D=K.object({camera:K.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:K.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:K.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:K.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")});K.object({method:K.literal(`ui/notifications/size-changed`),params:K.object({width:K.number().optional().describe(`New width in pixels.`),height:K.number().optional().describe(`New height in pixels.`)})}),K.object({method:K.literal(`ui/notifications/tool-input`),params:K.object({arguments:K.record(K.string(),K.unknown().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),K.object({method:K.literal(`ui/notifications/tool-input-partial`),params:K.object({arguments:K.record(K.string(),K.unknown().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),K.object({method:K.literal(`ui/notifications/tool-cancelled`),params:K.object({reason:K.string().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var iue=K.object({fonts:K.string().optional()}),aue=K.object({variables:rue.optional().describe(`CSS variables for theming the app.`),css:iue.optional().describe(`CSS blocks that apps can inject.`)});K.object({method:K.literal(`ui/resource-teardown`),params:K.object({})}),K.record(K.string(),K.unknown());var eO=K.object({text:K.object({}).optional().describe(`Host supports text content blocks.`),image:K.object({}).optional().describe(`Host supports image content blocks.`),audio:K.object({}).optional().describe(`Host supports audio content blocks.`),resource:K.object({}).optional().describe(`Host supports resource content blocks.`),resourceLink:K.object({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:K.object({}).optional().describe(`Host supports structured content.`)}),oue=K.object({experimental:K.object({}).optional().describe(`Experimental features (structure TBD).`),openLinks:K.object({}).optional().describe(`Host supports opening external URLs.`),serverTools:K.object({listChanged:K.boolean().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:K.object({listChanged:K.boolean().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:K.object({}).optional().describe(`Host accepts log messages.`),sandbox:K.object({permissions:$D.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:QD.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:eO.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:eO.optional().describe(`Host supports receiving content messages (ui/message) from the view.`)}),sue=K.object({experimental:K.object({}).optional().describe(`Experimental features (structure TBD).`),tools:K.object({listChanged:K.boolean().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:K.array(ZD).optional().describe(`Display modes the app supports.`)});K.object({method:K.literal(`ui/notifications/initialized`),params:K.object({}).optional()}),K.object({csp:QD.optional().describe(`Content Security Policy configuration.`),permissions:$D.optional().describe(`Sandbox permissions requested by the UI.`),domain:K.string().optional().describe(`Dedicated origin for view sandbox.`),prefersBorder:K.boolean().optional().describe(`Visual boundary preference - true if UI prefers a visible border.`)}),K.object({method:K.literal(`ui/request-display-mode`),params:K.object({mode:ZD.describe(`The display mode being requested.`)})}),K.object({mode:ZD.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var cue=K.union([K.literal(`model`),K.literal(`app`)]).describe(`Tool visibility scope - who can access the tool.`);K.object({resourceUri:K.string().optional(),visibility:K.array(cue).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
436
436
|
- "model": Tool visible to and callable by the agent
|
|
437
437
|
- "app": Tool callable by the app from this server only`)}),K.object({mimeTypes:K.array(K.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),K.object({method:K.literal(`ui/message`),params:K.object({role:K.literal(`user`).describe(`Message role, currently only "user" is supported.`),content:K.array(qg).describe(`Message content blocks (text, image, etc.).`)})}),K.object({method:K.literal(`ui/notifications/sandbox-resource-ready`),params:K.object({html:K.string().describe(`HTML content to load into the inner iframe.`),sandbox:K.string().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:QD.optional().describe(`CSP configuration from resource metadata.`),permissions:$D.optional().describe(`Sandbox permissions from resource metadata.`)})}),K.object({method:K.literal(`ui/notifications/tool-result`),params:Qg.describe(`Standard MCP tool execution result.`)});var tO=K.object({toolInfo:K.object({id:Qh.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Xg.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:tue.optional().describe(`Current color theme preference.`),styles:aue.optional().describe(`Style configuration for theming the app.`),displayMode:ZD.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:K.array(ZD).optional().describe(`Display modes the host supports.`),containerDimensions:K.union([K.object({height:K.number().describe(`Fixed container height in pixels.`)}),K.object({maxHeight:K.union([K.number(),K.undefined()]).optional().describe(`Maximum container height in pixels.`)})]).and(K.union([K.object({width:K.number().describe(`Fixed container width in pixels.`)}),K.object({maxWidth:K.union([K.number(),K.undefined()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
438
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:K.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:K.string().optional().describe(`User's timezone in IANA format.`),userAgent:K.string().optional().describe(`Host application identifier.`),platform:K.union([K.literal(`web`),K.literal(`desktop`),K.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K.object({touch:K.boolean().optional().describe(`Whether the device supports touch input.`),hover:K.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K.object({top:K.number().describe(`Top safe area inset in pixels.`),right:K.number().describe(`Right safe area inset in pixels.`),bottom:K.number().describe(`Bottom safe area inset in pixels.`),left:K.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();K.object({method:K.literal(`ui/notifications/host-context-changed`),params:tO.describe(`Partial context update containing only changed fields.`)}),K.object({method:K.literal(`ui/update-model-context`),params:K.object({content:K.array(qg).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:K.record(K.string(),K.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K.object({method:K.literal(`ui/initialize`),params:K.object({appInfo:dg.describe(`App identification (name and version).`),appCapabilities:sue.describe(`Features and capabilities this app provides.`),protocolVersion:K.string().describe(`Protocol version this app supports.`)})}),K.object({protocolVersion:K.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:dg.describe(`Host application identification and version.`),hostCapabilities:oue.describe(`Features and capabilities provided by the host.`),hostContext:tO.describe(`Rich context about the host environment.`)}).passthrough();var lue=`text/html;profile=mcp-app`,uue=`modulepreload`,due=function(e){return`/inspector/`+e},nO={},J=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=due(t,n),t in nO)return;nO[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:uue,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},fue=`1.29.0-canary.20`;function rO(){return fue}a(rO,`getPackageVersion`);var iO=class{static{a(this,`BaseTelemetryEvent`)}},pue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function aO(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===lue);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(aO,`createServerRunEventData`);var mue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},hue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},gue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},_ue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},vue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},yue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},bue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},xue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},Sue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},Cue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function oO(e){return e._llm_type||e.constructor.name.toLowerCase()}a(oO,`getModelProvider`);function sO(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(sO,`getModelName`);function wue(e){return[oO(e),sO(e)]}a(wue,`extractModelInfo`);function cO(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(cO,`generateUUID`);function lO(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(lO,`secureRandomString`);var uO=`mcp_use_user_id`;function dO(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(dO,`isLocalStorageFunctional`);function fO(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(fO,`detectRuntimeEnvironment`);function pO(e){if(e===`browser`)try{if(dO())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(pO,`getStorageCapability`);var mO=null;function hO(){return mO===null&&(mO=fO()),mO}a(hO,`getRuntimeEnvironment`);var gO=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=hO(),this._storageCapability=pO(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,l.debug(`Telemetry disabled via localStorage`)):t?(l.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,l.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(dO())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||dO()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await J(()=>import(`./module-DjisYqbk.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{l.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){l.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{dO()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}l.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${cO()}`}catch{this._currUserId=`session-${Date.now()}-${lO()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!dO())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(uO);if(!e){try{e=cO()}catch{e=`${Date.now()}-${lO()}`}localStorage.setItem(uO,e)}return e}catch(e){l.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${cO()}`}catch{t=`session-${Date.now()}-${lO()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=rO(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){l.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new pue(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new mue(aO(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new hue(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new gue(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new _ue(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new vue(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new yue(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new bue(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new xue(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new Sue({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new Cue({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){l.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){l.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},_O=gO;function Tue(e){_O.getInstance().setSource(e)}a(Tue,`setTelemetrySource`);var Eue=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&l.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;gO.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>l.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){l.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{l.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],l.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){l.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){l.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){l.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(l.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(u_,async(e,t)=>(l.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){l.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){l.debug(`setupSamplingHandler: No sampling callback provided`);return}l.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(i_,async(t,n)=>(l.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),l.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){l.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){l.debug(`setupElicitationHandler: No elicitation callback provided`);return}l.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(s_,async(t,n)=>(l.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),l.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){l.debug(`Not connected to MCP implementation`);return}l.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,l.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],l.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?l.debug(`Server does not implement tools/list, assuming no tools`):l.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return l.debug(`Server capabilities:`,t),l.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},l.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),l.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return l.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return l.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return l.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{l.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return l.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return l.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return l.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return l.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return l.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;l.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;l.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&l.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},Due=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),l.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){l.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?l.debug(`${this.constructor.name} task aborted successfully`):l.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,l.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){l.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),l.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,l.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){l.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},vO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),yO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=vO(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),bO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=vO(),n=yO(),r=vO();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=yO();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
438
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:K.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:K.string().optional().describe(`User's timezone in IANA format.`),userAgent:K.string().optional().describe(`Host application identifier.`),platform:K.union([K.literal(`web`),K.literal(`desktop`),K.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K.object({touch:K.boolean().optional().describe(`Whether the device supports touch input.`),hover:K.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K.object({top:K.number().describe(`Top safe area inset in pixels.`),right:K.number().describe(`Right safe area inset in pixels.`),bottom:K.number().describe(`Bottom safe area inset in pixels.`),left:K.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();K.object({method:K.literal(`ui/notifications/host-context-changed`),params:tO.describe(`Partial context update containing only changed fields.`)}),K.object({method:K.literal(`ui/update-model-context`),params:K.object({content:K.array(qg).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:K.record(K.string(),K.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K.object({method:K.literal(`ui/initialize`),params:K.object({appInfo:dg.describe(`App identification (name and version).`),appCapabilities:sue.describe(`Features and capabilities this app provides.`),protocolVersion:K.string().describe(`Protocol version this app supports.`)})}),K.object({protocolVersion:K.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:dg.describe(`Host application identification and version.`),hostCapabilities:oue.describe(`Features and capabilities provided by the host.`),hostContext:tO.describe(`Rich context about the host environment.`)}).passthrough();var lue=`text/html;profile=mcp-app`,uue=`modulepreload`,due=function(e){return`/inspector/`+e},nO={},J=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=due(t,n),t in nO)return;nO[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:uue,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},fue=`1.29.0-canary.21`;function rO(){return fue}a(rO,`getPackageVersion`);var iO=class{static{a(this,`BaseTelemetryEvent`)}},pue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function aO(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===lue);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(aO,`createServerRunEventData`);var mue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},hue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},gue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},_ue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},vue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},yue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},bue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},xue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},Sue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},Cue=class extends iO{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function oO(e){return e._llm_type||e.constructor.name.toLowerCase()}a(oO,`getModelProvider`);function sO(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(sO,`getModelName`);function wue(e){return[oO(e),sO(e)]}a(wue,`extractModelInfo`);function cO(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(cO,`generateUUID`);function lO(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(lO,`secureRandomString`);var uO=`mcp_use_user_id`;function dO(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(dO,`isLocalStorageFunctional`);function fO(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(fO,`detectRuntimeEnvironment`);function pO(e){if(e===`browser`)try{if(dO())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(pO,`getStorageCapability`);var mO=null;function hO(){return mO===null&&(mO=fO()),mO}a(hO,`getRuntimeEnvironment`);var gO=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=hO(),this._storageCapability=pO(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,l.debug(`Telemetry disabled via localStorage`)):t?(l.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,l.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(dO())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||dO()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await J(()=>import(`./module-DjisYqbk.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{l.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){l.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{dO()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}l.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${cO()}`}catch{this._currUserId=`session-${Date.now()}-${lO()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!dO())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(uO);if(!e){try{e=cO()}catch{e=`${Date.now()}-${lO()}`}localStorage.setItem(uO,e)}return e}catch(e){l.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${cO()}`}catch{t=`session-${Date.now()}-${lO()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=rO(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){l.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new pue(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new mue(aO(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new hue(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new gue(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new _ue(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new vue(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new yue(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new bue(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new xue(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new Sue({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new Cue({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){l.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){l.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},_O=gO;function Tue(e){_O.getInstance().setSource(e)}a(Tue,`setTelemetrySource`);var Eue=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&l.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;gO.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>l.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){l.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{l.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],l.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){l.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){l.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){l.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(l.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(u_,async(e,t)=>(l.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){l.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){l.debug(`setupSamplingHandler: No sampling callback provided`);return}l.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(i_,async(t,n)=>(l.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),l.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){l.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){l.debug(`setupElicitationHandler: No elicitation callback provided`);return}l.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(s_,async(t,n)=>(l.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),l.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){l.debug(`Not connected to MCP implementation`);return}l.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,l.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],l.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?l.debug(`Server does not implement tools/list, assuming no tools`):l.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return l.debug(`Server capabilities:`,t),l.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},l.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),l.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return l.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return l.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return l.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{l.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return l.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return l.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return l.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return l.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return l.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;l.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;l.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&l.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},Due=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),l.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){l.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?l.debug(`${this.constructor.name} task aborted successfully`):l.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,l.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){l.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),l.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,l.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){l.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},vO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),yO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=vO(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),bO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=vO(),n=yO(),r=vO();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=yO();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
439
439
|
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),xO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=bO(),n=vO();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),SO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=bO();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),CO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=bO(),n=xO(),r=SO();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),Oue=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=CO(),n=bO(),r=SO(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),wO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),TO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),EO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=wO(),n=TO(),r=CO(),i=bO(),a=xO(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
440
440
|
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
441
441
|
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|
|
@@ -574,10 +574,10 @@ print(f"Available resources: {[resource.name for resource in resources]}")
|
|
|
574
574
|
`),endPos:i.end}:null}function $Z(e,t,n){XZ=0,e=hEe(e),!t.refs&&(t.refs={}),aZ(e,t.refs,n);let r=QZ(e,t,n);return t.refs&&Object.keys(t.refs).length>0?[{type:Z.refCollection,refs:t.refs},...r]:r}var XEe=/^\n+/,eQ;try{eQ=w.createElement(`div`).$$typeof}catch{eQ=Symbol.for(`react.transitional.element`)}function tQ(e,t,n){return{$$typeof:eQ,type:e,key:n==null?null:``+n,ref:null,props:t}}var ZEe=typeof w.createContext<`u`?w.createContext(void 0):void 0;function nQ(e,t,n,r,i,a,o,s){switch(e.type){case Z.blockQuote:{let i={key:n.key};return e.alert&&(i.className=`markdown-alert-`+a(e.alert.toLowerCase(),LX),e.children.unshift({attrs:{},children:[{type:Z.text,text:e.alert}],d:!0,type:Z.htmlBlock,tag:`header`})),r(`blockquote`,i,t(e.children,n))}case Z.breakLine:return r(`br`,{key:n.key});case Z.breakThematic:return r(`hr`,{key:n.key});case Z.frontmatter:return s.preserveFrontmatter?r(`pre`,{key:n.key},e.text):null;case Z.codeBlock:let m=e.lang?jX(e.lang):``;return r(`pre`,{key:n.key},r(`code`,{...AX(e.attrs||{}),className:m?`language-${m} lang-${m}`:``},e.text));case Z.codeInline:return r(`code`,{key:n.key},e.text);case Z.footnoteReference:return r(`a`,{key:n.key,href:i(e.target,`a`,`href`)||void 0},r(`sup`,{key:n.key},e.text));case Z.gfmTask:return r(`input`,{checked:e.completed,key:n.key,readOnly:!0,type:`checkbox`});case Z.heading:return r(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n));case Z.htmlBlock:{let m=e;if(s.tagfilter&&ZX(m.tag)){var c=``;if(m.attrs)for(var l in m.attrs){var u=m.attrs[l];u===!0?c+=` `+l:u!=null&&u!==!1&&(c+=` `+l+`="`+String(u)+`"`)}return r(`span`,{key:n.key},`<`+m.tag+c+`>`)}if(m.a&&m.d){let c=function(e){if((e.type===Z.htmlSelfClosing||e.type===Z.htmlBlock)&&e.b)return[];if(e.type===Z.paragraph){let t=e.children;return t?t.flatMap(c):[]}return e.type===Z.text?e.text?.trim()?[e]:[]:e.type===Z.htmlBlock&&e.children?[{...e,children:e.children?.flatMap(c)}]:[e]},l=function(e){for(var t=0;t<e.length;t++)e[t].type===Z.htmlBlock&&(e[t].d=!1),`children`in e[t]&&e[t].children&&l(e[t].children)},u=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.type===Z.paragraph&&r.children)for(var i=r.children,a=0;a<i.length;a++){var o=i[a];if(o.type===Z.htmlSelfClosing&&o.b&&o.tag.toLowerCase()===t){var s=e.slice(0,n);a>0&&s.push({type:Z.paragraph,children:i.slice(0,a)});var c=[];if(a+1<i.length){var l=i.slice(a+1);l=l.filter(function(e){return!(e.type===Z.htmlSelfClosing&&e.b)}),l.length>0&&(c=l)}return c=c.concat(e.slice(n+1)),{found:!0,beforeClose:s,afterClose:c}}}if((r.type===Z.htmlSelfClosing||r.type===Z.htmlBlock)&&r.b&&r.tag.toLowerCase()===t)return{found:!0,beforeClose:e.slice(0,n),afterClose:e.slice(n+1)}}return{found:!1,beforeClose:e,afterClose:[]}},h=m.tag.toLowerCase(),g=wEe(h),_=m.children&&m.children.length>0,v=/<[a-z][^>]{0,100}>/i.test(m.a);if(g){let t=m.a.replace(RegExp(`\\s*</`+h+`>\\s*$`,`i`),``);return s.tagfilter&&(t=QX(t)),v?r(e.tag,{key:n.key,...AX(e.attrs||{}),dangerouslySetInnerHTML:{__html:t}}):r(e.tag,{key:n.key,...AX(e.attrs||{})},t)}let y=RegExp(`^<${m.tag}(\\s|>)`,`i`).test(m.a);if(_&&!y&&s.tagfilter&&yEe(m.a))return r(e.tag,{key:n.key,...AX(e.attrs||{})},t(m.children,n));if(TEe(m.a)){let t=s.tagfilter?QX(m.a):m.a;return r(e.tag,{key:n.key,...AX(e.attrs||{}),dangerouslySetInnerHTML:{__html:t}})}let b={slugify:e=>a(e,LX),sanitizer:i,tagfilter:!0},x=m.a.replace(/>\s+</g,`><`).replace(/\n+/g,` `).trim();if(RegExp(`^<${m.tag}(\\s[^>]*)?>(\\s*</${m.tag}>)?$`,`i`).test(x))return m.children&&m.children.length>0?r(e.tag,{key:n.key,...AX(e.attrs||{})},t(m.children,n)):r(e.tag,{key:n.key,...AX(e.attrs||{})});let S=$Z(x,{inline:!1,refs:o,inHTML:!1},b);l(S);let C=m.tag.toLowerCase(),T=`</`+C+`>`,E=RegExp(`^<${m.tag}(\\s|>)`,`i`).test(x),D=x.toLowerCase().trimEnd().endsWith(T),O=E&&D;if(O&&_)return r(e.tag,{key:n.key,...AX(e.attrs||{})},t(m.children,n));if(O)return t(S.flatMap(c),n);var d=u(S,C);if(d.found&&d.afterClose.length>0){var f=d.beforeClose.flatMap(c),p=d.afterClose.flatMap(c);return tQ(w.Fragment,{children:[r(e.tag,{key:n.key,...AX(e.attrs||{})},t(f,n)),t(p,n)]},null)}return r(e.tag,{key:n.key,...AX(e.attrs||{})},t(S.flatMap(c),n))}return r(e.tag,{key:n.key,...AX(e.attrs||{})},e.children?t(e.children,n):``)}case Z.htmlSelfClosing:{let t=e;if(s.tagfilter&&ZX(t.tag)){var c=``;if(t.attrs)for(var l in t.attrs){var u=t.attrs[l];u===!0?c+=` `+l:u!=null&&u!==!1&&(c+=` `+l+`="`+String(u)+`"`)}return r(`span`,{key:n.key},`<`+t.tag+c+` />`)}return r(e.tag,{key:n.key,...AX(e.attrs||{})})}case Z.image:{let t=e.target==null?null:i(e.target,`img`,`src`);return r(`img`,{key:n.key,alt:e.alt&&e.alt.length>0?e.alt:void 0,title:e.title||void 0,src:t||void 0})}case Z.link:{let i={key:n.key};return e.target!=null&&(i.href=gEe(e.target)),e.title&&(i.title=e.title),r(`a`,i,t(e.children,n))}case Z.table:{let i=e;return r(`table`,{key:n.key},r(`thead`,null,r(`tr`,null,i.header.map(function(e,a){return r(`th`,{key:a,style:i.align[a]==null?{}:{textAlign:i.align[a]}},t(e,n))}))),r(`tbody`,null,i.cells.map(function(e,a){return r(`tr`,{key:a},e.map(function(e,a){return r(`td`,{key:a,style:i.align[a]==null?{}:{textAlign:i.align[a]}},t(e,n))}))})))}case Z.text:return e.text;case Z.textFormatted:return r(e.tag,{key:n.key},t(e.children,n));case Z.orderedList:case Z.unorderedList:return r(e.type===Z.orderedList?`ol`:`ul`,{key:n.key,start:e.type===Z.orderedList?e.start:void 0},e.items.map(function(e,i){return r(`li`,{key:i},t(e,n))}));case Z.paragraph:return r(`p`,{key:n.key},t(e.children,n));case Z.ref:return null;default:return null}}var QEe=(e,t,n,r,i,a)=>{var o=e=>e.map(function(e){return`text`in e?e.text:``}),s=(c,l={})=>{var u=(l.renderDepth||0)+1;if(u>2500)return o(c);l.renderDepth=u;for(var d=l.key,f=[],p=!1,m=0;m<c.length;m++){l.key=m;var h=e?e(nQ.bind(null,c[m],s,l,t,n,r,i,a),c[m],s,l):nQ(c[m],s,l,t,n,r,i,a),g=typeof h==`string`;if(g&&p)f[f.length-1]+=h;else if(h!==null)if(Array.isArray(h))for(var _=0;_<h.length;_++)f.push(h[_]);else f.push(h);p=g}return l.key=d,l.renderDepth=u-1,f};return s},$Ee=(e,t)=>{let n=YX(t,e,void 0);return n?typeof n==`function`||typeof n==`object`&&`render`in n?n:YX(t,`${e}.component`,e):e};function eDe(e,t){let n={...t||{}};n.overrides=n.overrides||{};let r=n.slugify||LX,i=n.sanitizer||NX,a=n.createElement,o=n.overrides&&Object.keys(n.overrides).length>0,s=e=>rQ(e,{...n,wrapper:null});function c(e,t,...r){var i=t||{};for(var c in i){var l=i[c];if(typeof l==`string`&&l.length>0&&l.charCodeAt(0)===YY&&(bEe.test(l)||xEe.test(l)||YEe(l,0))){var u=s(l.trim());i[c]=c===`innerHTML`&&Array.isArray(u)?u[0]:u}}var d=e;if(o){var f=YX(n.overrides,e+`.props`,{});d=$Ee(e,n.overrides),i={...i,...f,className:_Ee(i.className,f.className)||void 0}}if(!a){var p=i.key;return p!=null&&delete i.key,r.length===1?i.children=r[0]:r.length>1&&(i.children=r),tQ(d,i,p)}return a(d,i,...r)}let l={...n,slugify:e=>r(e,LX),sanitizer:i,tagfilter:n.tagfilter!==!1},u=e[0]&&e[0].type===Z.refCollection?e[0].refs:{},d=QEe(n.renderRule,c,i,r,u,n),f=d(e,{inline:n.forceInline,refs:u}),p=[];for(let e in u)e.charCodeAt(0)===BY&&p.push({identifier:e,footnote:u[e].target});if(p.length&&f.push(c(`footer`,{key:`footer`},p.map(function(e){let t=e.identifier.charCodeAt(0)===BY?e.identifier.slice(1):e.identifier,n=$Z(e.footnote,{inline:!0,refs:u},l);return c(`div`,{id:r(t,LX),key:e.identifier},t+`: `,d(n,{inline:!0,refs:u}))}))),n.wrapper===null)return f;let m=n.wrapper||(n.forceInline?`span`:`div`),h;if(f.length>1||n.forceWrapper)h=f;else return f.length===1?f[0]:null;var g=n.wrapperProps?{...n.wrapperProps}:{};return g.children=h,tQ(m,g,`outer`)}function rQ(e=``,t={}){let n={...t||{}};n.overrides=n.overrides||{};let r=n.slugify||LX,i=n.sanitizer||NX;function a(e){let t=n.forceInline||!n.forceBlock&&!cEe.test(e),a={...n,slugify:e=>r(e,LX),sanitizer:i,tagfilter:n.tagfilter!==!1};t||aZ(e,o,a);let s=e;if(!t){let e=s.length;for(;e>0&&(s[e-1]===`
|
|
575
575
|
`||s[e-1]===`\r`);)e--;s=s.slice(0,e),s=`${s.replace(XEe,``)}
|
|
576
576
|
|
|
577
|
-
`}if(n.optimizeForStreaming){let e=s.lastIndexOf(`<`);e!==-1&&s.slice(e).indexOf(`>`)===-1&&(s=s.slice(0,e))}return eDe($Z(t?e:s,{inline:t,refs:o},a),{...a,forceInline:t})}let o={};return a(e)}var tDe=({children:e,options:t,...n})=>{if(!(typeof w.useContext<`u`)){let r={...t,overrides:{...t?.overrides},wrapperProps:{...t?.wrapperProps,...n}};return rQ(e??``,r)}let r=w.useContext(ZEe),i=w.useMemo(()=>({...r,...t,overrides:{...r?.overrides,...t?.overrides},wrapperProps:{...r?.wrapperProps,...t?.wrapperProps,...n}}),[r,t,n]),a=e??``;return w.useMemo(()=>rQ(a,i),[a,i])},iQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,S.jsx)(`table`,{ref:n,className:H(`w-full caption-bottom text-sm`,e),...t})}));iQ.displayName=`Table`;var aQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`thead`,{ref:n,className:H(`[&_tr]:border-b`,e),...t}));aQ.displayName=`TableHeader`;var oQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`tbody`,{ref:n,className:H(`[&_tr:last-child]:border-0`,e),...t}));oQ.displayName=`TableBody`;var sQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`tr`,{ref:n,className:H(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));sQ.displayName=`TableRow`;var cQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`th`,{ref:n,className:H(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,e),...t}));cQ.displayName=`TableHead`;var lQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`td`,{ref:n,className:H(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,e),...t}));lQ.displayName=`TableCell`;function nDe({children:e,className:t}){let{prismStyle:n}=LP(),r=`text`;if(t){let e=t.match(/(?:lang(?:uage)?-)(\w+)/);r=e?e[1]:t.replace(/^(lang-|language-)\s*/,``).trim()}let[i,a]=(0,w.useState)(!1),o=String(e).trim();return(0,S.jsxs)(`div`,{className:`my-4 relative group/code bg-muted rounded-md p-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2 absolute top-0 left-0 w-full`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-mono text-muted-foreground/50 bg-transparent px-2 py-0 rounded`,children:r}),(0,S.jsx)(`button`,{className:`opacity-0 group-hover/code:opacity-100 transition-opacity text-muted-foreground hover:text-foreground text-xs flex items-center gap-1 px-2 py-1 rounded hover:bg-muted`,onClick:async()=>{await dj(o),a(!0),setTimeout(()=>a(!1),2e3)},title:`Copy code`,children:i?(0,S.jsx)(vf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})]}),(0,S.jsx)(LV,{language:r,style:n,customStyle:{margin:0,padding:`1rem`,paddingTop:`2rem`,borderRadius:`0.5rem`,fontSize:`0.875rem`,background:`var(--muted)`},className:`text-sm`,children:o})]})}function rDe({children:e}){return(0,S.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-sm font-mono`,children:e})}function iDe({children:e,className:t}){return t?(0,S.jsx)(nDe,{className:t,children:e}):(0,S.jsx)(rDe,{children:e})}function aDe({children:e}){if(typeof e==`string`){let t=e.match(/^\[([ xX])\]\s*(.*)/);if(t){let e=t[1].toLowerCase()===`x`,n=t[2];return(0,S.jsxs)(`li`,{className:`text-foreground flex items-center gap-2`,children:[(0,S.jsx)(wY,{checked:e,disabled:!0}),(0,S.jsx)(`span`,{children:n})]})}}if(Array.isArray(e)&&e.length>0){let t=e[0];if(typeof t==`string`){let n=t.match(/^\[([ xX])\]\s*(.*)/);if(n){let t=n[1].toLowerCase()===`x`,r=n[2];return(0,S.jsxs)(`li`,{className:`text-foreground flex items-center gap-2`,children:[(0,S.jsx)(wY,{checked:t,disabled:!0}),(0,S.jsxs)(`span`,{children:[r,e.slice(1)]})]})}}}return(0,S.jsx)(`li`,{className:`text-foreground`,children:e})}function uQ({content:e}){return(0,S.jsx)(tDe,{options:{overrides:{code:iDe,pre:({children:e})=>(0,S.jsx)(S.Fragment,{children:e}),h1:({children:e})=>(0,S.jsx)(`h1`,{className:`text-xl font-bold text-foreground mb-2 mt-4`,children:e}),h2:({children:e})=>(0,S.jsx)(`h2`,{className:`text-lg font-bold text-foreground mb-2 mt-4`,children:e}),h3:({children:e})=>(0,S.jsx)(`h3`,{className:`text-base font-bold text-foreground mb-2 mt-4`,children:e}),h4:({children:e})=>(0,S.jsx)(`h4`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),h5:({children:e})=>(0,S.jsx)(`h5`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),h6:({children:e})=>(0,S.jsx)(`h6`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),p:({children:e})=>(0,S.jsx)(`p`,{className:`text-foreground mb-2 leading-relaxed`,children:e}),ul:({children:e})=>(0,S.jsx)(`ul`,{className:`list-disc list-outside pl-6 mb-3 space-y-1`,children:e}),ol:({children:e})=>(0,S.jsx)(`ol`,{className:`list-decimal list-outside pl-6 mb-3 space-y-1`,children:e}),li:aDe,table:({children:e})=>(0,S.jsx)(`div`,{className:`my-4`,children:(0,S.jsx)(iQ,{children:e})}),thead:({children:e})=>(0,S.jsx)(aQ,{children:e}),tbody:({children:e})=>(0,S.jsx)(oQ,{children:e}),tr:({children:e})=>(0,S.jsx)(sQ,{children:e}),th:({children:e})=>(0,S.jsx)(cQ,{children:e}),td:({children:e})=>(0,S.jsx)(lQ,{children:e}),blockquote:({children:e})=>(0,S.jsx)(`blockquote`,{className:`border-l-4 border-muted-foreground pl-4 italic text-muted-foreground mb-3`,children:e}),a:({children:e,href:t})=>(0,S.jsx)(`a`,{href:t,className:`text-primary hover:underline`,target:`_blank`,rel:`noopener noreferrer`,children:e}),strong:({children:e})=>(0,S.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e}),em:({children:e})=>(0,S.jsx)(`em`,{className:`italic text-foreground`,children:e}),img:({src:e,alt:t})=>(0,S.jsx)(`img`,{src:e,alt:t||``,className:`max-w-full max-h-[500px] object-contain rounded-lg my-4 border border-border`,loading:`lazy`}),hr:()=>(0,S.jsx)(`hr`,{className:`my-4 border-t border-border`})}},children:e})}function oDe({text:e}){let[t,n]=(0,w.useState)(!1);return(0,S.jsx)(`button`,{className:`opacity-0 group-hover/message:opacity-100 transition-opacity text-muted-foreground hover:text-foreground text-xs flex items-center gap-1`,onClick:async()=>{await dj(e),n(!0),setTimeout(()=>n(!1),2e3)},title:`Copy message content`,children:t?(0,S.jsx)(vf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})}function dQ({content:e,timestamp:t,_isStreaming:n}){return!e||e.length===0?null:(0,S.jsx)(`div`,{className:`flex items-start gap-6 group/message relative`,"data-testid":`chat-message-assistant`,children:(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`wrap-break-word`,children:(0,S.jsx)(`div`,{className:`text-base leading-7 font-sans text-start wrap-break-word transition-all duration-300 ease-in-out`,"data-testid":`chat-message-content`,children:(0,S.jsx)(uQ,{content:e})})}),t&&(0,S.jsxs)(`div`,{className:`flex items-center justify-between mt-2`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(t).toLocaleTimeString()}),(0,S.jsx)(oDe,{text:e})]})]})})}function fQ({...e}){return(0,S.jsx)(dN,{"data-slot":`sheet`,...e})}function pQ({...e}){return(0,S.jsx)(fN,{"data-slot":`sheet-trigger`,...e})}function sDe({...e}){return(0,S.jsx)(pN,{"data-slot":`sheet-portal`,...e})}function cDe({className:e,...t}){return(0,S.jsx)(mN,{"data-slot":`sheet-overlay`,className:H(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function mQ({className:e,children:t,side:n=`right`,...r}){return(0,S.jsxs)(sDe,{children:[(0,S.jsx)(cDe,{}),(0,S.jsxs)(hN,{"data-slot":`sheet-content`,className:H(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,n===`right`&&`data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm`,n===`left`&&`data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm`,n===`top`&&`data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b`,n===`bottom`&&`data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t`,e),...r,children:[t,(0,S.jsxs)(vN,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none`,children:[(0,S.jsx)(Fp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function hQ({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sheet-header`,className:H(`flex flex-col gap-1.5 p-4`,e),...t})}function gQ({className:e,...t}){return(0,S.jsx)(gN,{"data-slot":`sheet-title`,className:H(`text-foreground font-semibold`,e),...t})}function lDe({className:e,...t}){return(0,S.jsx)(_N,{"data-slot":`sheet-description`,className:H(`text-muted-foreground text-sm`,e),...t})}function _Q({toolName:e,args:t,result:n,state:r=`result`,partialArgs:i}){let a=r===`call`&&i?i:t,o=()=>{switch(r){case`call`:return(0,S.jsx)(Zf,{className:`h-4 w-4 animate-spin text-blue-500 dark:text-blue-400`});case`result`:return(0,S.jsx)(vf,{className:`h-4 w-4 text-emerald-800 dark:text-emerald-400`});case`error`:return(0,S.jsx)(Fp,{className:`h-4 w-4 text-red-500 dark:text-red-400`});default:return(0,S.jsx)(vf,{className:`h-4 w-4 text-emerald-800 dark:text-emerald-400`})}},s=()=>{switch(r){case`call`:return` bg-blue-500/20 dark:bg-blue-500/20`;case`result`:return` bg-emerald-500/20 dark:bg-emerald-500/20`;case`error`:return` bg-red-500/20 dark:bg-red-500/20`;default:return` bg-emerald-500/20 dark:bg-emerald-500/20`}},c=e=>typeof e==`object`?zP(e).preview:String(e);return(0,S.jsxs)(fQ,{children:[(0,S.jsx)(pQ,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`flex max-w-min items-center gap-3 p-1 rounded-full border bg-card hover:bg-accent/50 transition-colors cursor-pointer my-4`,"data-testid":`chat-tool-call-${e}`,children:[(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 flex items-center justify-center shrink-0`,children:(0,S.jsx)(Pp,{className:`size-4 text-muted-foreground`})}),(0,S.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`span`,{className:`text-sm font-medium truncate`,children:[e,`(`,Object.keys(a).length>0?(0,S.jsxs)(`span`,{className:`bg-muted-foreground/20 rounded-full px-1.5 mx-1 py-0.5 text-xs`,children:[Object.keys(a).length,` args`]}):``,`)`]})})}),(0,S.jsx)(`div`,{className:H(`w-8 h-8 rounded-full flex items-center justify-center`,s()),"data-testid":`chat-tool-call-status-${r}`,children:o()})]})}),(0,S.jsxs)(mQ,{side:`right`,className:`w-[400px] sm:w-[540px] p-4 overflow-y-auto`,"data-testid":`chat-tool-drawer`,children:[(0,S.jsxs)(hQ,{children:[(0,S.jsxs)(gQ,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Pp,{className:`h-5 w-5`}),`Tool Call Details`]}),(0,S.jsxs)(lDe,{className:`flex items-center gap-2`,children:[e,` — `,r,r===`call`&&(0,S.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500 dark:text-blue-400`,children:[(0,S.jsx)(Zf,{className:`h-3 w-3 animate-spin`}),`streaming…`]})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Arguments`}),(0,S.jsxs)(`div`,{className:`relative`,"data-testid":`chat-tool-drawer-args`,children:[(0,S.jsx)(`pre`,{className:`text-xs bg-muted/50 rounded-lg p-3 overflow-x-auto border font-mono leading-relaxed max-h-48 whitespace-pre-wrap break-words`,children:c(a)}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(c(a)),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy arguments`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Result`}),(0,S.jsx)(`div`,{className:`relative`,"data-testid":`chat-tool-drawer-result`,children:typeof n==`string`?(0,S.jsxs)(`div`,{className:H(`p-3 rounded-lg border text-sm leading-relaxed max-h-48 overflow-x-auto whitespace-pre-wrap break-words max-w-full`,r===`error`?`bg-destructive/10 border-destructive/20 text-destructive-foreground`:`bg-muted/30 border-border`),children:[n.startsWith(`Error`)?(0,S.jsxs)(`div`,{className:`font-mono`,children:[(0,S.jsx)(`div`,{className:`font-semibold text-destructive mb-1`,children:`Error:`}),(0,S.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:n.replace(/^Error:\s*/,``)})]}):(0,S.jsx)(`div`,{className:`whitespace-pre-wrap font-mono break-words`,children:n}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(n),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy result`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]}):(0,S.jsxs)(`div`,{className:H(`p-3 rounded-lg border text-sm leading-relaxed max-h-96 overflow-y-auto max-w-full`,r===`error`?`bg-destructive/10 border-destructive/20 text-destructive-foreground`:`bg-muted/30 border-border`),children:[(0,S.jsx)(RV,{data:n,filename:`tool-call-${e}-result-${Date.now()}.json`}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(JSON.stringify(n,null,2)),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy result`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]})})]})]})]})]})}var vQ=(0,w.createContext)(void 0),uDe={deviceType:`desktop`,customViewport:{width:768,height:1024},cspMode:`permissive`,displayModeOverride:null,capabilities:{hover:!0,touch:!1},safeAreaInsets:{top:0,right:0,bottom:0,left:0},locale:`en-US`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,selectedProtocol:null};function dDe({children:e}){let[t,n]=(0,w.useState)({activeWidgetId:null,widgets:new Map,playground:uDe}),r=(0,w.useCallback)(e=>{n(t=>({...t,activeWidgetId:e}))},[]),i=(0,w.useCallback)((e,t)=>{n(n=>{if(n.widgets.has(e))return n;let r=new Map(n.widgets);return r.set(e,{...t,cspViolations:[]}),{...n,widgets:r}})},[]),a=(0,w.useCallback)(e=>{n(t=>{let n=new Map(t.widgets);return n.delete(e),{...t,widgets:n,activeWidgetId:t.activeWidgetId===e?null:t.activeWidgetId}})},[]),o=(0,w.useRef)(t);o.current=t;let s=(0,w.useCallback)(e=>o.current.widgets.get(e),[]),c=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i={cspViolations:[...r.cspViolations,t]};t.originalPolicy&&r.effectivePolicy===void 0&&(i.effectivePolicy=t.originalPolicy);let a=new Map(n.widgets);return a.set(e,{...r,...i}),{...n,widgets:a}})},[]),l=(0,w.useCallback)(e=>{n(t=>{let n=t.widgets.get(e);if(!n)return t;let r=new Map(t.widgets);return r.set(e,{...n,cspViolations:[]}),{...t,widgets:r}})},[]),u=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,modelContext:t}),{...n,widgets:i}})},[]),d=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,widgetState:t}),{...n,widgets:i}})},[]),f=(0,w.useCallback)((e,t,r)=>{n(n=>{let i=n.widgets.get(e);if(!i)return n;let a=new Map(n.widgets);return a.set(e,{...i,declaredCsp:t,...r!==void 0&&{effectivePolicy:r}}),{...n,widgets:a}})},[]),p=(0,w.useCallback)(e=>{n(t=>({...t,playground:{...t.playground,...e}}))},[]),m=(0,w.useCallback)(()=>{n(e=>({...e,widgets:new Map,activeWidgetId:null}))},[]),h=(0,w.useCallback)(()=>{let e=new Map;for(let[n,r]of t.widgets)r.modelContext&&e.set(n,r.modelContext);return e},[t.widgets]);return(0,S.jsx)(vQ,{value:(0,w.useMemo)(()=>({...t,setActiveWidget:r,addWidget:i,removeWidget:a,getWidget:s,addCspViolation:c,clearCspViolations:l,setWidgetModelContext:u,setWidgetState:d,setWidgetDeclaredCsp:f,updatePlaygroundSettings:p,clearAllWidgets:m,getAllModelContexts:h}),[t,r,i,a,s,c,l,u,d,f,p,m,h]),children:e})}function yQ(){let e=(0,w.use)(vQ);if(!e)throw Error(`useWidgetDebug must be used within WidgetDebugProvider`);return e}var bQ={mobile:{width:390,height:844,name:`iPhone 14`},tablet:{width:820,height:1180,name:`iPad Air`},desktop:{width:1440,height:900,name:`Desktop`},custom:{width:768,height:1024,name:`Custom`}};function xQ(e){let t=e?.ui?.resourceUri&&typeof e.ui.resourceUri==`string`,n=e?.[`openai/outputTemplate`]&&typeof e[`openai/outputTemplate`]==`string`;return t&&n}function SQ(e,t){return xQ(e)?`both`:e?.ui?.resourceUri&&typeof e.ui.resourceUri==`string`?`mcp-apps`:e?.[`openai/outputTemplate`]&&typeof e[`openai/outputTemplate`]==`string`?`chatgpt-app`:fDe(t)?`mcp-ui`:null}function fDe(e){return!e?.content||!Array.isArray(e.content)?!1:e.content.some(e=>{if(e.type!==`resource`||!e.resource?.uri)return!1;let t=e.resource.uri,n=e.resource.mimeType;return!(!t.startsWith(`ui://`)||n===`text/html+skybridge`||n===`text/html;profile=mcp-app`)})}function CQ(e,t){return e===`mcp-apps`?t?.ui?.resourceUri||null:e===`chatgpt-app`&&t?.[`openai/outputTemplate`]||null}var pDe=Object.defineProperty,wQ=(e,t)=>{for(var n in t)pDe(e,n,{get:t[n],enumerable:!0,configurable:!0,set:e=>t[n]=()=>e})},TQ=`2026-01-26`,Q={};wQ(Q,{xor:()=>HAe,xid:()=>O8,void:()=>IAe,uuidv7:()=>p8,uuidv6:()=>f8,uuidv4:()=>d8,uuid:()=>u8,util:()=>NQ,url:()=>h8,uppercase:()=>h3,unknown:()=>C5,union:()=>M5,undefined:()=>v5,ulid:()=>E8,uint64:()=>m5,uint32:()=>s5,tuple:()=>R5,trim:()=>C3,treeifyError:()=>S$,transform:()=>J5,toUpperCase:()=>T3,toLowerCase:()=>w3,toJSONSchema:()=>O6,templateLiteral:()=>tje,symbol:()=>g5,superRefine:()=>w7,success:()=>QAe,stringbool:()=>cje,stringFormat:()=>X8,string:()=>r8,strictObject:()=>BAe,startsWith:()=>_3,slugify:()=>E3,size:()=>l3,setErrorMap:()=>fje,set:()=>qAe,safeParseAsync:()=>G6,safeParse:()=>W6,safeEncodeAsync:()=>Q6,safeEncode:()=>X6,safeDecodeAsync:()=>$6,safeDecode:()=>Z6,registry:()=>Z2,regexes:()=>V$,regex:()=>p3,refine:()=>C7,record:()=>B5,readonly:()=>h7,property:()=>y3,promise:()=>nje,prettifyError:()=>w$,preprocess:()=>uje,prefault:()=>i7,positive:()=>n3,pipe:()=>f7,partialRecord:()=>WAe,parseAsync:()=>U6,parse:()=>H6,overwrite:()=>x3,optional:()=>X5,object:()=>zAe,number:()=>t5,nullish:()=>ZAe,nullable:()=>e7,null:()=>b5,normalize:()=>S3,nonpositive:()=>i3,nonoptional:()=>o7,nonnegative:()=>a3,never:()=>T5,negative:()=>r3,nativeEnum:()=>JAe,nanoid:()=>b8,nan:()=>$Ae,multipleOf:()=>o3,minSize:()=>c3,minLength:()=>d3,mime:()=>b3,meta:()=>oje,maxSize:()=>s3,maxLength:()=>u3,map:()=>KAe,mac:()=>P8,lte:()=>$4,lt:()=>Q4,lowercase:()=>m3,looseRecord:()=>GAe,looseObject:()=>VAe,locales:()=>L2,literal:()=>YAe,length:()=>f3,lazy:()=>v7,ksuid:()=>A8,keyof:()=>RAe,jwt:()=>J8,json:()=>lje,iso:()=>j6,ipv6:()=>I8,ipv4:()=>M8,intersection:()=>I5,int64:()=>p5,int32:()=>o5,int:()=>r5,instanceof:()=>sje,includes:()=>g3,httpUrl:()=>g8,hostname:()=>Z8,hex:()=>Q8,hash:()=>$8,guid:()=>c8,gte:()=>t3,gt:()=>e3,globalRegistry:()=>Q2,getErrorMap:()=>pje,function:()=>x7,fromJSONSchema:()=>yje,formatError:()=>x$,float64:()=>a5,float32:()=>i5,flattenError:()=>b$,file:()=>XAe,exactOptional:()=>Q5,enum:()=>W5,endsWith:()=>v3,encodeAsync:()=>J6,encode:()=>K6,emoji:()=>v8,email:()=>o8,e164:()=>K8,discriminatedUnion:()=>UAe,describe:()=>aje,decodeAsync:()=>Y6,decode:()=>q6,date:()=>LAe,custom:()=>ije,cuid2:()=>w8,cuid:()=>S8,core:()=>EQ,config:()=>MQ,coerce:()=>bje,codec:()=>eje,clone:()=>t$,cidrv6:()=>B8,cidrv4:()=>R8,check:()=>rje,catch:()=>l7,boolean:()=>l5,bigint:()=>d5,base64url:()=>W8,base64:()=>H8,array:()=>k5,any:()=>FAe,_function:()=>x7,_default:()=>n7,_ZodString:()=>t8,ZodXor:()=>N5,ZodXID:()=>D8,ZodVoid:()=>E5,ZodUnknown:()=>S5,ZodUnion:()=>j5,ZodUndefined:()=>_5,ZodUUID:()=>l8,ZodURL:()=>m8,ZodULID:()=>T8,ZodType:()=>e8,ZodTuple:()=>L5,ZodTransform:()=>q5,ZodTemplateLiteral:()=>g7,ZodSymbol:()=>h5,ZodSuccess:()=>s7,ZodStringFormat:()=>i8,ZodString:()=>n8,ZodSet:()=>H5,ZodRecord:()=>z5,ZodRealError:()=>V6,ZodReadonly:()=>m7,ZodPromise:()=>y7,ZodPrefault:()=>r7,ZodPipe:()=>d7,ZodOptional:()=>Y5,ZodObject:()=>A5,ZodNumberFormat:()=>n5,ZodNumber:()=>e5,ZodNullable:()=>$5,ZodNull:()=>y5,ZodNonOptional:()=>a7,ZodNever:()=>w5,ZodNanoID:()=>y8,ZodNaN:()=>u7,ZodMap:()=>V5,ZodMAC:()=>N8,ZodLiteral:()=>G5,ZodLazy:()=>_7,ZodKSUID:()=>k8,ZodJWT:()=>q8,ZodIssueCode:()=>dje,ZodIntersection:()=>F5,ZodISOTime:()=>I6,ZodISODuration:()=>R6,ZodISODateTime:()=>M6,ZodISODate:()=>P6,ZodIPv6:()=>F8,ZodIPv4:()=>j8,ZodGUID:()=>s8,ZodFunction:()=>b7,ZodFirstPartyTypeKind:()=>mje,ZodFile:()=>K5,ZodExactOptional:()=>Z5,ZodError:()=>PAe,ZodEnum:()=>U5,ZodEmoji:()=>_8,ZodEmail:()=>a8,ZodE164:()=>G8,ZodDiscriminatedUnion:()=>P5,ZodDefault:()=>t7,ZodDate:()=>D5,ZodCustomStringFormat:()=>Y8,ZodCustom:()=>S7,ZodCodec:()=>p7,ZodCatch:()=>c7,ZodCUID2:()=>C8,ZodCUID:()=>x8,ZodCIDRv6:()=>z8,ZodCIDRv4:()=>L8,ZodBoolean:()=>c5,ZodBigIntFormat:()=>f5,ZodBigInt:()=>u5,ZodBase64URL:()=>U8,ZodBase64:()=>V8,ZodArray:()=>O5,ZodAny:()=>x5,TimePrecision:()=>w4,NEVER:()=>DQ,$output:()=>J2,$input:()=>Y2,$brand:()=>OQ});var EQ={};wQ(EQ,{version:()=>Y1,util:()=>NQ,treeifyError:()=>S$,toJSONSchema:()=>O6,toDotPath:()=>C$,safeParseAsync:()=>M$,safeParse:()=>A$,safeEncodeAsync:()=>KDe,safeEncode:()=>WDe,safeDecodeAsync:()=>qDe,safeDecode:()=>GDe,registry:()=>Z2,regexes:()=>V$,process:()=>R3,prettifyError:()=>w$,parseAsync:()=>O$,parse:()=>E$,meta:()=>P3,locales:()=>L2,isValidJWT:()=>w0,isValidBase64URL:()=>x0,isValidBase64:()=>y0,initializeContext:()=>L3,globalRegistry:()=>Q2,globalConfig:()=>jQ,formatError:()=>x$,flattenError:()=>b$,finalize:()=>B3,extractDefs:()=>z3,encodeAsync:()=>HDe,encode:()=>BDe,describe:()=>N3,decodeAsync:()=>UDe,decode:()=>VDe,createToJSONSchemaMethod:()=>H3,createStandardJSONSchemaMethod:()=>U3,config:()=>MQ,clone:()=>t$,_xor:()=>sAe,_xid:()=>p4,_void:()=>J4,_uuidv7:()=>o4,_uuidv6:()=>a4,_uuidv4:()=>i4,_uuid:()=>r4,_url:()=>s4,_uppercase:()=>h3,_unknown:()=>K4,_union:()=>oAe,_undefined:()=>U4,_ulid:()=>f4,_uint64:()=>V4,_uint32:()=>F4,_tuple:()=>uAe,_trim:()=>C3,_transform:()=>_Ae,_toUpperCase:()=>T3,_toLowerCase:()=>w3,_templateLiteral:()=>EAe,_symbol:()=>H4,_superRefine:()=>j3,_success:()=>SAe,_stringbool:()=>F3,_stringFormat:()=>I3,_string:()=>$2,_startsWith:()=>_3,_slugify:()=>E3,_size:()=>l3,_set:()=>pAe,_safeParseAsync:()=>j$,_safeParse:()=>k$,_safeEncodeAsync:()=>z$,_safeEncode:()=>L$,_safeDecodeAsync:()=>B$,_safeDecode:()=>R$,_regex:()=>p3,_refine:()=>A3,_record:()=>dAe,_readonly:()=>TAe,_property:()=>y3,_promise:()=>OAe,_positive:()=>n3,_pipe:()=>wAe,_parseAsync:()=>D$,_parse:()=>T$,_overwrite:()=>x3,_optional:()=>vAe,_number:()=>k4,_nullable:()=>yAe,_null:()=>W4,_normalize:()=>S3,_nonpositive:()=>i3,_nonoptional:()=>xAe,_nonnegative:()=>a3,_never:()=>q4,_negative:()=>r3,_nativeEnum:()=>hAe,_nanoid:()=>l4,_nan:()=>Z4,_multipleOf:()=>o3,_minSize:()=>c3,_minLength:()=>d3,_min:()=>t3,_mime:()=>b3,_maxSize:()=>s3,_maxLength:()=>u3,_max:()=>$4,_map:()=>fAe,_mac:()=>_4,_lte:()=>$4,_lt:()=>Q4,_lowercase:()=>m3,_literal:()=>gAe,_length:()=>f3,_lazy:()=>DAe,_ksuid:()=>m4,_jwt:()=>C4,_isoTime:()=>D4,_isoDuration:()=>O4,_isoDateTime:()=>T4,_isoDate:()=>E4,_ipv6:()=>g4,_ipv4:()=>h4,_intersection:()=>lAe,_int64:()=>B4,_int32:()=>P4,_int:()=>j4,_includes:()=>g3,_guid:()=>n4,_gte:()=>t3,_gt:()=>e3,_float64:()=>N4,_float32:()=>M4,_file:()=>O3,_enum:()=>mAe,_endsWith:()=>v3,_encodeAsync:()=>F$,_encode:()=>N$,_emoji:()=>c4,_email:()=>t4,_e164:()=>S4,_discriminatedUnion:()=>cAe,_default:()=>bAe,_decodeAsync:()=>I$,_decode:()=>P$,_date:()=>Y4,_custom:()=>k3,_cuid2:()=>d4,_cuid:()=>u4,_coercedString:()=>e4,_coercedNumber:()=>A4,_coercedDate:()=>X4,_coercedBoolean:()=>L4,_coercedBigint:()=>z4,_cidrv6:()=>y4,_cidrv4:()=>v4,_check:()=>M3,_catch:()=>CAe,_boolean:()=>I4,_bigint:()=>R4,_base64url:()=>x4,_base64:()=>b4,_array:()=>D3,_any:()=>G4,TimePrecision:()=>w4,NEVER:()=>DQ,JSONSchemaGenerator:()=>MAe,JSONSchema:()=>NAe,Doc:()=>J1,$output:()=>J2,$input:()=>Y2,$constructor:()=>$,$brand:()=>OQ,$ZodXor:()=>X0,$ZodXID:()=>c0,$ZodVoid:()=>R0,$ZodUnknown:()=>I0,$ZodUnion:()=>J0,$ZodUndefined:()=>N0,$ZodUUID:()=>e0,$ZodURL:()=>n0,$ZodULID:()=>s0,$ZodType:()=>X1,$ZodTuple:()=>t2,$ZodTransform:()=>d2,$ZodTemplateLiteral:()=>j2,$ZodSymbol:()=>M0,$ZodSuccess:()=>x2,$ZodStringFormat:()=>Q1,$ZodString:()=>Z1,$ZodSet:()=>o2,$ZodRegistry:()=>X2,$ZodRecord:()=>r2,$ZodRealError:()=>y$,$ZodReadonly:()=>k2,$ZodPromise:()=>N2,$ZodPrefault:()=>v2,$ZodPipe:()=>w2,$ZodOptional:()=>p2,$ZodObjectJIT:()=>K0,$ZodObject:()=>G0,$ZodNumberFormat:()=>O0,$ZodNumber:()=>D0,$ZodNullable:()=>h2,$ZodNull:()=>P0,$ZodNonOptional:()=>y2,$ZodNever:()=>L0,$ZodNanoID:()=>i0,$ZodNaN:()=>C2,$ZodMap:()=>i2,$ZodMAC:()=>g0,$ZodLiteral:()=>l2,$ZodLazy:()=>P2,$ZodKSUID:()=>l0,$ZodJWT:()=>T0,$ZodIntersection:()=>Q0,$ZodISOTime:()=>f0,$ZodISODuration:()=>p0,$ZodISODateTime:()=>u0,$ZodISODate:()=>d0,$ZodIPv6:()=>h0,$ZodIPv4:()=>m0,$ZodGUID:()=>$1,$ZodFunction:()=>M2,$ZodFile:()=>u2,$ZodExactOptional:()=>m2,$ZodError:()=>v$,$ZodEnum:()=>c2,$ZodEncodeError:()=>AQ,$ZodEmoji:()=>r0,$ZodEmail:()=>t0,$ZodE164:()=>C0,$ZodDiscriminatedUnion:()=>Z0,$ZodDefault:()=>g2,$ZodDate:()=>z0,$ZodCustomStringFormat:()=>E0,$ZodCustom:()=>F2,$ZodCodec:()=>E2,$ZodCheckUpperCase:()=>B1,$ZodCheckStringFormat:()=>L1,$ZodCheckStartsWith:()=>H1,$ZodCheckSizeEquals:()=>N1,$ZodCheckRegex:()=>R1,$ZodCheckProperty:()=>G1,$ZodCheckOverwrite:()=>q1,$ZodCheckNumberFormat:()=>k1,$ZodCheckMultipleOf:()=>O1,$ZodCheckMinSize:()=>M1,$ZodCheckMinLength:()=>F1,$ZodCheckMimeType:()=>K1,$ZodCheckMaxSize:()=>j1,$ZodCheckMaxLength:()=>P1,$ZodCheckLowerCase:()=>z1,$ZodCheckLessThan:()=>E1,$ZodCheckLengthEquals:()=>I1,$ZodCheckIncludes:()=>V1,$ZodCheckGreaterThan:()=>D1,$ZodCheckEndsWith:()=>U1,$ZodCheckBigIntFormat:()=>A1,$ZodCheck:()=>w1,$ZodCatch:()=>S2,$ZodCUID2:()=>o0,$ZodCUID:()=>a0,$ZodCIDRv6:()=>v0,$ZodCIDRv4:()=>_0,$ZodBoolean:()=>k0,$ZodBigIntFormat:()=>j0,$ZodBigInt:()=>A0,$ZodBase64URL:()=>S0,$ZodBase64:()=>b0,$ZodAsyncError:()=>kQ,$ZodArray:()=>V0,$ZodAny:()=>F0});var DQ=Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var OQ=Symbol(`zod_brand`),kQ=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},AQ=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},jQ={};function MQ(e){return e&&Object.assign(jQ,e),jQ}var NQ={};wQ(NQ,{unwrapMessage:()=>l$,uint8ArrayToHex:()=>RDe,uint8ArrayToBase64url:()=>IDe,uint8ArrayToBase64:()=>g$,stringifyPrimitive:()=>r$,slugify:()=>KQ,shallowClone:()=>ZQ,safeExtend:()=>ADe,required:()=>NDe,randomString:()=>CDe,propertyKeyTypes:()=>QQ,promiseAllObject:()=>SDe,primitiveTypes:()=>$Q,prefixIssues:()=>c$,pick:()=>DDe,partial:()=>MDe,parsedType:()=>p$,optionalKeys:()=>i$,omit:()=>ODe,objectClone:()=>yDe,numKeys:()=>wDe,nullish:()=>RQ,normalizeParams:()=>n$,mergeDefs:()=>WQ,merge:()=>jDe,jsonStringifyReplacer:()=>IQ,joinValues:()=>FQ,issue:()=>m$,isPlainObject:()=>XQ,isObject:()=>JQ,hexToUint8Array:()=>LDe,getSizableOrigin:()=>d$,getParsedType:()=>TDe,getLengthableOrigin:()=>f$,getEnumValues:()=>PQ,getElementAtPath:()=>xDe,floatSafeRemainder:()=>BQ,finalizeIssue:()=>u$,extend:()=>kDe,escapeRegex:()=>e$,esc:()=>GQ,defineLazy:()=>HQ,createTransparentProxy:()=>EDe,cloneDef:()=>bDe,clone:()=>t$,cleanRegex:()=>zQ,cleanEnum:()=>PDe,captureStackTrace:()=>qQ,cached:()=>LQ,base64urlToUint8Array:()=>FDe,base64ToUint8Array:()=>h$,assignProp:()=>UQ,assertNotEqual:()=>hDe,assertNever:()=>_De,assertIs:()=>gDe,assertEqual:()=>mDe,assert:()=>vDe,allowsEval:()=>YQ,aborted:()=>s$,NUMBER_FORMAT_RANGES:()=>a$,Class:()=>zDe,BIGINT_FORMAT_RANGES:()=>o$});function mDe(e){return e}function hDe(e){return e}function gDe(e){}function _De(e){throw Error(`Unexpected value in exhaustive check`)}function vDe(e){}function PQ(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function FQ(e,t=`|`){return e.map(e=>r$(e)).join(t)}function IQ(e,t){return typeof t==`bigint`?t.toString():t}function LQ(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function RQ(e){return e==null}function zQ(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function BQ(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var VQ=Symbol(`evaluating`);function HQ(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==VQ)return r===void 0&&(r=VQ,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function yDe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function UQ(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function WQ(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function bDe(e){return WQ(e._zod.def)}function xDe(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function SDe(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function CDe(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function GQ(e){return JSON.stringify(e)}function KQ(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var qQ=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function JQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var YQ=LQ(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function XQ(e){if(JQ(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(JQ(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ZQ(e){return XQ(e)?{...e}:Array.isArray(e)?[...e]:e}function wDe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var TDe=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},QQ=new Set([`string`,`number`,`symbol`]),$Q=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function e$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t$(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function n$(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function EDe(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function r$(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function i$(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var a$={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},o$={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function DDe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return t$(e,WQ(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return UQ(this,`shape`,e),e},checks:[]}))}function ODe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return t$(e,WQ(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return UQ(this,`shape`,r),r},checks:[]}))}function kDe(e,t){if(!XQ(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return t$(e,WQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return UQ(this,`shape`,n),n}}))}function ADe(e,t){if(!XQ(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return t$(e,WQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return UQ(this,`shape`,n),n}}))}function jDe(e,t){return t$(e,WQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return UQ(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function MDe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return t$(t,WQ(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return UQ(this,`shape`,i),i},checks:[]}))}function NDe(e,t,n){return t$(t,WQ(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return UQ(this,`shape`,i),i}}))}function s$(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function c$(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function l$(e){return typeof e==`string`?e:e?.message}function u$(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=l$(e.inst?._zod.def?.error?.(e))??l$(t?.error?.(e))??l$(n.customError?.(e))??l$(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,!t?.reportInput&&delete r.input,r}function d$(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function f$(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function p$(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function m$(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function PDe(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function h$(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function g$(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function FDe(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return h$(t+`=`.repeat((4-t.length%4)%4))}function IDe(e){return g$(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function LDe(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function RDe(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var zDe=class{constructor(...e){}},_$=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,IQ,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},v$=$(`$ZodError`,_$),y$=$(`$ZodError`,_$,{Parent:Error});function b$(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function x$(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function S$(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function C$(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function w$(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${C$(e.path)}`);return t.join(`
|
|
578
|
-
`)}var T$=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new kQ;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>u$(e,a,MQ())));throw qQ(t,i?.callee),t}return o.value},E$=T$(y$),D$=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>u$(e,a,MQ())));throw qQ(t,i?.callee),t}return o.value},O$=D$(y$),k$=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new kQ;return a.issues.length?{success:!1,error:new(e??v$)(a.issues.map(e=>u$(e,i,MQ())))}:{success:!0,data:a.value}},A$=k$(y$),j$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>u$(e,i,MQ())))}:{success:!0,data:a.value}},M$=j$(y$),N$=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return T$(e)(t,n,i)},BDe=N$(y$),P$=e=>(t,n,r)=>T$(e)(t,n,r),VDe=P$(y$),F$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return D$(e)(t,n,i)},HDe=F$(y$),I$=e=>async(t,n,r)=>D$(e)(t,n,r),UDe=I$(y$),L$=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return k$(e)(t,n,i)},WDe=L$(y$),R$=e=>(t,n,r)=>k$(e)(t,n,r),GDe=R$(y$),z$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return j$(e)(t,n,i)},KDe=z$(y$),B$=e=>async(t,n,r)=>j$(e)(t,n,r),qDe=B$(y$),V$={};wQ(V$,{xid:()=>G$,uuid7:()=>ZDe,uuid6:()=>XDe,uuid4:()=>YDe,uuid:()=>X$,uppercase:()=>x1,unicodeEmail:()=>Q$,undefined:()=>y1,ulid:()=>W$,time:()=>d1,string:()=>p1,sha512_hex:()=>vOe,sha512_base64url:()=>bOe,sha512_base64:()=>yOe,sha384_hex:()=>hOe,sha384_base64url:()=>_Oe,sha384_base64:()=>gOe,sha256_hex:()=>fOe,sha256_base64url:()=>mOe,sha256_base64:()=>pOe,sha1_hex:()=>lOe,sha1_base64url:()=>dOe,sha1_base64:()=>uOe,rfc5322Email:()=>$De,number:()=>g1,null:()=>v1,nanoid:()=>q$,md5_hex:()=>oOe,md5_base64url:()=>cOe,md5_base64:()=>sOe,mac:()=>n1,lowercase:()=>b1,ksuid:()=>K$,ipv6:()=>t1,ipv4:()=>e1,integer:()=>h1,idnEmail:()=>eOe,html5Email:()=>QDe,hostname:()=>rOe,hex:()=>aOe,guid:()=>Y$,extendedDuration:()=>JDe,emoji:()=>$$,email:()=>Z$,e164:()=>s1,duration:()=>J$,domain:()=>iOe,datetime:()=>f1,date:()=>l1,cuid2:()=>U$,cuid:()=>H$,cidrv6:()=>i1,cidrv4:()=>r1,browserEmail:()=>tOe,boolean:()=>_1,bigint:()=>m1,base64url:()=>o1,base64:()=>a1});var H$=/^[cC][^\s-]{8,}$/,U$=/^[0-9a-z]+$/,W$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G$=/^[0-9a-vA-V]{20}$/,K$=/^[A-Za-z0-9]{27}$/,q$=/^[a-zA-Z0-9_-]{21}$/,J$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,JDe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Y$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,X$=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,YDe=X$(4),XDe=X$(6),ZDe=X$(7),Z$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,QDe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$De=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Q$=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,eOe=Q$,tOe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,nOe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function $$(){return new RegExp(nOe,`u`)}var e1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,t1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,n1=e=>{let t=e$(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},r1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,i1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o1=/^[A-Za-z0-9_-]*$/,rOe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,iOe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,s1=/^\+[1-9]\d{6,14}$/,c1=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,l1=RegExp(`^${c1}$`);function u1(e){return typeof e.precision==`number`?e.precision===-1?`(?:[01]\\d|2[0-3]):[0-5]\\d`:e.precision===0?`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`:`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:`(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?`}function d1(e){return RegExp(`^${u1(e)}$`)}function f1(e){let t=u1({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${c1}T(?:${r})$`)}var p1=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},m1=/^-?\d+n?$/,h1=/^-?\d+$/,g1=/^-?\d+(?:\.\d+)?$/,_1=/^(?:true|false)$/i,v1=/^null$/i,y1=/^undefined$/i,b1=/^[^A-Z]*$/,x1=/^[^a-z]*$/,aOe=/^[0-9a-fA-F]*$/;function S1(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function C1(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var oOe=/^[0-9a-fA-F]{32}$/,sOe=S1(22,`==`),cOe=C1(22),lOe=/^[0-9a-fA-F]{40}$/,uOe=S1(27,`=`),dOe=C1(27),fOe=/^[0-9a-fA-F]{64}$/,pOe=S1(43,`=`),mOe=C1(43),hOe=/^[0-9a-fA-F]{96}$/,gOe=S1(64,``),_Oe=C1(64),vOe=/^[0-9a-fA-F]{128}$/,yOe=S1(86,`==`),bOe=C1(86),w1=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),T1={number:`number`,bigint:`bigint`,object:`date`},E1=$(`$ZodCheckLessThan`,(e,t)=>{w1.init(e,t);let n=T1[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),D1=$(`$ZodCheckGreaterThan`,(e,t)=>{w1.init(e,t);let n=T1[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),O1=$(`$ZodCheckMultipleOf`,(e,t)=>{w1.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):BQ(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),k1=$(`$ZodCheckNumberFormat`,(e,t)=>{w1.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=a$[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=h1)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),A1=$(`$ZodCheckBigIntFormat`,(e,t)=>{w1.init(e,t);let[n,r]=o$[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),j1=$(`$ZodCheckMaxSize`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:d$(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),M1=$(`$ZodCheckMinSize`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:d$(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),N1=$(`$ZodCheckSizeEquals`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:d$(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),P1=$(`$ZodCheckMaxLength`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=f$(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),F1=$(`$ZodCheckMinLength`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=f$(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),I1=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;w1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!RQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=f$(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),L1=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;w1.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),R1=$(`$ZodCheckRegex`,(e,t)=>{L1.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),z1=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=b1,L1.init(e,t)}),B1=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=x1,L1.init(e,t)}),V1=$(`$ZodCheckIncludes`,(e,t)=>{w1.init(e,t);let n=e$(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),H1=$(`$ZodCheckStartsWith`,(e,t)=>{w1.init(e,t);let n=RegExp(`^${e$(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),U1=$(`$ZodCheckEndsWith`,(e,t)=>{w1.init(e,t);let n=RegExp(`.*${e$(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function W1(e,t,n){e.issues.length&&t.issues.push(...c$(n,e.issues))}var G1=$(`$ZodCheckProperty`,(e,t)=>{w1.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>W1(n,e,t.property));W1(n,e,t.property)}}),K1=$(`$ZodCheckMimeType`,(e,t)=>{w1.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),q1=$(`$ZodCheckOverwrite`,(e,t)=>{w1.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),J1=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
577
|
+
`}if(n.optimizeForStreaming){let e=s.lastIndexOf(`<`);e!==-1&&s.slice(e).indexOf(`>`)===-1&&(s=s.slice(0,e))}return eDe($Z(t?e:s,{inline:t,refs:o},a),{...a,forceInline:t})}let o={};return a(e)}var tDe=({children:e,options:t,...n})=>{if(!(typeof w.useContext<`u`)){let r={...t,overrides:{...t?.overrides},wrapperProps:{...t?.wrapperProps,...n}};return rQ(e??``,r)}let r=w.useContext(ZEe),i=w.useMemo(()=>({...r,...t,overrides:{...r?.overrides,...t?.overrides},wrapperProps:{...r?.wrapperProps,...t?.wrapperProps,...n}}),[r,t,n]),a=e??``;return w.useMemo(()=>rQ(a,i),[a,i])},iQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,S.jsx)(`table`,{ref:n,className:H(`w-full caption-bottom text-sm`,e),...t})}));iQ.displayName=`Table`;var aQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`thead`,{ref:n,className:H(`[&_tr]:border-b`,e),...t}));aQ.displayName=`TableHeader`;var oQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`tbody`,{ref:n,className:H(`[&_tr:last-child]:border-0`,e),...t}));oQ.displayName=`TableBody`;var sQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`tr`,{ref:n,className:H(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));sQ.displayName=`TableRow`;var cQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`th`,{ref:n,className:H(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,e),...t}));cQ.displayName=`TableHead`;var lQ=w.forwardRef(({className:e,...t},n)=>(0,S.jsx)(`td`,{ref:n,className:H(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,e),...t}));lQ.displayName=`TableCell`;function nDe({children:e,className:t}){let{prismStyle:n}=LP(),r=`text`;if(t){let e=t.match(/(?:lang(?:uage)?-)(\w+)/);r=e?e[1]:t.replace(/^(lang-|language-)\s*/,``).trim()}let[i,a]=(0,w.useState)(!1),o=String(e).trim();return(0,S.jsxs)(`div`,{className:`my-4 relative group/code bg-muted rounded-md p-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2 absolute top-0 left-0 w-full`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-mono text-muted-foreground/50 bg-transparent px-2 py-0 rounded`,children:r}),(0,S.jsx)(`button`,{className:`opacity-0 group-hover/code:opacity-100 transition-opacity text-muted-foreground hover:text-foreground text-xs flex items-center gap-1 px-2 py-1 rounded hover:bg-muted`,onClick:async()=>{await dj(o),a(!0),setTimeout(()=>a(!1),2e3)},title:`Copy code`,children:i?(0,S.jsx)(vf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})]}),(0,S.jsx)(LV,{language:r,style:n,customStyle:{margin:0,padding:`1rem`,paddingTop:`2rem`,borderRadius:`0.5rem`,fontSize:`0.875rem`,background:`var(--muted)`},className:`text-sm`,children:o})]})}function rDe({children:e}){return(0,S.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-sm font-mono`,children:e})}function iDe({children:e,className:t}){return t?(0,S.jsx)(nDe,{className:t,children:e}):(0,S.jsx)(rDe,{children:e})}function aDe({children:e}){if(typeof e==`string`){let t=e.match(/^\[([ xX])\]\s*(.*)/);if(t){let e=t[1].toLowerCase()===`x`,n=t[2];return(0,S.jsxs)(`li`,{className:`text-foreground flex items-center gap-2`,children:[(0,S.jsx)(wY,{checked:e,disabled:!0}),(0,S.jsx)(`span`,{children:n})]})}}if(Array.isArray(e)&&e.length>0){let t=e[0];if(typeof t==`string`){let n=t.match(/^\[([ xX])\]\s*(.*)/);if(n){let t=n[1].toLowerCase()===`x`,r=n[2];return(0,S.jsxs)(`li`,{className:`text-foreground flex items-center gap-2`,children:[(0,S.jsx)(wY,{checked:t,disabled:!0}),(0,S.jsxs)(`span`,{children:[r,e.slice(1)]})]})}}}return(0,S.jsx)(`li`,{className:`text-foreground`,children:e})}function uQ({content:e}){return(0,S.jsx)(tDe,{options:{overrides:{code:iDe,pre:({children:e})=>(0,S.jsx)(S.Fragment,{children:e}),h1:({children:e})=>(0,S.jsx)(`h1`,{className:`text-xl font-bold text-foreground mb-2 mt-4`,children:e}),h2:({children:e})=>(0,S.jsx)(`h2`,{className:`text-lg font-bold text-foreground mb-2 mt-4`,children:e}),h3:({children:e})=>(0,S.jsx)(`h3`,{className:`text-base font-bold text-foreground mb-2 mt-4`,children:e}),h4:({children:e})=>(0,S.jsx)(`h4`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),h5:({children:e})=>(0,S.jsx)(`h5`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),h6:({children:e})=>(0,S.jsx)(`h6`,{className:`text-sm font-bold text-foreground mb-2 mt-4`,children:e}),p:({children:e})=>(0,S.jsx)(`p`,{className:`text-foreground mb-2 leading-relaxed`,children:e}),ul:({children:e})=>(0,S.jsx)(`ul`,{className:`list-disc list-outside pl-6 mb-3 space-y-1`,children:e}),ol:({children:e})=>(0,S.jsx)(`ol`,{className:`list-decimal list-outside pl-6 mb-3 space-y-1`,children:e}),li:aDe,table:({children:e})=>(0,S.jsx)(`div`,{className:`my-4`,children:(0,S.jsx)(iQ,{children:e})}),thead:({children:e})=>(0,S.jsx)(aQ,{children:e}),tbody:({children:e})=>(0,S.jsx)(oQ,{children:e}),tr:({children:e})=>(0,S.jsx)(sQ,{children:e}),th:({children:e})=>(0,S.jsx)(cQ,{children:e}),td:({children:e})=>(0,S.jsx)(lQ,{children:e}),blockquote:({children:e})=>(0,S.jsx)(`blockquote`,{className:`border-l-4 border-muted-foreground pl-4 italic text-muted-foreground mb-3`,children:e}),a:({children:e,href:t})=>(0,S.jsx)(`a`,{href:t,className:`text-primary hover:underline`,target:`_blank`,rel:`noopener noreferrer`,children:e}),strong:({children:e})=>(0,S.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e}),em:({children:e})=>(0,S.jsx)(`em`,{className:`italic text-foreground`,children:e}),img:({src:e,alt:t})=>(0,S.jsx)(`img`,{src:e,alt:t||``,className:`max-w-full max-h-[500px] object-contain rounded-lg my-4 border border-border`,loading:`lazy`}),hr:()=>(0,S.jsx)(`hr`,{className:`my-4 border-t border-border`})}},children:e})}function dQ({text:e}){let[t,n]=(0,w.useState)(!1);return(0,S.jsx)(`button`,{className:`opacity-0 group-hover/message:opacity-100 transition-opacity text-muted-foreground hover:text-foreground text-xs flex items-center gap-1`,onClick:async()=>{await dj(e),n(!0),setTimeout(()=>n(!1),2e3)},title:`Copy message content`,"data-testid":`copy-button`,children:t?(0,S.jsx)(vf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})}function fQ({content:e,timestamp:t,_isStreaming:n}){return!e||e.length===0?null:(0,S.jsx)(`div`,{className:`flex items-start gap-6 group/message relative`,"data-testid":`chat-message-assistant`,children:(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`wrap-break-word`,children:(0,S.jsx)(`div`,{className:`text-base leading-7 font-sans text-start wrap-break-word transition-all duration-300 ease-in-out`,"data-testid":`chat-message-content`,children:(0,S.jsx)(uQ,{content:e})})}),t&&(0,S.jsxs)(`div`,{className:`flex items-center justify-between mt-2`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(t).toLocaleTimeString()}),(0,S.jsx)(dQ,{text:e})]})]})})}function pQ({...e}){return(0,S.jsx)(dN,{"data-slot":`sheet`,...e})}function mQ({...e}){return(0,S.jsx)(fN,{"data-slot":`sheet-trigger`,...e})}function oDe({...e}){return(0,S.jsx)(pN,{"data-slot":`sheet-portal`,...e})}function sDe({className:e,...t}){return(0,S.jsx)(mN,{"data-slot":`sheet-overlay`,className:H(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function hQ({className:e,children:t,side:n=`right`,...r}){return(0,S.jsxs)(oDe,{children:[(0,S.jsx)(sDe,{}),(0,S.jsxs)(hN,{"data-slot":`sheet-content`,className:H(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,n===`right`&&`data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm`,n===`left`&&`data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm`,n===`top`&&`data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b`,n===`bottom`&&`data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t`,e),...r,children:[t,(0,S.jsxs)(vN,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none`,children:[(0,S.jsx)(Fp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function gQ({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sheet-header`,className:H(`flex flex-col gap-1.5 p-4`,e),...t})}function _Q({className:e,...t}){return(0,S.jsx)(gN,{"data-slot":`sheet-title`,className:H(`text-foreground font-semibold`,e),...t})}function cDe({className:e,...t}){return(0,S.jsx)(_N,{"data-slot":`sheet-description`,className:H(`text-muted-foreground text-sm`,e),...t})}function vQ({toolName:e,args:t,result:n,state:r=`result`,partialArgs:i}){let a=r===`call`&&i?i:t,o=()=>{switch(r){case`call`:return(0,S.jsx)(Zf,{className:`h-4 w-4 animate-spin text-blue-500 dark:text-blue-400`});case`result`:return(0,S.jsx)(vf,{className:`h-4 w-4 text-emerald-800 dark:text-emerald-400`});case`error`:return(0,S.jsx)(Fp,{className:`h-4 w-4 text-red-500 dark:text-red-400`});default:return(0,S.jsx)(vf,{className:`h-4 w-4 text-emerald-800 dark:text-emerald-400`})}},s=()=>{switch(r){case`call`:return` bg-blue-500/20 dark:bg-blue-500/20`;case`result`:return` bg-emerald-500/20 dark:bg-emerald-500/20`;case`error`:return` bg-red-500/20 dark:bg-red-500/20`;default:return` bg-emerald-500/20 dark:bg-emerald-500/20`}},c=e=>typeof e==`object`?zP(e).preview:String(e);return(0,S.jsxs)(pQ,{children:[(0,S.jsx)(mQ,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`flex max-w-min items-center gap-3 p-1 rounded-full border bg-card hover:bg-accent/50 transition-colors cursor-pointer my-4`,"data-testid":`chat-tool-call-${e}`,children:[(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 flex items-center justify-center shrink-0`,children:(0,S.jsx)(Pp,{className:`size-4 text-muted-foreground`})}),(0,S.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`span`,{className:`text-sm font-medium truncate`,children:[e,`(`,Object.keys(a).length>0?(0,S.jsxs)(`span`,{className:`bg-muted-foreground/20 rounded-full px-1.5 mx-1 py-0.5 text-xs`,children:[Object.keys(a).length,` args`]}):``,`)`]})})}),(0,S.jsx)(`div`,{className:H(`w-8 h-8 rounded-full flex items-center justify-center`,s()),"data-testid":`chat-tool-call-status-${r}`,children:o()})]})}),(0,S.jsxs)(hQ,{side:`right`,className:`w-[400px] sm:w-[540px] p-4 overflow-y-auto`,"data-testid":`chat-tool-drawer`,children:[(0,S.jsxs)(gQ,{children:[(0,S.jsxs)(_Q,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Pp,{className:`h-5 w-5`}),`Tool Call Details`]}),(0,S.jsxs)(cDe,{className:`flex items-center gap-2`,children:[e,` — `,r,r===`call`&&(0,S.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500 dark:text-blue-400`,children:[(0,S.jsx)(Zf,{className:`h-3 w-3 animate-spin`}),`streaming…`]})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Arguments`}),(0,S.jsxs)(`div`,{className:`relative`,"data-testid":`chat-tool-drawer-args`,children:[(0,S.jsx)(`pre`,{className:`text-xs bg-muted/50 rounded-lg p-3 overflow-x-auto border font-mono leading-relaxed max-h-48 whitespace-pre-wrap break-words`,children:c(a)}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(c(a)),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy arguments`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Result`}),(0,S.jsx)(`div`,{className:`relative`,"data-testid":`chat-tool-drawer-result`,children:typeof n==`string`?(0,S.jsxs)(`div`,{className:H(`p-3 rounded-lg border text-sm leading-relaxed max-h-48 overflow-x-auto whitespace-pre-wrap break-words max-w-full`,r===`error`?`bg-destructive/10 border-destructive/20 text-destructive-foreground`:`bg-muted/30 border-border`),children:[n.startsWith(`Error`)?(0,S.jsxs)(`div`,{className:`font-mono`,children:[(0,S.jsx)(`div`,{className:`font-semibold text-destructive mb-1`,children:`Error:`}),(0,S.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:n.replace(/^Error:\s*/,``)})]}):(0,S.jsx)(`div`,{className:`whitespace-pre-wrap font-mono break-words`,children:n}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(n),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy result`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]}):(0,S.jsxs)(`div`,{className:H(`p-3 rounded-lg border text-sm leading-relaxed max-h-96 overflow-y-auto max-w-full`,r===`error`?`bg-destructive/10 border-destructive/20 text-destructive-foreground`:`bg-muted/30 border-border`),children:[(0,S.jsx)(RV,{data:n,filename:`tool-call-${e}-result-${Date.now()}.json`}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>dj(JSON.stringify(n,null,2)),className:`absolute top-2 right-2 h-6 w-6 p-0 opacity-70 hover:opacity-100`,title:`Copy result`,children:(0,S.jsx)(jf,{className:`h-3 w-3`})})]})})]})]})]})]})}var yQ=(0,w.createContext)(void 0),lDe={deviceType:`desktop`,customViewport:{width:768,height:1024},cspMode:`permissive`,displayModeOverride:null,capabilities:{hover:!0,touch:!1},safeAreaInsets:{top:0,right:0,bottom:0,left:0},locale:`en-US`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,selectedProtocol:null};function uDe({children:e}){let[t,n]=(0,w.useState)({activeWidgetId:null,widgets:new Map,playground:lDe}),r=(0,w.useCallback)(e=>{n(t=>({...t,activeWidgetId:e}))},[]),i=(0,w.useCallback)((e,t)=>{n(n=>{if(n.widgets.has(e))return n;let r=new Map(n.widgets);return r.set(e,{...t,cspViolations:[]}),{...n,widgets:r}})},[]),a=(0,w.useCallback)(e=>{n(t=>{let n=new Map(t.widgets);return n.delete(e),{...t,widgets:n,activeWidgetId:t.activeWidgetId===e?null:t.activeWidgetId}})},[]),o=(0,w.useRef)(t);o.current=t;let s=(0,w.useCallback)(e=>o.current.widgets.get(e),[]),c=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i={cspViolations:[...r.cspViolations,t]};t.originalPolicy&&r.effectivePolicy===void 0&&(i.effectivePolicy=t.originalPolicy);let a=new Map(n.widgets);return a.set(e,{...r,...i}),{...n,widgets:a}})},[]),l=(0,w.useCallback)(e=>{n(t=>{let n=t.widgets.get(e);if(!n)return t;let r=new Map(t.widgets);return r.set(e,{...n,cspViolations:[]}),{...t,widgets:r}})},[]),u=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,modelContext:t}),{...n,widgets:i}})},[]),d=(0,w.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,widgetState:t}),{...n,widgets:i}})},[]),f=(0,w.useCallback)((e,t,r)=>{n(n=>{let i=n.widgets.get(e);if(!i)return n;let a=new Map(n.widgets);return a.set(e,{...i,declaredCsp:t,...r!==void 0&&{effectivePolicy:r}}),{...n,widgets:a}})},[]),p=(0,w.useCallback)(e=>{n(t=>({...t,playground:{...t.playground,...e}}))},[]),m=(0,w.useCallback)(()=>{n(e=>({...e,widgets:new Map,activeWidgetId:null}))},[]),h=(0,w.useCallback)(()=>{let e=new Map;for(let[n,r]of t.widgets)r.modelContext&&e.set(n,r.modelContext);return e},[t.widgets]);return(0,S.jsx)(yQ,{value:(0,w.useMemo)(()=>({...t,setActiveWidget:r,addWidget:i,removeWidget:a,getWidget:s,addCspViolation:c,clearCspViolations:l,setWidgetModelContext:u,setWidgetState:d,setWidgetDeclaredCsp:f,updatePlaygroundSettings:p,clearAllWidgets:m,getAllModelContexts:h}),[t,r,i,a,s,c,l,u,d,f,p,m,h]),children:e})}function bQ(){let e=(0,w.use)(yQ);if(!e)throw Error(`useWidgetDebug must be used within WidgetDebugProvider`);return e}var xQ={mobile:{width:390,height:844,name:`iPhone 14`},tablet:{width:820,height:1180,name:`iPad Air`},desktop:{width:1440,height:900,name:`Desktop`},custom:{width:768,height:1024,name:`Custom`}};function SQ(e){let t=e?.ui?.resourceUri&&typeof e.ui.resourceUri==`string`,n=e?.[`openai/outputTemplate`]&&typeof e[`openai/outputTemplate`]==`string`;return t&&n}function CQ(e,t){return SQ(e)?`both`:e?.ui?.resourceUri&&typeof e.ui.resourceUri==`string`?`mcp-apps`:e?.[`openai/outputTemplate`]&&typeof e[`openai/outputTemplate`]==`string`?`chatgpt-app`:dDe(t)?`mcp-ui`:null}function dDe(e){return!e?.content||!Array.isArray(e.content)?!1:e.content.some(e=>{if(e.type!==`resource`||!e.resource?.uri)return!1;let t=e.resource.uri,n=e.resource.mimeType;return!(!t.startsWith(`ui://`)||n===`text/html+skybridge`||n===`text/html;profile=mcp-app`)})}function wQ(e,t){return e===`mcp-apps`?t?.ui?.resourceUri||null:e===`chatgpt-app`&&t?.[`openai/outputTemplate`]||null}var fDe=Object.defineProperty,TQ=(e,t)=>{for(var n in t)fDe(e,n,{get:t[n],enumerable:!0,configurable:!0,set:e=>t[n]=()=>e})},EQ=`2026-01-26`,Q={};TQ(Q,{xor:()=>HAe,xid:()=>k8,void:()=>IAe,uuidv7:()=>m8,uuidv6:()=>p8,uuidv4:()=>f8,uuid:()=>d8,util:()=>PQ,url:()=>g8,uppercase:()=>g3,unknown:()=>C5,union:()=>M5,undefined:()=>PAe,ulid:()=>D8,uint64:()=>h5,uint32:()=>c5,tuple:()=>R5,trim:()=>w3,treeifyError:()=>C$,transform:()=>J5,toUpperCase:()=>E3,toLowerCase:()=>T3,toJSONSchema:()=>k6,templateLiteral:()=>tje,symbol:()=>_5,superRefine:()=>w7,success:()=>QAe,stringbool:()=>cje,stringFormat:()=>Z8,string:()=>i8,strictObject:()=>BAe,startsWith:()=>v3,slugify:()=>D3,size:()=>u3,setErrorMap:()=>fje,set:()=>qAe,safeParseAsync:()=>K6,safeParse:()=>G6,safeEncodeAsync:()=>$6,safeEncode:()=>Z6,safeDecodeAsync:()=>e8,safeDecode:()=>Q6,registry:()=>Q2,regexes:()=>H$,regex:()=>m3,refine:()=>C7,record:()=>B5,readonly:()=>h7,property:()=>b3,promise:()=>nje,prettifyError:()=>T$,preprocess:()=>uje,prefault:()=>i7,positive:()=>r3,pipe:()=>f7,partialRecord:()=>WAe,parseAsync:()=>W6,parse:()=>U6,overwrite:()=>S3,optional:()=>X5,object:()=>zAe,number:()=>n5,nullish:()=>ZAe,nullable:()=>e7,null:()=>b5,normalize:()=>C3,nonpositive:()=>a3,nonoptional:()=>o7,nonnegative:()=>o3,never:()=>T5,negative:()=>i3,nativeEnum:()=>JAe,nanoid:()=>x8,nan:()=>$Ae,multipleOf:()=>s3,minSize:()=>l3,minLength:()=>f3,mime:()=>x3,meta:()=>oje,maxSize:()=>c3,maxLength:()=>d3,map:()=>KAe,mac:()=>F8,lte:()=>e3,lt:()=>$4,lowercase:()=>h3,looseRecord:()=>GAe,looseObject:()=>VAe,locales:()=>R2,literal:()=>YAe,length:()=>p3,lazy:()=>v7,ksuid:()=>j8,keyof:()=>RAe,jwt:()=>Y8,json:()=>lje,iso:()=>M6,ipv6:()=>L8,ipv4:()=>N8,intersection:()=>I5,int64:()=>m5,int32:()=>s5,int:()=>i5,instanceof:()=>sje,includes:()=>_3,httpUrl:()=>_8,hostname:()=>Q8,hex:()=>$8,hash:()=>e5,guid:()=>l8,gte:()=>n3,gt:()=>t3,globalRegistry:()=>$2,getErrorMap:()=>pje,function:()=>x7,fromJSONSchema:()=>yje,formatError:()=>S$,float64:()=>o5,float32:()=>a5,flattenError:()=>x$,file:()=>XAe,exactOptional:()=>Q5,enum:()=>W5,endsWith:()=>y3,encodeAsync:()=>Y6,encode:()=>q6,emoji:()=>y8,email:()=>s8,e164:()=>q8,discriminatedUnion:()=>UAe,describe:()=>aje,decodeAsync:()=>X6,decode:()=>J6,date:()=>LAe,custom:()=>ije,cuid2:()=>T8,cuid:()=>C8,core:()=>DQ,config:()=>NQ,coerce:()=>bje,codec:()=>eje,clone:()=>n$,cidrv6:()=>V8,cidrv4:()=>z8,check:()=>rje,catch:()=>l7,boolean:()=>u5,bigint:()=>f5,base64url:()=>G8,base64:()=>U8,array:()=>k5,any:()=>FAe,_function:()=>x7,_default:()=>n7,_ZodString:()=>n8,ZodXor:()=>N5,ZodXID:()=>O8,ZodVoid:()=>E5,ZodUnknown:()=>S5,ZodUnion:()=>j5,ZodUndefined:()=>v5,ZodUUID:()=>u8,ZodURL:()=>h8,ZodULID:()=>E8,ZodType:()=>t8,ZodTuple:()=>L5,ZodTransform:()=>q5,ZodTemplateLiteral:()=>g7,ZodSymbol:()=>g5,ZodSuccess:()=>s7,ZodStringFormat:()=>a8,ZodString:()=>r8,ZodSet:()=>H5,ZodRecord:()=>z5,ZodRealError:()=>H6,ZodReadonly:()=>m7,ZodPromise:()=>y7,ZodPrefault:()=>r7,ZodPipe:()=>d7,ZodOptional:()=>Y5,ZodObject:()=>A5,ZodNumberFormat:()=>r5,ZodNumber:()=>t5,ZodNullable:()=>$5,ZodNull:()=>y5,ZodNonOptional:()=>a7,ZodNever:()=>w5,ZodNanoID:()=>b8,ZodNaN:()=>u7,ZodMap:()=>V5,ZodMAC:()=>P8,ZodLiteral:()=>G5,ZodLazy:()=>_7,ZodKSUID:()=>A8,ZodJWT:()=>J8,ZodIssueCode:()=>dje,ZodIntersection:()=>F5,ZodISOTime:()=>L6,ZodISODuration:()=>z6,ZodISODateTime:()=>N6,ZodISODate:()=>F6,ZodIPv6:()=>I8,ZodIPv4:()=>M8,ZodGUID:()=>c8,ZodFunction:()=>b7,ZodFirstPartyTypeKind:()=>mje,ZodFile:()=>K5,ZodExactOptional:()=>Z5,ZodError:()=>NAe,ZodEnum:()=>U5,ZodEmoji:()=>v8,ZodEmail:()=>o8,ZodE164:()=>K8,ZodDiscriminatedUnion:()=>P5,ZodDefault:()=>t7,ZodDate:()=>D5,ZodCustomStringFormat:()=>X8,ZodCustom:()=>S7,ZodCodec:()=>p7,ZodCatch:()=>c7,ZodCUID2:()=>w8,ZodCUID:()=>S8,ZodCIDRv6:()=>B8,ZodCIDRv4:()=>R8,ZodBoolean:()=>l5,ZodBigIntFormat:()=>p5,ZodBigInt:()=>d5,ZodBase64URL:()=>W8,ZodBase64:()=>H8,ZodArray:()=>O5,ZodAny:()=>x5,TimePrecision:()=>T4,NEVER:()=>OQ,$output:()=>Y2,$input:()=>X2,$brand:()=>kQ});var DQ={};TQ(DQ,{version:()=>X1,util:()=>PQ,treeifyError:()=>C$,toJSONSchema:()=>k6,toDotPath:()=>w$,safeParseAsync:()=>N$,safeParse:()=>j$,safeEncodeAsync:()=>GDe,safeEncode:()=>UDe,safeDecodeAsync:()=>KDe,safeDecode:()=>WDe,registry:()=>Q2,regexes:()=>H$,process:()=>z3,prettifyError:()=>T$,parseAsync:()=>k$,parse:()=>D$,meta:()=>F3,locales:()=>R2,isValidJWT:()=>T0,isValidBase64URL:()=>S0,isValidBase64:()=>b0,initializeContext:()=>R3,globalRegistry:()=>$2,globalConfig:()=>MQ,formatError:()=>S$,flattenError:()=>x$,finalize:()=>V3,extractDefs:()=>B3,encodeAsync:()=>VDe,encode:()=>zDe,describe:()=>P3,decodeAsync:()=>HDe,decode:()=>BDe,createToJSONSchemaMethod:()=>U3,createStandardJSONSchemaMethod:()=>W3,config:()=>NQ,clone:()=>n$,_xor:()=>oAe,_xid:()=>m4,_void:()=>Y4,_uuidv7:()=>s4,_uuidv6:()=>o4,_uuidv4:()=>a4,_uuid:()=>i4,_url:()=>c4,_uppercase:()=>g3,_unknown:()=>q4,_union:()=>aAe,_undefined:()=>W4,_ulid:()=>p4,_uint64:()=>H4,_uint32:()=>I4,_tuple:()=>lAe,_trim:()=>w3,_transform:()=>gAe,_toUpperCase:()=>E3,_toLowerCase:()=>T3,_templateLiteral:()=>TAe,_symbol:()=>U4,_superRefine:()=>M3,_success:()=>xAe,_stringbool:()=>I3,_stringFormat:()=>L3,_string:()=>e4,_startsWith:()=>v3,_slugify:()=>D3,_size:()=>u3,_set:()=>fAe,_safeParseAsync:()=>M$,_safeParse:()=>A$,_safeEncodeAsync:()=>B$,_safeEncode:()=>R$,_safeDecodeAsync:()=>V$,_safeDecode:()=>z$,_regex:()=>m3,_refine:()=>j3,_record:()=>uAe,_readonly:()=>wAe,_property:()=>b3,_promise:()=>DAe,_positive:()=>r3,_pipe:()=>CAe,_parseAsync:()=>O$,_parse:()=>E$,_overwrite:()=>S3,_optional:()=>_Ae,_number:()=>A4,_nullable:()=>vAe,_null:()=>G4,_normalize:()=>C3,_nonpositive:()=>a3,_nonoptional:()=>bAe,_nonnegative:()=>o3,_never:()=>J4,_negative:()=>i3,_nativeEnum:()=>mAe,_nanoid:()=>u4,_nan:()=>Q4,_multipleOf:()=>s3,_minSize:()=>l3,_minLength:()=>f3,_min:()=>n3,_mime:()=>x3,_maxSize:()=>c3,_maxLength:()=>d3,_max:()=>e3,_map:()=>dAe,_mac:()=>v4,_lte:()=>e3,_lt:()=>$4,_lowercase:()=>h3,_literal:()=>hAe,_length:()=>p3,_lazy:()=>EAe,_ksuid:()=>h4,_jwt:()=>w4,_isoTime:()=>O4,_isoDuration:()=>k4,_isoDateTime:()=>E4,_isoDate:()=>D4,_ipv6:()=>_4,_ipv4:()=>g4,_intersection:()=>cAe,_int64:()=>V4,_int32:()=>F4,_int:()=>M4,_includes:()=>_3,_guid:()=>r4,_gte:()=>n3,_gt:()=>t3,_float64:()=>P4,_float32:()=>N4,_file:()=>k3,_enum:()=>pAe,_endsWith:()=>y3,_encodeAsync:()=>I$,_encode:()=>P$,_emoji:()=>l4,_email:()=>n4,_e164:()=>C4,_discriminatedUnion:()=>sAe,_default:()=>yAe,_decodeAsync:()=>L$,_decode:()=>F$,_date:()=>X4,_custom:()=>A3,_cuid2:()=>f4,_cuid:()=>d4,_coercedString:()=>t4,_coercedNumber:()=>j4,_coercedDate:()=>Z4,_coercedBoolean:()=>R4,_coercedBigint:()=>B4,_cidrv6:()=>b4,_cidrv4:()=>y4,_check:()=>N3,_catch:()=>SAe,_boolean:()=>L4,_bigint:()=>z4,_base64url:()=>S4,_base64:()=>x4,_array:()=>O3,_any:()=>K4,TimePrecision:()=>T4,NEVER:()=>OQ,JSONSchemaGenerator:()=>jAe,JSONSchema:()=>MAe,Doc:()=>Y1,$output:()=>Y2,$input:()=>X2,$constructor:()=>$,$brand:()=>kQ,$ZodXor:()=>Z0,$ZodXID:()=>l0,$ZodVoid:()=>z0,$ZodUnknown:()=>L0,$ZodUnion:()=>Y0,$ZodUndefined:()=>P0,$ZodUUID:()=>t0,$ZodURL:()=>r0,$ZodULID:()=>c0,$ZodType:()=>Z1,$ZodTuple:()=>n2,$ZodTransform:()=>f2,$ZodTemplateLiteral:()=>M2,$ZodSymbol:()=>N0,$ZodSuccess:()=>S2,$ZodStringFormat:()=>$1,$ZodString:()=>Q1,$ZodSet:()=>s2,$ZodRegistry:()=>Z2,$ZodRecord:()=>i2,$ZodRealError:()=>b$,$ZodReadonly:()=>A2,$ZodPromise:()=>P2,$ZodPrefault:()=>y2,$ZodPipe:()=>T2,$ZodOptional:()=>m2,$ZodObjectJIT:()=>q0,$ZodObject:()=>K0,$ZodNumberFormat:()=>k0,$ZodNumber:()=>O0,$ZodNullable:()=>g2,$ZodNull:()=>F0,$ZodNonOptional:()=>b2,$ZodNever:()=>R0,$ZodNanoID:()=>a0,$ZodNaN:()=>w2,$ZodMap:()=>a2,$ZodMAC:()=>_0,$ZodLiteral:()=>u2,$ZodLazy:()=>F2,$ZodKSUID:()=>u0,$ZodJWT:()=>E0,$ZodIntersection:()=>$0,$ZodISOTime:()=>p0,$ZodISODuration:()=>m0,$ZodISODateTime:()=>d0,$ZodISODate:()=>f0,$ZodIPv6:()=>g0,$ZodIPv4:()=>h0,$ZodGUID:()=>e0,$ZodFunction:()=>N2,$ZodFile:()=>d2,$ZodExactOptional:()=>h2,$ZodError:()=>y$,$ZodEnum:()=>l2,$ZodEncodeError:()=>jQ,$ZodEmoji:()=>i0,$ZodEmail:()=>n0,$ZodE164:()=>w0,$ZodDiscriminatedUnion:()=>Q0,$ZodDefault:()=>_2,$ZodDate:()=>B0,$ZodCustomStringFormat:()=>D0,$ZodCustom:()=>I2,$ZodCodec:()=>D2,$ZodCheckUpperCase:()=>V1,$ZodCheckStringFormat:()=>R1,$ZodCheckStartsWith:()=>U1,$ZodCheckSizeEquals:()=>P1,$ZodCheckRegex:()=>z1,$ZodCheckProperty:()=>K1,$ZodCheckOverwrite:()=>J1,$ZodCheckNumberFormat:()=>A1,$ZodCheckMultipleOf:()=>k1,$ZodCheckMinSize:()=>N1,$ZodCheckMinLength:()=>I1,$ZodCheckMimeType:()=>q1,$ZodCheckMaxSize:()=>M1,$ZodCheckMaxLength:()=>F1,$ZodCheckLowerCase:()=>B1,$ZodCheckLessThan:()=>D1,$ZodCheckLengthEquals:()=>L1,$ZodCheckIncludes:()=>H1,$ZodCheckGreaterThan:()=>O1,$ZodCheckEndsWith:()=>W1,$ZodCheckBigIntFormat:()=>j1,$ZodCheck:()=>T1,$ZodCatch:()=>C2,$ZodCUID2:()=>s0,$ZodCUID:()=>o0,$ZodCIDRv6:()=>y0,$ZodCIDRv4:()=>v0,$ZodBoolean:()=>A0,$ZodBigIntFormat:()=>M0,$ZodBigInt:()=>j0,$ZodBase64URL:()=>C0,$ZodBase64:()=>x0,$ZodAsyncError:()=>AQ,$ZodArray:()=>H0,$ZodAny:()=>I0});var OQ=Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var kQ=Symbol(`zod_brand`),AQ=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},jQ=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},MQ={};function NQ(e){return e&&Object.assign(MQ,e),MQ}var PQ={};TQ(PQ,{unwrapMessage:()=>u$,uint8ArrayToHex:()=>LDe,uint8ArrayToBase64url:()=>FDe,uint8ArrayToBase64:()=>_$,stringifyPrimitive:()=>i$,slugify:()=>qQ,shallowClone:()=>QQ,safeExtend:()=>kDe,required:()=>MDe,randomString:()=>SDe,propertyKeyTypes:()=>$Q,promiseAllObject:()=>xDe,primitiveTypes:()=>e$,prefixIssues:()=>l$,pick:()=>EDe,partial:()=>jDe,parsedType:()=>m$,optionalKeys:()=>a$,omit:()=>DDe,objectClone:()=>vDe,numKeys:()=>CDe,nullish:()=>zQ,normalizeParams:()=>r$,mergeDefs:()=>GQ,merge:()=>ADe,jsonStringifyReplacer:()=>LQ,joinValues:()=>IQ,issue:()=>h$,isPlainObject:()=>ZQ,isObject:()=>YQ,hexToUint8Array:()=>IDe,getSizableOrigin:()=>f$,getParsedType:()=>wDe,getLengthableOrigin:()=>p$,getEnumValues:()=>FQ,getElementAtPath:()=>bDe,floatSafeRemainder:()=>VQ,finalizeIssue:()=>d$,extend:()=>ODe,escapeRegex:()=>t$,esc:()=>KQ,defineLazy:()=>UQ,createTransparentProxy:()=>TDe,cloneDef:()=>yDe,clone:()=>n$,cleanRegex:()=>BQ,cleanEnum:()=>NDe,captureStackTrace:()=>JQ,cached:()=>RQ,base64urlToUint8Array:()=>PDe,base64ToUint8Array:()=>g$,assignProp:()=>WQ,assertNotEqual:()=>mDe,assertNever:()=>gDe,assertIs:()=>hDe,assertEqual:()=>pDe,assert:()=>_De,allowsEval:()=>XQ,aborted:()=>c$,NUMBER_FORMAT_RANGES:()=>o$,Class:()=>RDe,BIGINT_FORMAT_RANGES:()=>s$});function pDe(e){return e}function mDe(e){return e}function hDe(e){}function gDe(e){throw Error(`Unexpected value in exhaustive check`)}function _De(e){}function FQ(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function IQ(e,t=`|`){return e.map(e=>i$(e)).join(t)}function LQ(e,t){return typeof t==`bigint`?t.toString():t}function RQ(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function zQ(e){return e==null}function BQ(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function VQ(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var HQ=Symbol(`evaluating`);function UQ(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==HQ)return r===void 0&&(r=HQ,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function vDe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function WQ(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function GQ(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function yDe(e){return GQ(e._zod.def)}function bDe(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function xDe(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function SDe(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function KQ(e){return JSON.stringify(e)}function qQ(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var JQ=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function YQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var XQ=RQ(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ZQ(e){if(YQ(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(YQ(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function QQ(e){return ZQ(e)?{...e}:Array.isArray(e)?[...e]:e}function CDe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var wDe=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},$Q=new Set([`string`,`number`,`symbol`]),e$=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function t$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function n$(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function r$(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function TDe(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function i$(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function a$(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var o$={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},s$={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function EDe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return n$(e,GQ(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return WQ(this,`shape`,e),e},checks:[]}))}function DDe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return n$(e,GQ(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return WQ(this,`shape`,r),r},checks:[]}))}function ODe(e,t){if(!ZQ(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return n$(e,GQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return WQ(this,`shape`,n),n}}))}function kDe(e,t){if(!ZQ(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return n$(e,GQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return WQ(this,`shape`,n),n}}))}function ADe(e,t){return n$(e,GQ(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return WQ(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function jDe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return n$(t,GQ(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return WQ(this,`shape`,i),i},checks:[]}))}function MDe(e,t,n){return n$(t,GQ(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return WQ(this,`shape`,i),i}}))}function c$(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function l$(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function u$(e){return typeof e==`string`?e:e?.message}function d$(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=u$(e.inst?._zod.def?.error?.(e))??u$(t?.error?.(e))??u$(n.customError?.(e))??u$(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,!t?.reportInput&&delete r.input,r}function f$(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function p$(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function m$(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function h$(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function NDe(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function g$(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function _$(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function PDe(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return g$(t+`=`.repeat((4-t.length%4)%4))}function FDe(e){return _$(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function IDe(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function LDe(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var RDe=class{constructor(...e){}},v$=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,LQ,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},y$=$(`$ZodError`,v$),b$=$(`$ZodError`,v$,{Parent:Error});function x$(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function S$(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function C$(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function w$(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function T$(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${w$(e.path)}`);return t.join(`
|
|
578
|
+
`)}var E$=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new AQ;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>d$(e,a,NQ())));throw JQ(t,i?.callee),t}return o.value},D$=E$(b$),O$=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>d$(e,a,NQ())));throw JQ(t,i?.callee),t}return o.value},k$=O$(b$),A$=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new AQ;return a.issues.length?{success:!1,error:new(e??y$)(a.issues.map(e=>d$(e,i,NQ())))}:{success:!0,data:a.value}},j$=A$(b$),M$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>d$(e,i,NQ())))}:{success:!0,data:a.value}},N$=M$(b$),P$=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return E$(e)(t,n,i)},zDe=P$(b$),F$=e=>(t,n,r)=>E$(e)(t,n,r),BDe=F$(b$),I$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return O$(e)(t,n,i)},VDe=I$(b$),L$=e=>async(t,n,r)=>O$(e)(t,n,r),HDe=L$(b$),R$=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return A$(e)(t,n,i)},UDe=R$(b$),z$=e=>(t,n,r)=>A$(e)(t,n,r),WDe=z$(b$),B$=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return M$(e)(t,n,i)},GDe=B$(b$),V$=e=>async(t,n,r)=>M$(e)(t,n,r),KDe=V$(b$),H$={};TQ(H$,{xid:()=>K$,uuid7:()=>XDe,uuid6:()=>YDe,uuid4:()=>JDe,uuid:()=>Z$,uppercase:()=>S1,unicodeEmail:()=>$$,undefined:()=>b1,ulid:()=>G$,time:()=>f1,string:()=>m1,sha512_hex:()=>_Oe,sha512_base64url:()=>yOe,sha512_base64:()=>vOe,sha384_hex:()=>mOe,sha384_base64url:()=>gOe,sha384_base64:()=>hOe,sha256_hex:()=>dOe,sha256_base64url:()=>pOe,sha256_base64:()=>fOe,sha1_hex:()=>cOe,sha1_base64url:()=>uOe,sha1_base64:()=>lOe,rfc5322Email:()=>QDe,number:()=>_1,null:()=>y1,nanoid:()=>J$,md5_hex:()=>aOe,md5_base64url:()=>sOe,md5_base64:()=>oOe,mac:()=>r1,lowercase:()=>x1,ksuid:()=>q$,ipv6:()=>n1,ipv4:()=>t1,integer:()=>g1,idnEmail:()=>$De,html5Email:()=>ZDe,hostname:()=>nOe,hex:()=>iOe,guid:()=>X$,extendedDuration:()=>qDe,emoji:()=>e1,email:()=>Q$,e164:()=>c1,duration:()=>Y$,domain:()=>rOe,datetime:()=>p1,date:()=>u1,cuid2:()=>W$,cuid:()=>U$,cidrv6:()=>a1,cidrv4:()=>i1,browserEmail:()=>eOe,boolean:()=>v1,bigint:()=>h1,base64url:()=>s1,base64:()=>o1});var U$=/^[cC][^\s-]{8,}$/,W$=/^[0-9a-z]+$/,G$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,K$=/^[0-9a-vA-V]{20}$/,q$=/^[A-Za-z0-9]{27}$/,J$=/^[a-zA-Z0-9_-]{21}$/,Y$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qDe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,X$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Z$=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,JDe=Z$(4),YDe=Z$(6),XDe=Z$(7),Q$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ZDe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,QDe=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,$$=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,$De=$$,eOe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,tOe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function e1(){return new RegExp(tOe,`u`)}var t1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,n1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,r1=e=>{let t=t$(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},i1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,a1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,o1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,s1=/^[A-Za-z0-9_-]*$/,nOe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,rOe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,c1=/^\+[1-9]\d{6,14}$/,l1=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,u1=RegExp(`^${l1}$`);function d1(e){return typeof e.precision==`number`?e.precision===-1?`(?:[01]\\d|2[0-3]):[0-5]\\d`:e.precision===0?`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`:`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:`(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?`}function f1(e){return RegExp(`^${d1(e)}$`)}function p1(e){let t=d1({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${l1}T(?:${r})$`)}var m1=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},h1=/^-?\d+n?$/,g1=/^-?\d+$/,_1=/^-?\d+(?:\.\d+)?$/,v1=/^(?:true|false)$/i,y1=/^null$/i,b1=/^undefined$/i,x1=/^[^A-Z]*$/,S1=/^[^a-z]*$/,iOe=/^[0-9a-fA-F]*$/;function C1(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function w1(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var aOe=/^[0-9a-fA-F]{32}$/,oOe=C1(22,`==`),sOe=w1(22),cOe=/^[0-9a-fA-F]{40}$/,lOe=C1(27,`=`),uOe=w1(27),dOe=/^[0-9a-fA-F]{64}$/,fOe=C1(43,`=`),pOe=w1(43),mOe=/^[0-9a-fA-F]{96}$/,hOe=C1(64,``),gOe=w1(64),_Oe=/^[0-9a-fA-F]{128}$/,vOe=C1(86,`==`),yOe=w1(86),T1=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),E1={number:`number`,bigint:`bigint`,object:`date`},D1=$(`$ZodCheckLessThan`,(e,t)=>{T1.init(e,t);let n=E1[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),O1=$(`$ZodCheckGreaterThan`,(e,t)=>{T1.init(e,t);let n=E1[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),k1=$(`$ZodCheckMultipleOf`,(e,t)=>{T1.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):VQ(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),A1=$(`$ZodCheckNumberFormat`,(e,t)=>{T1.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=o$[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=g1)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),j1=$(`$ZodCheckBigIntFormat`,(e,t)=>{T1.init(e,t);let[n,r]=s$[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),M1=$(`$ZodCheckMaxSize`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:f$(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),N1=$(`$ZodCheckMinSize`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:f$(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),P1=$(`$ZodCheckSizeEquals`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:f$(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),F1=$(`$ZodCheckMaxLength`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=p$(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),I1=$(`$ZodCheckMinLength`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=p$(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),L1=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;T1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!zQ(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=p$(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),R1=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;T1.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),z1=$(`$ZodCheckRegex`,(e,t)=>{R1.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),B1=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=x1,R1.init(e,t)}),V1=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=S1,R1.init(e,t)}),H1=$(`$ZodCheckIncludes`,(e,t)=>{T1.init(e,t);let n=t$(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),U1=$(`$ZodCheckStartsWith`,(e,t)=>{T1.init(e,t);let n=RegExp(`^${t$(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),W1=$(`$ZodCheckEndsWith`,(e,t)=>{T1.init(e,t);let n=RegExp(`.*${t$(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function G1(e,t,n){e.issues.length&&t.issues.push(...l$(n,e.issues))}var K1=$(`$ZodCheckProperty`,(e,t)=>{T1.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>G1(n,e,t.property));G1(n,e,t.property)}}),q1=$(`$ZodCheckMimeType`,(e,t)=>{T1.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),J1=$(`$ZodCheckOverwrite`,(e,t)=>{T1.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Y1=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
579
579
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
580
|
-
`))}},Y1={major:4,minor:3,patch:5},X1=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Y1;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=s$(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new kQ;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=s$(e,t))});else{if(e.issues.length===t)continue;r||=s$(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(s$(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new kQ;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new kQ;return o.then(e=>t(e,r,a))}return t(o,r,a)}}HQ(e,`~standard`,()=>({validate:t=>{try{let n=A$(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return M$(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Z1=$(`$ZodString`,(e,t)=>{X1.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??p1(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Q1=$(`$ZodStringFormat`,(e,t)=>{L1.init(e,t),Z1.init(e,t)}),$1=$(`$ZodGUID`,(e,t)=>{t.pattern??=Y$,Q1.init(e,t)}),e0=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=X$(e)}else t.pattern??=X$();Q1.init(e,t)}),t0=$(`$ZodEmail`,(e,t)=>{t.pattern??=Z$,Q1.init(e,t)}),n0=$(`$ZodURL`,(e,t)=>{Q1.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(i.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),r0=$(`$ZodEmoji`,(e,t)=>{t.pattern??=$$(),Q1.init(e,t)}),i0=$(`$ZodNanoID`,(e,t)=>{t.pattern??=q$,Q1.init(e,t)}),a0=$(`$ZodCUID`,(e,t)=>{t.pattern??=H$,Q1.init(e,t)}),o0=$(`$ZodCUID2`,(e,t)=>{t.pattern??=U$,Q1.init(e,t)}),s0=$(`$ZodULID`,(e,t)=>{t.pattern??=W$,Q1.init(e,t)}),c0=$(`$ZodXID`,(e,t)=>{t.pattern??=G$,Q1.init(e,t)}),l0=$(`$ZodKSUID`,(e,t)=>{t.pattern??=K$,Q1.init(e,t)}),u0=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=f1(t),Q1.init(e,t)}),d0=$(`$ZodISODate`,(e,t)=>{t.pattern??=l1,Q1.init(e,t)}),f0=$(`$ZodISOTime`,(e,t)=>{t.pattern??=d1(t),Q1.init(e,t)}),p0=$(`$ZodISODuration`,(e,t)=>{t.pattern??=J$,Q1.init(e,t)}),m0=$(`$ZodIPv4`,(e,t)=>{t.pattern??=e1,Q1.init(e,t),e._zod.bag.format=`ipv4`}),h0=$(`$ZodIPv6`,(e,t)=>{t.pattern??=t1,Q1.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),g0=$(`$ZodMAC`,(e,t)=>{t.pattern??=n1(t.delimiter),Q1.init(e,t),e._zod.bag.format=`mac`}),_0=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=r1,Q1.init(e,t)}),v0=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=i1,Q1.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function y0(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var b0=$(`$ZodBase64`,(e,t)=>{t.pattern??=a1,Q1.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{y0(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function x0(e){if(!o1.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return y0(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var S0=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=o1,Q1.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{x0(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),C0=$(`$ZodE164`,(e,t)=>{t.pattern??=s1,Q1.init(e,t)});function w0(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var T0=$(`$ZodJWT`,(e,t)=>{Q1.init(e,t),e._zod.check=n=>{w0(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),E0=$(`$ZodCustomStringFormat`,(e,t)=>{Q1.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),D0=$(`$ZodNumber`,(e,t)=>{X1.init(e,t),e._zod.pattern=e._zod.bag.pattern??g1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),O0=$(`$ZodNumberFormat`,(e,t)=>{k1.init(e,t),D0.init(e,t)}),k0=$(`$ZodBoolean`,(e,t)=>{X1.init(e,t),e._zod.pattern=_1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),A0=$(`$ZodBigInt`,(e,t)=>{X1.init(e,t),e._zod.pattern=m1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),j0=$(`$ZodBigIntFormat`,(e,t)=>{A1.init(e,t),A0.init(e,t)}),M0=$(`$ZodSymbol`,(e,t)=>{X1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),N0=$(`$ZodUndefined`,(e,t)=>{X1.init(e,t),e._zod.pattern=y1,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),P0=$(`$ZodNull`,(e,t)=>{X1.init(e,t),e._zod.pattern=v1,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),F0=$(`$ZodAny`,(e,t)=>{X1.init(e,t),e._zod.parse=e=>e}),I0=$(`$ZodUnknown`,(e,t)=>{X1.init(e,t),e._zod.parse=e=>e}),L0=$(`$ZodNever`,(e,t)=>{X1.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),R0=$(`$ZodVoid`,(e,t)=>{X1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),z0=$(`$ZodDate`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function B0(e,t,n){e.issues.length&&t.issues.push(...c$(n,e.issues)),t.value[n]=e.value}var V0=$(`$ZodArray`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>B0(t,n,e))):B0(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H0(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...c$(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function U0(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=i$(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function W0(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H0(e,n,i,t,u))):H0(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var G0=$(`$ZodObject`,(e,t)=>{if(X1.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=LQ(()=>U0(t));HQ(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=JQ,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>H0(n,t,e,s,r))):H0(i,t,e,s,r)}return i?W0(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),K0=$(`$ZodObjectJIT`,(e,t)=>{G0.init(e,t);let n=e._zod.parse,r=LQ(()=>U0(t)),i=e=>{let t=new J1([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=GQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=GQ(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
580
|
+
`))}},X1={major:4,minor:3,patch:5},Z1=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=X1;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=c$(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new AQ;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=c$(e,t))});else{if(e.issues.length===t)continue;r||=c$(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(c$(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new AQ;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new AQ;return o.then(e=>t(e,r,a))}return t(o,r,a)}}UQ(e,`~standard`,()=>({validate:t=>{try{let n=j$(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return N$(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Q1=$(`$ZodString`,(e,t)=>{Z1.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??m1(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),$1=$(`$ZodStringFormat`,(e,t)=>{R1.init(e,t),Q1.init(e,t)}),e0=$(`$ZodGUID`,(e,t)=>{t.pattern??=X$,$1.init(e,t)}),t0=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Z$(e)}else t.pattern??=Z$();$1.init(e,t)}),n0=$(`$ZodEmail`,(e,t)=>{t.pattern??=Q$,$1.init(e,t)}),r0=$(`$ZodURL`,(e,t)=>{$1.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(i.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),i0=$(`$ZodEmoji`,(e,t)=>{t.pattern??=e1(),$1.init(e,t)}),a0=$(`$ZodNanoID`,(e,t)=>{t.pattern??=J$,$1.init(e,t)}),o0=$(`$ZodCUID`,(e,t)=>{t.pattern??=U$,$1.init(e,t)}),s0=$(`$ZodCUID2`,(e,t)=>{t.pattern??=W$,$1.init(e,t)}),c0=$(`$ZodULID`,(e,t)=>{t.pattern??=G$,$1.init(e,t)}),l0=$(`$ZodXID`,(e,t)=>{t.pattern??=K$,$1.init(e,t)}),u0=$(`$ZodKSUID`,(e,t)=>{t.pattern??=q$,$1.init(e,t)}),d0=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=p1(t),$1.init(e,t)}),f0=$(`$ZodISODate`,(e,t)=>{t.pattern??=u1,$1.init(e,t)}),p0=$(`$ZodISOTime`,(e,t)=>{t.pattern??=f1(t),$1.init(e,t)}),m0=$(`$ZodISODuration`,(e,t)=>{t.pattern??=Y$,$1.init(e,t)}),h0=$(`$ZodIPv4`,(e,t)=>{t.pattern??=t1,$1.init(e,t),e._zod.bag.format=`ipv4`}),g0=$(`$ZodIPv6`,(e,t)=>{t.pattern??=n1,$1.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),_0=$(`$ZodMAC`,(e,t)=>{t.pattern??=r1(t.delimiter),$1.init(e,t),e._zod.bag.format=`mac`}),v0=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=i1,$1.init(e,t)}),y0=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=a1,$1.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function b0(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var x0=$(`$ZodBase64`,(e,t)=>{t.pattern??=o1,$1.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{b0(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function S0(e){if(!s1.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return b0(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var C0=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=s1,$1.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{S0(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),w0=$(`$ZodE164`,(e,t)=>{t.pattern??=c1,$1.init(e,t)});function T0(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var E0=$(`$ZodJWT`,(e,t)=>{$1.init(e,t),e._zod.check=n=>{T0(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),D0=$(`$ZodCustomStringFormat`,(e,t)=>{$1.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),O0=$(`$ZodNumber`,(e,t)=>{Z1.init(e,t),e._zod.pattern=e._zod.bag.pattern??_1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),k0=$(`$ZodNumberFormat`,(e,t)=>{A1.init(e,t),O0.init(e,t)}),A0=$(`$ZodBoolean`,(e,t)=>{Z1.init(e,t),e._zod.pattern=v1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),j0=$(`$ZodBigInt`,(e,t)=>{Z1.init(e,t),e._zod.pattern=h1,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),M0=$(`$ZodBigIntFormat`,(e,t)=>{j1.init(e,t),j0.init(e,t)}),N0=$(`$ZodSymbol`,(e,t)=>{Z1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),P0=$(`$ZodUndefined`,(e,t)=>{Z1.init(e,t),e._zod.pattern=b1,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),F0=$(`$ZodNull`,(e,t)=>{Z1.init(e,t),e._zod.pattern=y1,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),I0=$(`$ZodAny`,(e,t)=>{Z1.init(e,t),e._zod.parse=e=>e}),L0=$(`$ZodUnknown`,(e,t)=>{Z1.init(e,t),e._zod.parse=e=>e}),R0=$(`$ZodNever`,(e,t)=>{Z1.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),z0=$(`$ZodVoid`,(e,t)=>{Z1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),B0=$(`$ZodDate`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function V0(e,t,n){e.issues.length&&t.issues.push(...l$(n,e.issues)),t.value[n]=e.value}var H0=$(`$ZodArray`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>V0(t,n,e))):V0(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function U0(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...l$(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function W0(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=a$(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function G0(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>U0(e,n,i,t,u))):U0(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var K0=$(`$ZodObject`,(e,t)=>{if(Z1.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=RQ(()=>W0(t));UQ(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=YQ,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>U0(n,t,e,s,r))):U0(i,t,e,s,r)}return i?G0(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),q0=$(`$ZodObjectJIT`,(e,t)=>{K0.init(e,t);let n=e._zod.parse,r=RQ(()=>W0(t)),i=e=>{let t=new Y1([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=KQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=KQ(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
581
581
|
if (${n}.issues.length) {
|
|
582
582
|
if (${o} in input) {
|
|
583
583
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -611,9 +611,9 @@ print(f"Available resources: {[resource.name for resource in resources]}")
|
|
|
611
611
|
newResult[${o}] = ${n}.value;
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=JQ,s=!jQ.jitless,c=s&&YQ.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?W0([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function q0(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!s$(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>u$(e,r,MQ())))}),t)}var J0=$(`$ZodUnion`,(e,t)=>{X1.init(e,t),HQ(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),HQ(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),HQ(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),HQ(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>zQ(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>q0(t,i,e,a)):q0(s,i,e,a)}});function Y0(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>u$(e,r,MQ())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}var X0=$(`$ZodXor`,(e,t)=>{J0.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>Y0(t,i,e,a)):Y0(s,i,e,a)}}),Z0=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,J0.init(e,t);let n=e._zod.parse;HQ(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=LQ(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!JQ(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),Q0=$(`$ZodIntersection`,(e,t)=>{X1.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>e2(e,t,n)):e2(e,i,a)}});function $0(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(XQ(e)&&XQ(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=$0(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$0(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function e2(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),s$(e))return e;let o=$0(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var t2=$(`$ZodTuple`,(e,t)=>{X1.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length<c-1;if(t||i)return r.issues.push({...t?{code:`too_big`,maximum:n.length,inclusive:!0}:{code:`too_small`,minimum:n.length},input:a,inst:e,origin:`array`}),r}let l=-1;for(let e of n){if(l++,l>=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>n2(e,r,l))):n2(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>n2(e,r,l))):n2(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function n2(e,t,n){e.issues.length&&t.issues.push(...c$(n,e.issues)),t.value[n]=e.value}var r2=$(`$ZodRecord`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!XQ(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...c$(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...c$(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&g1.test(o)&&s.issues.length&&s.issues.some(e=>e.code===`invalid_type`&&e.expected===`number`)){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>u$(e,r,MQ())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...c$(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...c$(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),i2=$(`$ZodMap`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{a2(t,a,n,o,i,e,r)})):a2(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function a2(e,t,n,r,i,a,o){e.issues.length&&(QQ.has(typeof r)?n.issues.push(...c$(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>u$(e,o,MQ()))})),t.issues.length&&(QQ.has(typeof r)?n.issues.push(...c$(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>u$(e,o,MQ()))})),n.value.set(e.value,t.value)}var o2=$(`$ZodSet`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>s2(e,n))):s2(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function s2(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var c2=$(`$ZodEnum`,(e,t)=>{X1.init(e,t);let n=PQ(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>QQ.has(typeof e)).map(e=>typeof e==`string`?e$(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),l2=$(`$ZodLiteral`,(e,t)=>{if(X1.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?e$(e):e?e$(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),u2=$(`$ZodFile`,(e,t)=>{X1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),d2=$(`$ZodTransform`,(e,t)=>{X1.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new AQ(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new kQ;return n.value=i,n}});function f2(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var p2=$(`$ZodOptional`,(e,t)=>{X1.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,HQ(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),HQ(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zQ(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>f2(t,e.value)):f2(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),m2=$(`$ZodExactOptional`,(e,t)=>{p2.init(e,t),HQ(e._zod,`values`,()=>t.innerType._zod.values),HQ(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),h2=$(`$ZodNullable`,(e,t)=>{X1.init(e,t),HQ(e._zod,`optin`,()=>t.innerType._zod.optin),HQ(e._zod,`optout`,()=>t.innerType._zod.optout),HQ(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zQ(e.source)}|null)$`):void 0}),HQ(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),g2=$(`$ZodDefault`,(e,t)=>{X1.init(e,t),e._zod.optin=`optional`,HQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>_2(e,t)):_2(r,t)}});function _2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var v2=$(`$ZodPrefault`,(e,t)=>{X1.init(e,t),e._zod.optin=`optional`,HQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),y2=$(`$ZodNonOptional`,(e,t)=>{X1.init(e,t),HQ(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>b2(t,e)):b2(i,e)}});function b2(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var x2=$(`$ZodSuccess`,(e,t)=>{X1.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new AQ(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),S2=$(`$ZodCatch`,(e,t)=>{X1.init(e,t),HQ(e._zod,`optin`,()=>t.innerType._zod.optin),HQ(e._zod,`optout`,()=>t.innerType._zod.optout),HQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>u$(e,n,MQ()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>u$(e,n,MQ()))},input:e.value}),e.issues=[]),e)}}),C2=$(`$ZodNaN`,(e,t)=>{X1.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),w2=$(`$ZodPipe`,(e,t)=>{X1.init(e,t),HQ(e._zod,`values`,()=>t.in._zod.values),HQ(e._zod,`optin`,()=>t.in._zod.optin),HQ(e._zod,`optout`,()=>t.out._zod.optout),HQ(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>T2(e,t.in,n)):T2(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>T2(e,t.out,n)):T2(r,t.out,n)}});function T2(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var E2=$(`$ZodCodec`,(e,t)=>{X1.init(e,t),HQ(e._zod,`values`,()=>t.in._zod.values),HQ(e._zod,`optin`,()=>t.in._zod.optin),HQ(e._zod,`optout`,()=>t.out._zod.optout),HQ(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>D2(e,t,n)):D2(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>D2(e,t,n)):D2(r,t,n)}}});function D2(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>O2(e,r,t.out,n)):O2(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>O2(e,r,t.in,n)):O2(e,r,t.in,n)}}function O2(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var k2=$(`$ZodReadonly`,(e,t)=>{X1.init(e,t),HQ(e._zod,`propValues`,()=>t.innerType._zod.propValues),HQ(e._zod,`values`,()=>t.innerType._zod.values),HQ(e._zod,`optin`,()=>t.innerType?._zod?.optin),HQ(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(A2):A2(r)}});function A2(e){return e.value=Object.freeze(e.value),e}var j2=$(`$ZodTemplateLiteral`,(e,t)=>{X1.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||$Q.has(typeof e))n.push(e$(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),M2=$(`$ZodFunction`,(e,t)=>(X1.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?E$(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?E$(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await O$(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await O$(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new t2({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:`function`,input:e._def.input,output:t}),e)),N2=$(`$ZodPromise`,(e,t)=>{X1.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),P2=$(`$ZodLazy`,(e,t)=>{X1.init(e,t),HQ(e._zod,`innerType`,()=>t.getter()),HQ(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),HQ(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),HQ(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),HQ(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),F2=$(`$ZodCustom`,(e,t)=>{w1.init(e,t),X1.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>I2(t,n,r,e));I2(i,n,r,e)}});function I2(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(m$(e))}}var L2={};wQ(L2,{zhTW:()=>rAe,zhCN:()=>tAe,yo:()=>aAe,vi:()=>$ke,uz:()=>Zke,ur:()=>Yke,uk:()=>K2,ua:()=>qke,tr:()=>Gke,th:()=>Uke,ta:()=>Vke,sv:()=>zke,sl:()=>Lke,ru:()=>Fke,pt:()=>Nke,ps:()=>kke,pl:()=>jke,ota:()=>Dke,no:()=>Tke,nl:()=>Cke,ms:()=>xke,mk:()=>yke,lt:()=>_ke,ko:()=>hke,km:()=>H2,kh:()=>pke,ka:()=>dke,ja:()=>lke,it:()=>ske,is:()=>ake,id:()=>rke,hy:()=>tke,hu:()=>$Oe,he:()=>ZOe,frCA:()=>YOe,fr:()=>qOe,fi:()=>GOe,fa:()=>UOe,es:()=>VOe,eo:()=>zOe,en:()=>z2,de:()=>IOe,da:()=>POe,cs:()=>MOe,ca:()=>AOe,bg:()=>OOe,be:()=>EOe,az:()=>wOe,ar:()=>SOe});var xOe=()=>{let e={string:{unit:`حرف`,verb:`أن يحوي`},file:{unit:`بايت`,verb:`أن يحوي`},array:{unit:`عنصر`,verb:`أن يحوي`},set:{unit:`عنصر`,verb:`أن يحوي`}};function t(t){return e[t]??null}let n={regex:`مدخل`,email:`بريد إلكتروني`,url:`رابط`,emoji:`إيموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاريخ ووقت بمعيار ISO`,date:`تاريخ بمعيار ISO`,time:`وقت بمعيار ISO`,duration:`مدة بمعيار ISO`,ipv4:`عنوان IPv4`,ipv6:`عنوان IPv6`,cidrv4:`مدى عناوين بصيغة IPv4`,cidrv6:`مدى عناوين بصيغة IPv6`,base64:`نَص بترميز base64-encoded`,base64url:`نَص بترميز base64url-encoded`,json_string:`نَص على هيئة JSON`,e164:`رقم هاتف بمعيار E.164`,jwt:`JWT`,template_literal:`مدخل`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${e.expected}، ولكن تم إدخال ${i}`:`مدخلات غير مقبولة: يفترض إدخال ${t}، ولكن تم إدخال ${i}`}case`invalid_value`:return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${r$(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?` أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()} ${r.unit??`عنصر`}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()} ${r.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:t.format===`ends_with`?`نَص غير مقبول: يجب أن ينتهي بـ "${t.suffix}"`:t.format===`includes`?`نَص غير مقبول: يجب أن يتضمَّن "${t.includes}"`:t.format===`regex`?`نَص غير مقبول: يجب أن يطابق النمط ${t.pattern}`:`${n[t.format]??e.format} غير مقبول`}case`not_multiple_of`:return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case`unrecognized_keys`:return`معرف${e.keys.length>1?`ات`:``} غريب${e.keys.length>1?`ة`:``}: ${FQ(e.keys,`، `)}`;case`invalid_key`:return`معرف غير مقبول في ${e.origin}`;case`invalid_union`:return`مدخل غير مقبول`;case`invalid_element`:return`مدخل غير مقبول في ${e.origin}`;default:return`مدخل غير مقبول`}}};function SOe(){return{localeError:xOe()}}var COe=()=>{let e={string:{unit:`simvol`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`element`,verb:`olmalıdır`},set:{unit:`element`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Yanlış dəyər: gözlənilən instanceof ${e.expected}, daxil olan ${i}`:`Yanlış dəyər: gözlənilən ${t}, daxil olan ${i}`}case`invalid_value`:return e.values.length===1?`Yanlış dəyər: gözlənilən ${r$(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()} ${r.unit??`element`}`:`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Yanlış mətn: "${t.prefix}" ilə başlamalıdır`:t.format===`ends_with`?`Yanlış mətn: "${t.suffix}" ilə bitməlidir`:t.format===`includes`?`Yanlış mətn: "${t.includes}" daxil olmalıdır`:t.format===`regex`?`Yanlış mətn: ${t.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[t.format]??e.format}`}case`not_multiple_of`:return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case`unrecognized_keys`:return`Tanınmayan açar${e.keys.length>1?`lar`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} daxilində yanlış açar`;case`invalid_union`:return`Yanlış dəyər`;case`invalid_element`:return`${e.origin} daxilində yanlış dəyər`;default:return`Yanlış dəyər`}}};function wOe(){return{localeError:COe()}}function R2(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var TOe=()=>{let e={string:{unit:{one:`сімвал`,few:`сімвалы`,many:`сімвалаў`},verb:`мець`},array:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},set:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},file:{unit:{one:`байт`,few:`байты`,many:`байтаў`},verb:`мець`}};function t(t){return e[t]??null}let n={regex:`увод`,email:`email адрас`,url:`URL`,emoji:`эмодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата і час`,date:`ISO дата`,time:`ISO час`,duration:`ISO працягласць`,ipv4:`IPv4 адрас`,ipv6:`IPv6 адрас`,cidrv4:`IPv4 дыяпазон`,cidrv6:`IPv6 дыяпазон`,base64:`радок у фармаце base64`,base64url:`радок у фармаце base64url`,json_string:`JSON радок`,e164:`нумар E.164`,jwt:`JWT`,template_literal:`увод`},r={nan:`NaN`,number:`лік`,array:`масіў`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Няправільны ўвод: чакаўся instanceof ${e.expected}, атрымана ${i}`:`Няправільны ўвод: чакаўся ${t}, атрымана ${i}`}case`invalid_value`:return e.values.length===1?`Няправільны ўвод: чакалася ${r$(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=R2(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна ${r.verb} ${n}${e.maximum.toString()} ${t}`}return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна быць ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=R2(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${r.verb} ${n}${e.minimum.toString()} ${t}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Няправільны радок: павінен пачынацца з "${t.prefix}"`:t.format===`ends_with`?`Няправільны радок: павінен заканчвацца на "${t.suffix}"`:t.format===`includes`?`Няправільны радок: павінен змяшчаць "${t.includes}"`:t.format===`regex`?`Няправільны радок: павінен адпавядаць шаблону ${t.pattern}`:`Няправільны ${n[t.format]??e.format}`}case`not_multiple_of`:return`Няправільны лік: павінен быць кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспазнаны ${e.keys.length>1?`ключы`:`ключ`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Няправільны ключ у ${e.origin}`;case`invalid_union`:return`Няправільны ўвод`;case`invalid_element`:return`Няправільнае значэнне ў ${e.origin}`;default:return`Няправільны ўвод`}}};function EOe(){return{localeError:TOe()}}var DOe=()=>{let e={string:{unit:`символа`,verb:`да съдържа`},file:{unit:`байта`,verb:`да съдържа`},array:{unit:`елемента`,verb:`да съдържа`},set:{unit:`елемента`,verb:`да съдържа`}};function t(t){return e[t]??null}let n={regex:`вход`,email:`имейл адрес`,url:`URL`,emoji:`емоджи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO време`,date:`ISO дата`,time:`ISO време`,duration:`ISO продължителност`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`base64-кодиран низ`,base64url:`base64url-кодиран низ`,json_string:`JSON низ`,e164:`E.164 номер`,jwt:`JWT`,template_literal:`вход`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Невалиден вход: очакван instanceof ${e.expected}, получен ${i}`:`Невалиден вход: очакван ${t}, получен ${i}`}case`invalid_value`:return e.values.length===1?`Невалиден вход: очакван ${r$(e.values[0])}`:`Невалидна опция: очаквано едно от ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Твърде голямо: очаква се ${e.origin??`стойност`} да съдържа ${n}${e.maximum.toString()} ${r.unit??`елемента`}`:`Твърде голямо: очаква се ${e.origin??`стойност`} да бъде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Твърде малко: очаква се ${e.origin} да съдържа ${n}${e.minimum.toString()} ${r.unit}`:`Твърде малко: очаква се ${e.origin} да бъде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;if(t.format===`starts_with`)return`Невалиден низ: трябва да започва с "${t.prefix}"`;if(t.format===`ends_with`)return`Невалиден низ: трябва да завършва с "${t.suffix}"`;if(t.format===`includes`)return`Невалиден низ: трябва да включва "${t.includes}"`;if(t.format===`regex`)return`Невалиден низ: трябва да съвпада с ${t.pattern}`;let r=`Невалиден`;return t.format===`emoji`&&(r=`Невалидно`),t.format===`datetime`&&(r=`Невалидно`),t.format===`date`&&(r=`Невалидна`),t.format===`time`&&(r=`Невалидно`),t.format===`duration`&&(r=`Невалидна`),`${r} ${n[t.format]??e.format}`}case`not_multiple_of`:return`Невалидно число: трябва да бъде кратно на ${e.divisor}`;case`unrecognized_keys`:return`Неразпознат${e.keys.length>1?`и`:``} ключ${e.keys.length>1?`ове`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Невалиден ключ в ${e.origin}`;case`invalid_union`:return`Невалиден вход`;case`invalid_element`:return`Невалидна стойност в ${e.origin}`;default:return`Невалиден вход`}}};function OOe(){return{localeError:DOe()}}var kOe=()=>{let e={string:{unit:`caràcters`,verb:`contenir`},file:{unit:`bytes`,verb:`contenir`},array:{unit:`elements`,verb:`contenir`},set:{unit:`elements`,verb:`contenir`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`adreça electrònica`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`durada ISO`,ipv4:`adreça IPv4`,ipv6:`adreça IPv6`,cidrv4:`rang IPv4`,cidrv6:`rang IPv6`,base64:`cadena codificada en base64`,base64url:`cadena codificada en base64url`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipus invàlid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invàlid: s'esperava ${t}, s'ha rebut ${i}`}case`invalid_value`:return e.values.length===1?`Valor invàlid: s'esperava ${r$(e.values[0])}`:`Opció invàlida: s'esperava una de ${FQ(e.values,` o `)}`;case`too_big`:{let n=e.inclusive?`com a màxim`:`menys de`,r=t(e.origin);return r?`Massa gran: s'esperava que ${e.origin??`el valor`} contingués ${n} ${e.maximum.toString()} ${r.unit??`elements`}`:`Massa gran: s'esperava que ${e.origin??`el valor`} fos ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`com a mínim`:`més de`,r=t(e.origin);return r?`Massa petit: s'esperava que ${e.origin} contingués ${n} ${e.minimum.toString()} ${r.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Format invàlid: ha de començar amb "${t.prefix}"`:t.format===`ends_with`?`Format invàlid: ha d'acabar amb "${t.suffix}"`:t.format===`includes`?`Format invàlid: ha d'incloure "${t.includes}"`:t.format===`regex`?`Format invàlid: ha de coincidir amb el patró ${t.pattern}`:`Format invàlid per a ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case`unrecognized_keys`:return`Clau${e.keys.length>1?`s`:``} no reconeguda${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Clau invàlida a ${e.origin}`;case`invalid_union`:return`Entrada invàlida`;case`invalid_element`:return`Element invàlid a ${e.origin}`;default:return`Entrada invàlida`}}};function AOe(){return{localeError:kOe()}}var jOe=()=>{let e={string:{unit:`znaků`,verb:`mít`},file:{unit:`bajtů`,verb:`mít`},array:{unit:`prvků`,verb:`mít`},set:{unit:`prvků`,verb:`mít`}};function t(t){return e[t]??null}let n={regex:`regulární výraz`,email:`e-mailová adresa`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`datum a čas ve formátu ISO`,date:`datum ve formátu ISO`,time:`čas ve formátu ISO`,duration:`doba trvání ISO`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`rozsah IPv4`,cidrv6:`rozsah IPv6`,base64:`řetězec zakódovaný ve formátu base64`,base64url:`řetězec zakódovaný ve formátu base64url`,json_string:`řetězec ve formátu JSON`,e164:`číslo E.164`,jwt:`JWT`,template_literal:`vstup`},r={nan:`NaN`,number:`číslo`,string:`řetězec`,function:`funkce`,array:`pole`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: očekáváno instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: očekáváno ${t}, obdrženo ${i}`}case`invalid_value`:return e.values.length===1?`Neplatný vstup: očekáváno ${r$(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Hodnota je příliš velká: ${e.origin??`hodnota`} musí mít ${n}${e.maximum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš velká: ${e.origin??`hodnota`} musí být ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Hodnota je příliš malá: ${e.origin??`hodnota`} musí mít ${n}${e.minimum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš malá: ${e.origin??`hodnota`} musí být ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neplatný řetězec: musí začínat na "${t.prefix}"`:t.format===`ends_with`?`Neplatný řetězec: musí končit na "${t.suffix}"`:t.format===`includes`?`Neplatný řetězec: musí obsahovat "${t.includes}"`:t.format===`regex`?`Neplatný řetězec: musí odpovídat vzoru ${t.pattern}`:`Neplatný formát ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neplatné číslo: musí být násobkem ${e.divisor}`;case`unrecognized_keys`:return`Neznámé klíče: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Neplatný klíč v ${e.origin}`;case`invalid_union`:return`Neplatný vstup`;case`invalid_element`:return`Neplatná hodnota v ${e.origin}`;default:return`Neplatný vstup`}}};function MOe(){return{localeError:jOe()}}var NOe=()=>{let e={string:{unit:`tegn`,verb:`havde`},file:{unit:`bytes`,verb:`havde`},array:{unit:`elementer`,verb:`indeholdt`},set:{unit:`elementer`,verb:`indeholdt`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-mailadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslæt`,date:`ISO-dato`,time:`ISO-klokkeslæt`,duration:`ISO-varighed`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodet streng`,base64url:`base64url-kodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,string:`streng`,number:`tal`,boolean:`boolean`,array:`liste`,object:`objekt`,set:`sæt`,file:`fil`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig værdi: forventede ${r$(e.values[0])}`:`Ugyldigt valg: forventede en af følgende ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For stor: forventede ${a??`value`} ${i.verb} ${n} ${e.maximum.toString()} ${i.unit??`elementer`}`:`For stor: forventede ${a??`value`} havde ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For lille: forventede ${a} ${i.verb} ${n} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${a} havde ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: skal starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: skal ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: skal indeholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: skal matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldigt tal: skal være deleligt med ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukendte nøgler`:`Ukendt nøgle`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøgle i ${e.origin}`;case`invalid_union`:return`Ugyldigt input: matcher ingen af de tilladte typer`;case`invalid_element`:return`Ugyldig værdi i ${e.origin}`;default:return`Ugyldigt input`}}};function POe(){return{localeError:NOe()}}var FOe=()=>{let e={string:{unit:`Zeichen`,verb:`zu haben`},file:{unit:`Bytes`,verb:`zu haben`},array:{unit:`Elemente`,verb:`zu haben`},set:{unit:`Elemente`,verb:`zu haben`}};function t(t){return e[t]??null}let n={regex:`Eingabe`,email:`E-Mail-Adresse`,url:`URL`,emoji:`Emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-Datum und -Uhrzeit`,date:`ISO-Datum`,time:`ISO-Uhrzeit`,duration:`ISO-Dauer`,ipv4:`IPv4-Adresse`,ipv6:`IPv6-Adresse`,cidrv4:`IPv4-Bereich`,cidrv6:`IPv6-Bereich`,base64:`Base64-codierter String`,base64url:`Base64-URL-codierter String`,json_string:`JSON-String`,e164:`E.164-Nummer`,jwt:`JWT`,template_literal:`Eingabe`},r={nan:`NaN`,number:`Zahl`,array:`Array`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case`invalid_value`:return e.values.length===1?`Ungültige Eingabe: erwartet ${r$(e.values[0])}`:`Ungültige Option: erwartet eine von ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ${r.unit??`Elemente`} hat`:`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ist`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ${r.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ist`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ungültiger String: muss mit "${t.prefix}" beginnen`:t.format===`ends_with`?`Ungültiger String: muss mit "${t.suffix}" enden`:t.format===`includes`?`Ungültiger String: muss "${t.includes}" enthalten`:t.format===`regex`?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case`unrecognized_keys`:return`${e.keys.length>1?`Unbekannte Schlüssel`:`Unbekannter Schlüssel`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Ungültiger Schlüssel in ${e.origin}`;case`invalid_union`:return`Ungültige Eingabe`;case`invalid_element`:return`Ungültiger Wert in ${e.origin}`;default:return`Ungültige Eingabe`}}};function IOe(){return{localeError:FOe()}}var LOe=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${r$(e.values[0])}`:`Invalid option: expected one of ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function z2(){return{localeError:LOe()}}var ROe=()=>{let e={string:{unit:`karaktrojn`,verb:`havi`},file:{unit:`bajtojn`,verb:`havi`},array:{unit:`elementojn`,verb:`havi`},set:{unit:`elementojn`,verb:`havi`}};function t(t){return e[t]??null}let n={regex:`enigo`,email:`retadreso`,url:`URL`,emoji:`emoĝio`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datotempo`,date:`ISO-dato`,time:`ISO-tempo`,duration:`ISO-daŭro`,ipv4:`IPv4-adreso`,ipv6:`IPv6-adreso`,cidrv4:`IPv4-rango`,cidrv6:`IPv6-rango`,base64:`64-ume kodita karaktraro`,base64url:`URL-64-ume kodita karaktraro`,json_string:`JSON-karaktraro`,e164:`E.164-nombro`,jwt:`JWT`,template_literal:`enigo`},r={nan:`NaN`,number:`nombro`,array:`tabelo`,null:`senvalora`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiĝis instanceof ${e.expected}, riceviĝis ${i}`:`Nevalida enigo: atendiĝis ${t}, riceviĝis ${i}`}case`invalid_value`:return e.values.length===1?`Nevalida enigo: atendiĝis ${r$(e.values[0])}`:`Nevalida opcio: atendiĝis unu el ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()} ${r.unit??`elementojn`}`:`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Tro malgranda: atendiĝis ke ${e.origin} havu ${n}${e.minimum.toString()} ${r.unit}`:`Tro malgranda: atendiĝis ke ${e.origin} estu ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nevalida karaktraro: devas komenciĝi per "${t.prefix}"`:t.format===`ends_with`?`Nevalida karaktraro: devas finiĝi per "${t.suffix}"`:t.format===`includes`?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:t.format===`regex`?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case`unrecognized_keys`:return`Nekonata${e.keys.length>1?`j`:``} ŝlosilo${e.keys.length>1?`j`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Nevalida ŝlosilo en ${e.origin}`;case`invalid_union`:return`Nevalida enigo`;case`invalid_element`:return`Nevalida valoro en ${e.origin}`;default:return`Nevalida enigo`}}};function zOe(){return{localeError:ROe()}}var BOe=()=>{let e={string:{unit:`caracteres`,verb:`tener`},file:{unit:`bytes`,verb:`tener`},array:{unit:`elementos`,verb:`tener`},set:{unit:`elementos`,verb:`tener`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`dirección de correo electrónico`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`fecha y hora ISO`,date:`fecha ISO`,time:`hora ISO`,duration:`duración ISO`,ipv4:`dirección IPv4`,ipv6:`dirección IPv6`,cidrv4:`rango IPv4`,cidrv6:`rango IPv6`,base64:`cadena codificada en base64`,base64url:`URL codificada en base64`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,string:`texto`,number:`número`,boolean:`booleano`,array:`arreglo`,object:`objeto`,set:`conjunto`,file:`archivo`,date:`fecha`,bigint:`número grande`,symbol:`símbolo`,undefined:`indefinido`,null:`nulo`,function:`función`,map:`mapa`,record:`registro`,tuple:`tupla`,enum:`enumeración`,union:`unión`,literal:`literal`,promise:`promesa`,void:`vacío`,never:`nunca`,unknown:`desconocido`,any:`cualquiera`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrada inválida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada inválida: se esperaba ${t}, recibido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: se esperaba ${r$(e.values[0])}`:`Opción inválida: se esperaba una de ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${a??`valor`} tuviera ${n}${e.maximum.toString()} ${i.unit??`elementos`}`:`Demasiado grande: se esperaba que ${a??`valor`} fuera ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado pequeño: se esperaba que ${a} tuviera ${n}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeño: se esperaba que ${a} fuera ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Cadena inválida: debe comenzar con "${t.prefix}"`:t.format===`ends_with`?`Cadena inválida: debe terminar en "${t.suffix}"`:t.format===`includes`?`Cadena inválida: debe incluir "${t.includes}"`:t.format===`regex`?`Cadena inválida: debe coincidir con el patrón ${t.pattern}`:`Inválido ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número inválido: debe ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Llave${e.keys.length>1?`s`:``} desconocida${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Llave inválida en ${r[e.origin]??e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido en ${r[e.origin]??e.origin}`;default:return`Entrada inválida`}}};function VOe(){return{localeError:BOe()}}var HOe=()=>{let e={string:{unit:`کاراکتر`,verb:`داشته باشد`},file:{unit:`بایت`,verb:`داشته باشد`},array:{unit:`آیتم`,verb:`داشته باشد`},set:{unit:`آیتم`,verb:`داشته باشد`}};function t(t){return e[t]??null}let n={regex:`ورودی`,email:`آدرس ایمیل`,url:`URL`,emoji:`ایموجی`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاریخ و زمان ایزو`,date:`تاریخ ایزو`,time:`زمان ایزو`,duration:`مدت زمان ایزو`,ipv4:`IPv4 آدرس`,ipv6:`IPv6 آدرس`,cidrv4:`IPv4 دامنه`,cidrv6:`IPv6 دامنه`,base64:`base64-encoded رشته`,base64url:`base64url-encoded رشته`,json_string:`JSON رشته`,e164:`E.164 عدد`,jwt:`JWT`,template_literal:`ورودی`},r={nan:`NaN`,number:`عدد`,array:`آرایه`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ورودی نامعتبر: میبایست instanceof ${e.expected} میبود، ${i} دریافت شد`:`ورودی نامعتبر: میبایست ${t} میبود، ${i} دریافت شد`}case`invalid_value`:return e.values.length===1?`ورودی نامعتبر: میبایست ${r$(e.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${FQ(e.values,`|`)} میبود`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصر`} باشد`:`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} باشد`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} باشد`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`رشته نامعتبر: باید با "${t.prefix}" شروع شود`:t.format===`ends_with`?`رشته نامعتبر: باید با "${t.suffix}" تمام شود`:t.format===`includes`?`رشته نامعتبر: باید شامل "${t.includes}" باشد`:t.format===`regex`?`رشته نامعتبر: باید با الگوی ${t.pattern} مطابقت داشته باشد`:`${n[t.format]??e.format} نامعتبر`}case`not_multiple_of`:return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case`unrecognized_keys`:return`کلید${e.keys.length>1?`های`:``} ناشناس: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`کلید ناشناس در ${e.origin}`;case`invalid_union`:return`ورودی نامعتبر`;case`invalid_element`:return`مقدار نامعتبر در ${e.origin}`;default:return`ورودی نامعتبر`}}};function UOe(){return{localeError:HOe()}}var WOe=()=>{let e={string:{unit:`merkkiä`,subject:`merkkijonon`},file:{unit:`tavua`,subject:`tiedoston`},array:{unit:`alkiota`,subject:`listan`},set:{unit:`alkiota`,subject:`joukon`},number:{unit:``,subject:`luvun`},bigint:{unit:``,subject:`suuren kokonaisluvun`},int:{unit:``,subject:`kokonaisluvun`},date:{unit:``,subject:`päivämäärän`}};function t(t){return e[t]??null}let n={regex:`säännöllinen lauseke`,email:`sähköpostiosoite`,url:`URL-osoite`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-aikaleima`,date:`ISO-päivämäärä`,time:`ISO-aika`,duration:`ISO-kesto`,ipv4:`IPv4-osoite`,ipv6:`IPv6-osoite`,cidrv4:`IPv4-alue`,cidrv6:`IPv6-alue`,base64:`base64-koodattu merkkijono`,base64url:`base64url-koodattu merkkijono`,json_string:`JSON-merkkijono`,e164:`E.164-luku`,jwt:`JWT`,template_literal:`templaattimerkkijono`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case`invalid_value`:return e.values.length===1?`Virheellinen syöte: täytyy olla ${r$(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Liian suuri: ${r.subject} täytyy olla ${n}${e.maximum.toString()} ${r.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Liian pieni: ${r.subject} täytyy olla ${n}${e.minimum.toString()} ${r.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Virheellinen syöte: täytyy alkaa "${t.prefix}"`:t.format===`ends_with`?`Virheellinen syöte: täytyy loppua "${t.suffix}"`:t.format===`includes`?`Virheellinen syöte: täytyy sisältää "${t.includes}"`:t.format===`regex`?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${t.pattern}`:`Virheellinen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case`unrecognized_keys`:return`${e.keys.length>1?`Tuntemattomat avaimet`:`Tuntematon avain`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Virheellinen avain tietueessa`;case`invalid_union`:return`Virheellinen unioni`;case`invalid_element`:return`Virheellinen arvo joukossa`;default:return`Virheellinen syöte`}}};function GOe(){return{localeError:WOe()}}var KOe=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date et heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`,number:`nombre`,array:`tableau`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : instanceof ${e.expected} attendu, ${i} reçu`:`Entrée invalide : ${t} attendu, ${i} reçu`}case`invalid_value`:return e.values.length===1?`Entrée invalide : ${r$(e.values[0])} attendu`:`Option invalide : une valeur parmi ${FQ(e.values,`|`)} attendue`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Trop grand : ${e.origin??`valeur`} doit ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`élément(s)`}`:`Trop grand : ${e.origin??`valeur`} doit être ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Trop petit : ${e.origin} doit ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : ${e.origin} doit être ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au modèle ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function qOe(){return{localeError:KOe()}}var JOe=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse courriel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date-heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : attendu instanceof ${e.expected}, reçu ${i}`:`Entrée invalide : attendu ${t}, reçu ${i}`}case`invalid_value`:return e.values.length===1?`Entrée invalide : attendu ${r$(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`≤`:`<`,r=t(e.origin);return r?`Trop grand : attendu que ${e.origin??`la valeur`} ait ${n}${e.maximum.toString()} ${r.unit}`:`Trop grand : attendu que ${e.origin??`la valeur`} soit ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`≥`:`>`,r=t(e.origin);return r?`Trop petit : attendu que ${e.origin} ait ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : attendu que ${e.origin} soit ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au motif ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function YOe(){return{localeError:JOe()}}var XOe=()=>{let e={string:{label:`מחרוזת`,gender:`f`},number:{label:`מספר`,gender:`m`},boolean:{label:`ערך בוליאני`,gender:`m`},bigint:{label:`BigInt`,gender:`m`},date:{label:`תאריך`,gender:`m`},array:{label:`מערך`,gender:`m`},object:{label:`אובייקט`,gender:`m`},null:{label:`ערך ריק (null)`,gender:`m`},undefined:{label:`ערך לא מוגדר (undefined)`,gender:`m`},symbol:{label:`סימבול (Symbol)`,gender:`m`},function:{label:`פונקציה`,gender:`f`},map:{label:`מפה (Map)`,gender:`f`},set:{label:`קבוצה (Set)`,gender:`f`},file:{label:`קובץ`,gender:`m`},promise:{label:`Promise`,gender:`m`},NaN:{label:`NaN`,gender:`m`},unknown:{label:`ערך לא ידוע`,gender:`m`},value:{label:`ערך`,gender:`m`}},t={string:{unit:`תווים`,shortLabel:`קצר`,longLabel:`ארוך`},file:{unit:`בייטים`,shortLabel:`קטן`,longLabel:`גדול`},array:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},set:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},number:{unit:``,shortLabel:`קטן`,longLabel:`גדול`}},n=t=>t?e[t]:void 0,r=t=>{let r=n(t);return r?r.label:t??e.unknown.label},i=e=>`ה${r(e)}`,a=e=>(n(e)?.gender??`m`)===`f`?`צריכה להיות`:`צריך להיות`,o=e=>e?t[e]??null:null,s={regex:{label:`קלט`,gender:`m`},email:{label:`כתובת אימייל`,gender:`f`},url:{label:`כתובת רשת`,gender:`f`},emoji:{label:`אימוג'י`,gender:`m`},uuid:{label:`UUID`,gender:`m`},nanoid:{label:`nanoid`,gender:`m`},guid:{label:`GUID`,gender:`m`},cuid:{label:`cuid`,gender:`m`},cuid2:{label:`cuid2`,gender:`m`},ulid:{label:`ULID`,gender:`m`},xid:{label:`XID`,gender:`m`},ksuid:{label:`KSUID`,gender:`m`},datetime:{label:`תאריך וזמן ISO`,gender:`m`},date:{label:`תאריך ISO`,gender:`m`},time:{label:`זמן ISO`,gender:`m`},duration:{label:`משך זמן ISO`,gender:`m`},ipv4:{label:`כתובת IPv4`,gender:`f`},ipv6:{label:`כתובת IPv6`,gender:`f`},cidrv4:{label:`טווח IPv4`,gender:`m`},cidrv6:{label:`טווח IPv6`,gender:`m`},base64:{label:`מחרוזת בבסיס 64`,gender:`f`},base64url:{label:`מחרוזת בבסיס 64 לכתובות רשת`,gender:`f`},json_string:{label:`מחרוזת JSON`,gender:`f`},e164:{label:`מספר E.164`,gender:`m`},jwt:{label:`JWT`,gender:`m`},ends_with:{label:`קלט`,gender:`m`},includes:{label:`קלט`,gender:`m`},lowercase:{label:`קלט`,gender:`m`},starts_with:{label:`קלט`,gender:`m`},uppercase:{label:`קלט`,gender:`m`}},c={nan:`NaN`};return t=>{switch(t.code){case`invalid_type`:{let n=t.expected,i=c[n??``]??r(n),a=p$(t.input),o=c[a]??e[a]?.label??a;return/^[A-Z]/.test(t.expected)?`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`:`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case`invalid_value`:{if(t.values.length===1)return`ערך לא תקין: הערך חייב להיות ${r$(t.values[0])}`;let e=t.values.map(e=>r$(e));if(t.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let n=e[e.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${e.slice(0,-1).join(`, `)} או ${n}`}case`too_big`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.longLabel??`ארוך`} מדי: ${n} צריכה להכיל ${t.maximum.toString()} ${e?.unit??``} ${t.inclusive?`או פחות`:`לכל היותר`}`.trim();if(t.origin===`number`)return`גדול מדי: ${n} צריך להיות ${t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`}`;if(t.origin===`array`||t.origin===`set`)return`גדול מדי: ${n} ${t.origin===`set`?`צריכה`:`צריך`} להכיל ${t.inclusive?`${t.maximum} ${e?.unit??``} או פחות`:`פחות מ-${t.maximum} ${e?.unit??``}`}`.trim();let r=t.inclusive?`<=`:`<`,s=a(t.origin??`value`);return e?.unit?`${e.longLabel} מדי: ${n} ${s} ${r}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??`גדול`} מדי: ${n} ${s} ${r}${t.maximum.toString()}`}case`too_small`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.shortLabel??`קצר`} מדי: ${n} צריכה להכיל ${t.minimum.toString()} ${e?.unit??``} ${t.inclusive?`או יותר`:`לפחות`}`.trim();if(t.origin===`number`)return`קטן מדי: ${n} צריך להיות ${t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`}`;if(t.origin===`array`||t.origin===`set`){let r=t.origin===`set`?`צריכה`:`צריך`;return t.minimum===1&&t.inclusive?`קטן מדי: ${n} ${r} להכיל ${t.origin,`לפחות פריט אחד`}`:`קטן מדי: ${n} ${r} להכיל ${t.inclusive?`${t.minimum} ${e?.unit??``} או יותר`:`יותר מ-${t.minimum} ${e?.unit??``}`}`.trim()}let r=t.inclusive?`>=`:`>`,s=a(t.origin??`value`);return e?.unit?`${e.shortLabel} מדי: ${n} ${s} ${r}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??`קטן`} מדי: ${n} ${s} ${r}${t.minimum.toString()}`}case`invalid_format`:{let e=t;if(e.format===`starts_with`)return`המחרוזת חייבת להתחיל ב "${e.prefix}"`;if(e.format===`ends_with`)return`המחרוזת חייבת להסתיים ב "${e.suffix}"`;if(e.format===`includes`)return`המחרוזת חייבת לכלול "${e.includes}"`;if(e.format===`regex`)return`המחרוזת חייבת להתאים לתבנית ${e.pattern}`;let n=s[e.format];return`${n?.label??e.format} לא ${(n?.gender??`m`)===`f`?`תקינה`:`תקין`}`}case`not_multiple_of`:return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case`unrecognized_keys`:return`מפתח${t.keys.length>1?`ות`:``} לא מזוה${t.keys.length>1?`ים`:`ה`}: ${FQ(t.keys,`, `)}`;case`invalid_key`:return`שדה לא תקין באובייקט`;case`invalid_union`:return`קלט לא תקין`;case`invalid_element`:return`ערך לא תקין ב${i(t.origin??`array`)}`;default:return`קלט לא תקין`}}};function ZOe(){return{localeError:XOe()}}var QOe=()=>{let e={string:{unit:`karakter`,verb:`legyen`},file:{unit:`byte`,verb:`legyen`},array:{unit:`elem`,verb:`legyen`},set:{unit:`elem`,verb:`legyen`}};function t(t){return e[t]??null}let n={regex:`bemenet`,email:`email cím`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO időbélyeg`,date:`ISO dátum`,time:`ISO idő`,duration:`ISO időintervallum`,ipv4:`IPv4 cím`,ipv6:`IPv6 cím`,cidrv4:`IPv4 tartomány`,cidrv6:`IPv6 tartomány`,base64:`base64-kódolt string`,base64url:`base64url-kódolt string`,json_string:`JSON string`,e164:`E.164 szám`,jwt:`JWT`,template_literal:`bemenet`},r={nan:`NaN`,number:`szám`,array:`tömb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Érvénytelen bemenet: a várt érték instanceof ${e.expected}, a kapott érték ${i}`:`Érvénytelen bemenet: a várt érték ${t}, a kapott érték ${i}`}case`invalid_value`:return e.values.length===1?`Érvénytelen bemenet: a várt érték ${r$(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Túl nagy: ${e.origin??`érték`} mérete túl nagy ${n}${e.maximum.toString()} ${r.unit??`elem`}`:`Túl nagy: a bemeneti érték ${e.origin??`érték`} túl nagy: ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${n}${e.minimum.toString()} ${r.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Érvénytelen string: "${t.prefix}" értékkel kell kezdődnie`:t.format===`ends_with`?`Érvénytelen string: "${t.suffix}" értékkel kell végződnie`:t.format===`includes`?`Érvénytelen string: "${t.includes}" értéket kell tartalmaznia`:t.format===`regex`?`Érvénytelen string: ${t.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case`unrecognized_keys`:return`Ismeretlen kulcs${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Érvénytelen kulcs ${e.origin}`;case`invalid_union`:return`Érvénytelen bemenet`;case`invalid_element`:return`Érvénytelen érték: ${e.origin}`;default:return`Érvénytelen bemenet`}}};function $Oe(){return{localeError:QOe()}}function B2(e,t,n){return Math.abs(e)===1?t:n}function V2(e){if(!e)return``;let t=[`ա`,`ե`,`ը`,`ի`,`ո`,`ու`,`օ`],n=e[e.length-1];return e+(t.includes(n)?`ն`:`ը`)}var eke=()=>{let e={string:{unit:{one:`նշան`,many:`նշաններ`},verb:`ունենալ`},file:{unit:{one:`բայթ`,many:`բայթեր`},verb:`ունենալ`},array:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`},set:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`}};function t(t){return e[t]??null}let n={regex:`մուտք`,email:`էլ. հասցե`,url:`URL`,emoji:`էմոջի`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO ամսաթիվ և ժամ`,date:`ISO ամսաթիվ`,time:`ISO ժամ`,duration:`ISO տևողություն`,ipv4:`IPv4 հասցե`,ipv6:`IPv6 հասցե`,cidrv4:`IPv4 միջակայք`,cidrv6:`IPv6 միջակայք`,base64:`base64 ձևաչափով տող`,base64url:`base64url ձևաչափով տող`,json_string:`JSON տող`,e164:`E.164 համար`,jwt:`JWT`,template_literal:`մուտք`},r={nan:`NaN`,number:`թիվ`,array:`զանգված`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${e.expected}, ստացվել է ${i}`:`Սխալ մուտքագրում․ սպասվում էր ${t}, ստացվել է ${i}`}case`invalid_value`:return e.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${r$(e.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=B2(Number(e.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${V2(e.origin??`արժեք`)} կունենա ${n}${e.maximum.toString()} ${t}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${V2(e.origin??`արժեք`)} լինի ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=B2(Number(e.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${V2(e.origin)} կունենա ${n}${e.minimum.toString()} ${t}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${V2(e.origin)} լինի ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Սխալ տող․ պետք է սկսվի "${t.prefix}"-ով`:t.format===`ends_with`?`Սխալ տող․ պետք է ավարտվի "${t.suffix}"-ով`:t.format===`includes`?`Սխալ տող․ պետք է պարունակի "${t.includes}"`:t.format===`regex`?`Սխալ տող․ պետք է համապատասխանի ${t.pattern} ձևաչափին`:`Սխալ ${n[t.format]??e.format}`}case`not_multiple_of`:return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${e.divisor}-ի`;case`unrecognized_keys`:return`Չճանաչված բանալի${e.keys.length>1?`ներ`:``}. ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Սխալ բանալի ${V2(e.origin)}-ում`;case`invalid_union`:return`Սխալ մուտքագրում`;case`invalid_element`:return`Սխալ արժեք ${V2(e.origin)}-ում`;default:return`Սխալ մուտքագրում`}}};function tke(){return{localeError:eke()}}var nke=()=>{let e={string:{unit:`karakter`,verb:`memiliki`},file:{unit:`byte`,verb:`memiliki`},array:{unit:`item`,verb:`memiliki`},set:{unit:`item`,verb:`memiliki`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tanggal dan waktu format ISO`,date:`tanggal format ISO`,time:`jam format ISO`,duration:`durasi format ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`rentang alamat IPv4`,cidrv6:`rentang alamat IPv6`,base64:`string dengan enkode base64`,base64url:`string dengan enkode base64url`,json_string:`string JSON`,e164:`angka E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak valid: diharapkan ${r$(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: diharapkan ${e.origin??`value`} memiliki ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: diharapkan ${e.origin??`value`} menjadi ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: diharapkan ${e.origin} memiliki ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak valid: harus dimulai dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak valid: harus berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak valid: harus menyertakan "${t.includes}"`:t.format===`regex`?`String tidak valid: harus sesuai pola ${t.pattern}`:`${n[t.format]??e.format} tidak valid`}case`not_multiple_of`:return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali ${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak valid di ${e.origin}`;case`invalid_union`:return`Input tidak valid`;case`invalid_element`:return`Nilai tidak valid di ${e.origin}`;default:return`Input tidak valid`}}};function rke(){return{localeError:nke()}}var ike=()=>{let e={string:{unit:`stafi`,verb:`að hafa`},file:{unit:`bæti`,verb:`að hafa`},array:{unit:`hluti`,verb:`að hafa`},set:{unit:`hluti`,verb:`að hafa`}};function t(t){return e[t]??null}let n={regex:`gildi`,email:`netfang`,url:`vefslóð`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dagsetning og tími`,date:`ISO dagsetning`,time:`ISO tími`,duration:`ISO tímalengd`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded strengur`,base64url:`base64url-encoded strengur`,json_string:`JSON strengur`,e164:`E.164 tölugildi`,jwt:`JWT`,template_literal:`gildi`},r={nan:`NaN`,number:`númer`,array:`fylki`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${e.expected}`:`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${t}`}case`invalid_value`:return e.values.length===1?`Rangt gildi: gert ráð fyrir ${r$(e.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} hafi ${n}${e.maximum.toString()} ${r.unit??`hluti`}`:`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} sé ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Of lítið: gert er ráð fyrir að ${e.origin} hafi ${n}${e.minimum.toString()} ${r.unit}`:`Of lítið: gert er ráð fyrir að ${e.origin} sé ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ógildur strengur: verður að byrja á "${t.prefix}"`:t.format===`ends_with`?`Ógildur strengur: verður að enda á "${t.suffix}"`:t.format===`includes`?`Ógildur strengur: verður að innihalda "${t.includes}"`:t.format===`regex`?`Ógildur strengur: verður að fylgja mynstri ${t.pattern}`:`Rangt ${n[t.format]??e.format}`}case`not_multiple_of`:return`Röng tala: verður að vera margfeldi af ${e.divisor}`;case`unrecognized_keys`:return`Óþekkt ${e.keys.length>1?`ir lyklar`:`ur lykill`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Rangur lykill í ${e.origin}`;case`invalid_union`:return`Rangt gildi`;case`invalid_element`:return`Rangt gildi í ${e.origin}`;default:return`Rangt gildi`}}};function ake(){return{localeError:ike()}}var oke=()=>{let e={string:{unit:`caratteri`,verb:`avere`},file:{unit:`byte`,verb:`avere`},array:{unit:`elementi`,verb:`avere`},set:{unit:`elementi`,verb:`avere`}};function t(t){return e[t]??null}let n={regex:`input`,email:`indirizzo email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e ora ISO`,date:`data ISO`,time:`ora ISO`,duration:`durata ISO`,ipv4:`indirizzo IPv4`,ipv6:`indirizzo IPv6`,cidrv4:`intervallo IPv4`,cidrv6:`intervallo IPv6`,base64:`stringa codificata in base64`,base64url:`URL codificata in base64`,json_string:`stringa JSON`,e164:`numero E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`numero`,array:`vettore`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case`invalid_value`:return e.values.length===1?`Input non valido: atteso ${r$(e.values[0])}`:`Opzione non valida: atteso uno tra ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Troppo grande: ${e.origin??`valore`} deve avere ${n}${e.maximum.toString()} ${r.unit??`elementi`}`:`Troppo grande: ${e.origin??`valore`} deve essere ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Troppo piccolo: ${e.origin} deve avere ${n}${e.minimum.toString()} ${r.unit}`:`Troppo piccolo: ${e.origin} deve essere ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Stringa non valida: deve iniziare con "${t.prefix}"`:t.format===`ends_with`?`Stringa non valida: deve terminare con "${t.suffix}"`:t.format===`includes`?`Stringa non valida: deve includere "${t.includes}"`:t.format===`regex`?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case`unrecognized_keys`:return`Chiav${e.keys.length>1?`i`:`e`} non riconosciut${e.keys.length>1?`e`:`a`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Chiave non valida in ${e.origin}`;case`invalid_union`:return`Input non valido`;case`invalid_element`:return`Valore non valido in ${e.origin}`;default:return`Input non valido`}}};function ske(){return{localeError:oke()}}var cke=()=>{let e={string:{unit:`文字`,verb:`である`},file:{unit:`バイト`,verb:`である`},array:{unit:`要素`,verb:`である`},set:{unit:`要素`,verb:`である`}};function t(t){return e[t]??null}let n={regex:`入力値`,email:`メールアドレス`,url:`URL`,emoji:`絵文字`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日時`,date:`ISO日付`,time:`ISO時刻`,duration:`ISO期間`,ipv4:`IPv4アドレス`,ipv6:`IPv6アドレス`,cidrv4:`IPv4範囲`,cidrv6:`IPv6範囲`,base64:`base64エンコード文字列`,base64url:`base64urlエンコード文字列`,json_string:`JSON文字列`,e164:`E.164番号`,jwt:`JWT`,template_literal:`入力値`},r={nan:`NaN`,number:`数値`,array:`配列`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無効な入力: instanceof ${e.expected}が期待されましたが、${i}が入力されました`:`無効な入力: ${t}が期待されましたが、${i}が入力されました`}case`invalid_value`:return e.values.length===1?`無効な入力: ${r$(e.values[0])}が期待されました`:`無効な選択: ${FQ(e.values,`、`)}のいずれかである必要があります`;case`too_big`:{let n=e.inclusive?`以下である`:`より小さい`,r=t(e.origin);return r?`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${r.unit??`要素`}${n}必要があります`:`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${n}必要があります`}case`too_small`:{let n=e.inclusive?`以上である`:`より大きい`,r=t(e.origin);return r?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${r.unit}${n}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${n}必要があります`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無効な文字列: "${t.prefix}"で始まる必要があります`:t.format===`ends_with`?`無効な文字列: "${t.suffix}"で終わる必要があります`:t.format===`includes`?`無効な文字列: "${t.includes}"を含む必要があります`:t.format===`regex`?`無効な文字列: パターン${t.pattern}に一致する必要があります`:`無効な${n[t.format]??e.format}`}case`not_multiple_of`:return`無効な数値: ${e.divisor}の倍数である必要があります`;case`unrecognized_keys`:return`認識されていないキー${e.keys.length>1?`群`:``}: ${FQ(e.keys,`、`)}`;case`invalid_key`:return`${e.origin}内の無効なキー`;case`invalid_union`:return`無効な入力`;case`invalid_element`:return`${e.origin}内の無効な値`;default:return`無効な入力`}}};function lke(){return{localeError:cke()}}var uke=()=>{let e={string:{unit:`სიმბოლო`,verb:`უნდა შეიცავდეს`},file:{unit:`ბაიტი`,verb:`უნდა შეიცავდეს`},array:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`},set:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`}};function t(t){return e[t]??null}let n={regex:`შეყვანა`,email:`ელ-ფოსტის მისამართი`,url:`URL`,emoji:`ემოჯი`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`თარიღი-დრო`,date:`თარიღი`,time:`დრო`,duration:`ხანგრძლივობა`,ipv4:`IPv4 მისამართი`,ipv6:`IPv6 მისამართი`,cidrv4:`IPv4 დიაპაზონი`,cidrv6:`IPv6 დიაპაზონი`,base64:`base64-კოდირებული სტრინგი`,base64url:`base64url-კოდირებული სტრინგი`,json_string:`JSON სტრინგი`,e164:`E.164 ნომერი`,jwt:`JWT`,template_literal:`შეყვანა`},r={nan:`NaN`,number:`რიცხვი`,string:`სტრინგი`,boolean:`ბულეანი`,function:`ფუნქცია`,array:`მასივი`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${e.expected}, მიღებული ${i}`:`არასწორი შეყვანა: მოსალოდნელი ${t}, მიღებული ${i}`}case`invalid_value`:return e.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${r$(e.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${FQ(e.values,`|`)}-დან`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} იყოს ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ზედმეტად პატარა: მოსალოდნელი ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${e.origin} იყოს ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`არასწორი სტრინგი: უნდა იწყებოდეს "${t.prefix}"-ით`:t.format===`ends_with`?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${t.suffix}"-ით`:t.format===`includes`?`არასწორი სტრინგი: უნდა შეიცავდეს "${t.includes}"-ს`:t.format===`regex`?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${t.pattern}`:`არასწორი ${n[t.format]??e.format}`}case`not_multiple_of`:return`არასწორი რიცხვი: უნდა იყოს ${e.divisor}-ის ჯერადი`;case`unrecognized_keys`:return`უცნობი გასაღებ${e.keys.length>1?`ები`:`ი`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`არასწორი გასაღები ${e.origin}-ში`;case`invalid_union`:return`არასწორი შეყვანა`;case`invalid_element`:return`არასწორი მნიშვნელობა ${e.origin}-ში`;default:return`არასწორი შეყვანა`}}};function dke(){return{localeError:uke()}}var fke=()=>{let e={string:{unit:`តួអក្សរ`,verb:`គួរមាន`},file:{unit:`បៃ`,verb:`គួរមាន`},array:{unit:`ធាតុ`,verb:`គួរមាន`},set:{unit:`ធាតុ`,verb:`គួរមាន`}};function t(t){return e[t]??null}let n={regex:`ទិន្នន័យបញ្ចូល`,email:`អាសយដ្ឋានអ៊ីមែល`,url:`URL`,emoji:`សញ្ញាអារម្មណ៍`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`កាលបរិច្ឆេទ និងម៉ោង ISO`,date:`កាលបរិច្ឆេទ ISO`,time:`ម៉ោង ISO`,duration:`រយៈពេល ISO`,ipv4:`អាសយដ្ឋាន IPv4`,ipv6:`អាសយដ្ឋាន IPv6`,cidrv4:`ដែនអាសយដ្ឋាន IPv4`,cidrv6:`ដែនអាសយដ្ឋាន IPv6`,base64:`ខ្សែអក្សរអ៊ិកូដ base64`,base64url:`ខ្សែអក្សរអ៊ិកូដ base64url`,json_string:`ខ្សែអក្សរ JSON`,e164:`លេខ E.164`,jwt:`JWT`,template_literal:`ទិន្នន័យបញ្ចូល`},r={nan:`NaN`,number:`លេខ`,array:`អារេ (Array)`,null:`គ្មានតម្លៃ (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${e.expected} ប៉ុន្តែទទួលបាន ${i}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t} ប៉ុន្តែទទួលបាន ${i}`}case`invalid_value`:return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r$(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()} ${r.unit??`ធាតុ`}`:`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()} ${r.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${t.prefix}"`:t.format===`ends_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${t.suffix}"`:t.format===`includes`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${t.includes}"`:t.format===`regex`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${t.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[t.format]??e.format}`}case`not_multiple_of`:return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case`unrecognized_keys`:return`រកឃើញសោមិនស្គាល់៖ ${FQ(e.keys,`, `)}`;case`invalid_key`:return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case`invalid_union`:return`ទិន្នន័យមិនត្រឹមត្រូវ`;case`invalid_element`:return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return`ទិន្នន័យមិនត្រឹមត្រូវ`}}};function H2(){return{localeError:fke()}}function pke(){return H2()}var mke=()=>{let e={string:{unit:`문자`,verb:`to have`},file:{unit:`바이트`,verb:`to have`},array:{unit:`개`,verb:`to have`},set:{unit:`개`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`입력`,email:`이메일 주소`,url:`URL`,emoji:`이모지`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 날짜시간`,date:`ISO 날짜`,time:`ISO 시간`,duration:`ISO 기간`,ipv4:`IPv4 주소`,ipv6:`IPv6 주소`,cidrv4:`IPv4 범위`,cidrv6:`IPv6 범위`,base64:`base64 인코딩 문자열`,base64url:`base64url 인코딩 문자열`,json_string:`JSON 문자열`,e164:`E.164 번호`,jwt:`JWT`,template_literal:`입력`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`잘못된 입력: 예상 타입은 instanceof ${e.expected}, 받은 타입은 ${i}입니다`:`잘못된 입력: 예상 타입은 ${t}, 받은 타입은 ${i}입니다`}case`invalid_value`:return e.values.length===1?`잘못된 입력: 값은 ${r$(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${FQ(e.values,`또는 `)} 중 하나여야 합니다`;case`too_big`:{let n=e.inclusive?`이하`:`미만`,r=n===`미만`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()} ${n}${r}`}case`too_small`:{let n=e.inclusive?`이상`:`초과`,r=n===`이상`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()} ${n}${r}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`잘못된 문자열: "${t.prefix}"(으)로 시작해야 합니다`:t.format===`ends_with`?`잘못된 문자열: "${t.suffix}"(으)로 끝나야 합니다`:t.format===`includes`?`잘못된 문자열: "${t.includes}"을(를) 포함해야 합니다`:t.format===`regex`?`잘못된 문자열: 정규식 ${t.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[t.format]??e.format}`}case`not_multiple_of`:return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case`unrecognized_keys`:return`인식할 수 없는 키: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`잘못된 키: ${e.origin}`;case`invalid_union`:return`잘못된 입력`;case`invalid_element`:return`잘못된 값: ${e.origin}`;default:return`잘못된 입력`}}};function hke(){return{localeError:mke()}}var U2=e=>e.charAt(0).toUpperCase()+e.slice(1);function W2(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?`many`:n===1?`one`:`few`}var gke=()=>{let e={string:{unit:{one:`simbolis`,few:`simboliai`,many:`simbolių`},verb:{smaller:{inclusive:`turi būti ne ilgesnė kaip`,notInclusive:`turi būti trumpesnė kaip`},bigger:{inclusive:`turi būti ne trumpesnė kaip`,notInclusive:`turi būti ilgesnė kaip`}}},file:{unit:{one:`baitas`,few:`baitai`,many:`baitų`},verb:{smaller:{inclusive:`turi būti ne didesnis kaip`,notInclusive:`turi būti mažesnis kaip`},bigger:{inclusive:`turi būti ne mažesnis kaip`,notInclusive:`turi būti didesnis kaip`}}},array:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}},set:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}}};function t(t,n,r,i){let a=e[t]??null;return a===null?a:{unit:a.unit[n],verb:a.verb[i][r?`inclusive`:`notInclusive`]}}let n={regex:`įvestis`,email:`el. pašto adresas`,url:`URL`,emoji:`jaustukas`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO data ir laikas`,date:`ISO data`,time:`ISO laikas`,duration:`ISO trukmė`,ipv4:`IPv4 adresas`,ipv6:`IPv6 adresas`,cidrv4:`IPv4 tinklo prefiksas (CIDR)`,cidrv6:`IPv6 tinklo prefiksas (CIDR)`,base64:`base64 užkoduota eilutė`,base64url:`base64url užkoduota eilutė`,json_string:`JSON eilutė`,e164:`E.164 numeris`,jwt:`JWT`,template_literal:`įvestis`},r={nan:`NaN`,number:`skaičius`,bigint:`sveikasis skaičius`,string:`eilutė`,boolean:`loginė reikšmė`,undefined:`neapibrėžta reikšmė`,function:`funkcija`,symbol:`simbolis`,array:`masyvas`,object:`objektas`,null:`nulinė reikšmė`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikėtasi - ${t}`}case`invalid_value`:return e.values.length===1?`Privalo būti ${r$(e.values[0])}`:`Privalo būti vienas iš ${FQ(e.values,`|`)} pasirinkimų`;case`too_big`:{let n=r[e.origin]??e.origin,i=t(e.origin,W2(Number(e.maximum)),e.inclusive??!1,`smaller`);if(i?.verb)return`${U2(n??e.origin??`reikšmė`)} ${i.verb} ${e.maximum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne didesnis kaip`:`mažesnis kaip`;return`${U2(n??e.origin??`reikšmė`)} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case`too_small`:{let n=r[e.origin]??e.origin,i=t(e.origin,W2(Number(e.minimum)),e.inclusive??!1,`bigger`);if(i?.verb)return`${U2(n??e.origin??`reikšmė`)} ${i.verb} ${e.minimum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne mažesnis kaip`:`didesnis kaip`;return`${U2(n??e.origin??`reikšmė`)} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Eilutė privalo prasidėti "${t.prefix}"`:t.format===`ends_with`?`Eilutė privalo pasibaigti "${t.suffix}"`:t.format===`includes`?`Eilutė privalo įtraukti "${t.includes}"`:t.format===`regex`?`Eilutė privalo atitikti ${t.pattern}`:`Neteisingas ${n[t.format]??e.format}`}case`not_multiple_of`:return`Skaičius privalo būti ${e.divisor} kartotinis.`;case`unrecognized_keys`:return`Neatpažint${e.keys.length>1?`i`:`as`} rakt${e.keys.length>1?`ai`:`as`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Rastas klaidingas raktas`;case`invalid_union`:return`Klaidinga įvestis`;case`invalid_element`:return`${U2(r[e.origin]??e.origin??e.origin??`reikšmė`)} turi klaidingą įvestį`;default:return`Klaidinga įvestis`}}};function _ke(){return{localeError:gke()}}var vke=()=>{let e={string:{unit:`знаци`,verb:`да имаат`},file:{unit:`бајти`,verb:`да имаат`},array:{unit:`ставки`,verb:`да имаат`},set:{unit:`ставки`,verb:`да имаат`}};function t(t){return e[t]??null}let n={regex:`внес`,email:`адреса на е-пошта`,url:`URL`,emoji:`емоџи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO датум и време`,date:`ISO датум`,time:`ISO време`,duration:`ISO времетраење`,ipv4:`IPv4 адреса`,ipv6:`IPv6 адреса`,cidrv4:`IPv4 опсег`,cidrv6:`IPv6 опсег`,base64:`base64-енкодирана низа`,base64url:`base64url-енкодирана низа`,json_string:`JSON низа`,e164:`E.164 број`,jwt:`JWT`,template_literal:`внес`},r={nan:`NaN`,number:`број`,array:`низа`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Грешен внес: се очекува instanceof ${e.expected}, примено ${i}`:`Грешен внес: се очекува ${t}, примено ${i}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${r$(e.values[0])}`:`Грешана опција: се очекува една ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Премногу голем: се очекува ${e.origin??`вредноста`} да има ${n}${e.maximum.toString()} ${r.unit??`елементи`}`:`Премногу голем: се очекува ${e.origin??`вредноста`} да биде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Премногу мал: се очекува ${e.origin} да има ${n}${e.minimum.toString()} ${r.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неважечка низа: мора да започнува со "${t.prefix}"`:t.format===`ends_with`?`Неважечка низа: мора да завршува со "${t.suffix}"`:t.format===`includes`?`Неважечка низа: мора да вклучува "${t.includes}"`:t.format===`regex`?`Неважечка низа: мора да одгоара на патернот ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Грешен број: мора да биде делив со ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Непрепознаени клучеви`:`Непрепознаен клуч`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Грешен клуч во ${e.origin}`;case`invalid_union`:return`Грешен внес`;case`invalid_element`:return`Грешна вредност во ${e.origin}`;default:return`Грешен внес`}}};function yke(){return{localeError:vke()}}var bke=()=>{let e={string:{unit:`aksara`,verb:`mempunyai`},file:{unit:`bait`,verb:`mempunyai`},array:{unit:`elemen`,verb:`mempunyai`},set:{unit:`elemen`,verb:`mempunyai`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat e-mel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tarikh masa ISO`,date:`tarikh ISO`,time:`masa ISO`,duration:`tempoh ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`julat IPv4`,cidrv6:`julat IPv6`,base64:`string dikodkan base64`,base64url:`string dikodkan base64url`,json_string:`string JSON`,e164:`nombor E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`nombor`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak sah: dijangka ${r$(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: dijangka ${e.origin??`nilai`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: dijangka ${e.origin??`nilai`} adalah ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: dijangka ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak sah: mesti bermula dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak sah: mesti mengandungi "${t.includes}"`:t.format===`regex`?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${n[t.format]??e.format} tidak sah`}case`not_multiple_of`:return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak sah dalam ${e.origin}`;case`invalid_union`:return`Input tidak sah`;case`invalid_element`:return`Nilai tidak sah dalam ${e.origin}`;default:return`Input tidak sah`}}};function xke(){return{localeError:bke()}}var Ske=()=>{let e={string:{unit:`tekens`,verb:`heeft`},file:{unit:`bytes`,verb:`heeft`},array:{unit:`elementen`,verb:`heeft`},set:{unit:`elementen`,verb:`heeft`}};function t(t){return e[t]??null}let n={regex:`invoer`,email:`emailadres`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum en tijd`,date:`ISO datum`,time:`ISO tijd`,duration:`ISO duur`,ipv4:`IPv4-adres`,ipv6:`IPv6-adres`,cidrv4:`IPv4-bereik`,cidrv6:`IPv6-bereik`,base64:`base64-gecodeerde tekst`,base64url:`base64 URL-gecodeerde tekst`,json_string:`JSON string`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`invoer`},r={nan:`NaN`,number:`getal`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case`invalid_value`:return e.values.length===1?`Ongeldige invoer: verwacht ${r$(e.values[0])}`:`Ongeldige optie: verwacht één van ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin),i=e.origin===`date`?`laat`:e.origin===`string`?`lang`:`groot`;return r?`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} ${r.unit??`elementen`} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} is`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin),i=e.origin===`date`?`vroeg`:e.origin===`string`?`kort`:`klein`;return r?`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} is`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:t.format===`ends_with`?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:t.format===`includes`?`Ongeldige tekst: moet "${t.includes}" bevatten`:t.format===`regex`?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case`unrecognized_keys`:return`Onbekende key${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Ongeldige key in ${e.origin}`;case`invalid_union`:return`Ongeldige invoer`;case`invalid_element`:return`Ongeldige waarde in ${e.origin}`;default:return`Ongeldige invoer`}}};function Cke(){return{localeError:Ske()}}var wke=()=>{let e={string:{unit:`tegn`,verb:`å ha`},file:{unit:`bytes`,verb:`å ha`},array:{unit:`elementer`,verb:`å inneholde`},set:{unit:`elementer`,verb:`å inneholde`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-postadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslett`,date:`ISO-dato`,time:`ISO-klokkeslett`,duration:`ISO-varighet`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spekter`,cidrv6:`IPv6-spekter`,base64:`base64-enkodet streng`,base64url:`base64url-enkodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`tall`,array:`liste`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig verdi: forventet ${r$(e.values[0])}`:`Ugyldig valg: forventet en av ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()} ${r.unit??`elementer`}`:`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()} ${r.unit}`:`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: må starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: må ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: må inneholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: må matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukjente nøkler`:`Ukjent nøkkel`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøkkel i ${e.origin}`;case`invalid_union`:return`Ugyldig input`;case`invalid_element`:return`Ugyldig verdi i ${e.origin}`;default:return`Ugyldig input`}}};function Tke(){return{localeError:wke()}}var Eke=()=>{let e={string:{unit:`harf`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`unsur`,verb:`olmalıdır`},set:{unit:`unsur`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`giren`,email:`epostagâh`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO hengâmı`,date:`ISO tarihi`,time:`ISO zamanı`,duration:`ISO müddeti`,ipv4:`IPv4 nişânı`,ipv6:`IPv6 nişânı`,cidrv4:`IPv4 menzili`,cidrv6:`IPv6 menzili`,base64:`base64-şifreli metin`,base64url:`base64url-şifreli metin`,json_string:`JSON metin`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`giren`},r={nan:`NaN`,number:`numara`,array:`saf`,null:`gayb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Fâsit giren: umulan instanceof ${e.expected}, alınan ${i}`:`Fâsit giren: umulan ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Fâsit giren: umulan ${r$(e.values[0])}`:`Fâsit tercih: mûteberler ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} ${r.unit??`elements`} sahip olmalıydı.`:`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} olmalıydı.`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} ${r.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} olmalıydı.`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Fâsit metin: "${t.prefix}" ile başlamalı.`:t.format===`ends_with`?`Fâsit metin: "${t.suffix}" ile bitmeli.`:t.format===`includes`?`Fâsit metin: "${t.includes}" ihtivâ etmeli.`:t.format===`regex`?`Fâsit metin: ${t.pattern} nakşına uymalı.`:`Fâsit ${n[t.format]??e.format}`}case`not_multiple_of`:return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case`unrecognized_keys`:return`Tanınmayan anahtar ${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} için tanınmayan anahtar var.`;case`invalid_union`:return`Giren tanınamadı.`;case`invalid_element`:return`${e.origin} için tanınmayan kıymet var.`;default:return`Kıymet tanınamadı.`}}};function Dke(){return{localeError:Eke()}}var Oke=()=>{let e={string:{unit:`توکي`,verb:`ولري`},file:{unit:`بایټس`,verb:`ولري`},array:{unit:`توکي`,verb:`ولري`},set:{unit:`توکي`,verb:`ولري`}};function t(t){return e[t]??null}let n={regex:`ورودي`,email:`بریښنالیک`,url:`یو آر ال`,emoji:`ایموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`نیټه او وخت`,date:`نېټه`,time:`وخت`,duration:`موده`,ipv4:`د IPv4 پته`,ipv6:`د IPv6 پته`,cidrv4:`د IPv4 ساحه`,cidrv6:`د IPv6 ساحه`,base64:`base64-encoded متن`,base64url:`base64url-encoded متن`,json_string:`JSON متن`,e164:`د E.164 شمېره`,jwt:`JWT`,template_literal:`ورودي`},r={nan:`NaN`,number:`عدد`,array:`ارې`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ناسم ورودي: باید instanceof ${e.expected} وای, مګر ${i} ترلاسه شو`:`ناسم ورودي: باید ${t} وای, مګر ${i} ترلاسه شو`}case`invalid_value`:return e.values.length===1?`ناسم ورودي: باید ${r$(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${FQ(e.values,`|`)} څخه وای`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصرونه`} ولري`:`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} وي`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} وي`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ناسم متن: باید د "${t.prefix}" سره پیل شي`:t.format===`ends_with`?`ناسم متن: باید د "${t.suffix}" سره پای ته ورسيږي`:t.format===`includes`?`ناسم متن: باید "${t.includes}" ولري`:t.format===`regex`?`ناسم متن: باید د ${t.pattern} سره مطابقت ولري`:`${n[t.format]??e.format} ناسم دی`}case`not_multiple_of`:return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case`unrecognized_keys`:return`ناسم ${e.keys.length>1?`کلیډونه`:`کلیډ`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`ناسم کلیډ په ${e.origin} کې`;case`invalid_union`:return`ناسمه ورودي`;case`invalid_element`:return`ناسم عنصر په ${e.origin} کې`;default:return`ناسمه ورودي`}}};function kke(){return{localeError:Oke()}}var Ake=()=>{let e={string:{unit:`znaków`,verb:`mieć`},file:{unit:`bajtów`,verb:`mieć`},array:{unit:`elementów`,verb:`mieć`},set:{unit:`elementów`,verb:`mieć`}};function t(t){return e[t]??null}let n={regex:`wyrażenie`,email:`adres email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i godzina w formacie ISO`,date:`data w formacie ISO`,time:`godzina w formacie ISO`,duration:`czas trwania ISO`,ipv4:`adres IPv4`,ipv6:`adres IPv6`,cidrv4:`zakres IPv4`,cidrv6:`zakres IPv6`,base64:`ciąg znaków zakodowany w formacie base64`,base64url:`ciąg znaków zakodowany w formacie base64url`,json_string:`ciąg znaków w formacie JSON`,e164:`liczba E.164`,jwt:`JWT`,template_literal:`wejście`},r={nan:`NaN`,number:`liczba`,array:`tablica`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`Nieprawidłowe dane wejściowe: oczekiwano ${t}, otrzymano ${i}`}case`invalid_value`:return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${r$(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Za duża wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.maximum.toString()} ${r.unit??`elementów`}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Za mała wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.minimum.toString()} ${r.unit??`elementów`}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${t.prefix}"`:t.format===`ends_with`?`Nieprawidłowy ciąg znaków: musi kończyć się na "${t.suffix}"`:t.format===`includes`?`Nieprawidłowy ciąg znaków: musi zawierać "${t.includes}"`:t.format===`regex`?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${t.pattern}`:`Nieprawidłow(y/a/e) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case`unrecognized_keys`:return`Nierozpoznane klucze${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Nieprawidłowy klucz w ${e.origin}`;case`invalid_union`:return`Nieprawidłowe dane wejściowe`;case`invalid_element`:return`Nieprawidłowa wartość w ${e.origin}`;default:return`Nieprawidłowe dane wejściowe`}}};function jke(){return{localeError:Ake()}}var Mke=()=>{let e={string:{unit:`caracteres`,verb:`ter`},file:{unit:`bytes`,verb:`ter`},array:{unit:`itens`,verb:`ter`},set:{unit:`itens`,verb:`ter`}};function t(t){return e[t]??null}let n={regex:`padrão`,email:`endereço de e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`duração ISO`,ipv4:`endereço IPv4`,ipv6:`endereço IPv6`,cidrv4:`faixa de IPv4`,cidrv6:`faixa de IPv6`,base64:`texto codificado em base64`,base64url:`URL codificada em base64`,json_string:`texto JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,number:`número`,null:`nulo`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipo inválido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo inválido: esperado ${t}, recebido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: esperado ${r$(e.values[0])}`:`Opção inválida: esperada uma das ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Muito grande: esperado que ${e.origin??`valor`} tivesse ${n}${e.maximum.toString()} ${r.unit??`elementos`}`:`Muito grande: esperado que ${e.origin??`valor`} fosse ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Muito pequeno: esperado que ${e.origin} tivesse ${n}${e.minimum.toString()} ${r.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Texto inválido: deve começar com "${t.prefix}"`:t.format===`ends_with`?`Texto inválido: deve terminar com "${t.suffix}"`:t.format===`includes`?`Texto inválido: deve incluir "${t.includes}"`:t.format===`regex`?`Texto inválido: deve corresponder ao padrão ${t.pattern}`:`${n[t.format]??e.format} inválido`}case`not_multiple_of`:return`Número inválido: deve ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Chave${e.keys.length>1?`s`:``} desconhecida${e.keys.length>1?`s`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Chave inválida em ${e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido em ${e.origin}`;default:return`Campo inválido`}}};function Nke(){return{localeError:Mke()}}function G2(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var Pke=()=>{let e={string:{unit:{one:`символ`,few:`символа`,many:`символов`},verb:`иметь`},file:{unit:{one:`байт`,few:`байта`,many:`байт`},verb:`иметь`},array:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`},set:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`}};function t(t){return e[t]??null}let n={regex:`ввод`,email:`email адрес`,url:`URL`,emoji:`эмодзи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата и время`,date:`ISO дата`,time:`ISO время`,duration:`ISO длительность`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`строка в формате base64`,base64url:`строка в формате base64url`,json_string:`JSON строка`,e164:`номер E.164`,jwt:`JWT`,template_literal:`ввод`},r={nan:`NaN`,number:`число`,array:`массив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неверный ввод: ожидалось instanceof ${e.expected}, получено ${i}`:`Неверный ввод: ожидалось ${t}, получено ${i}`}case`invalid_value`:return e.values.length===1?`Неверный ввод: ожидалось ${r$(e.values[0])}`:`Неверный вариант: ожидалось одно из ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=G2(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет иметь ${n}${e.maximum.toString()} ${t}`}return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=G2(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${n}${e.minimum.toString()} ${t}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неверная строка: должна начинаться с "${t.prefix}"`:t.format===`ends_with`?`Неверная строка: должна заканчиваться на "${t.suffix}"`:t.format===`includes`?`Неверная строка: должна содержать "${t.includes}"`:t.format===`regex`?`Неверная строка: должна соответствовать шаблону ${t.pattern}`:`Неверный ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неверное число: должно быть кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспознанн${e.keys.length>1?`ые`:`ый`} ключ${e.keys.length>1?`и`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Неверный ключ в ${e.origin}`;case`invalid_union`:return`Неверные входные данные`;case`invalid_element`:return`Неверное значение в ${e.origin}`;default:return`Неверные входные данные`}}};function Fke(){return{localeError:Pke()}}var Ike=()=>{let e={string:{unit:`znakov`,verb:`imeti`},file:{unit:`bajtov`,verb:`imeti`},array:{unit:`elementov`,verb:`imeti`},set:{unit:`elementov`,verb:`imeti`}};function t(t){return e[t]??null}let n={regex:`vnos`,email:`e-poštni naslov`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum in čas`,date:`ISO datum`,time:`ISO čas`,duration:`ISO trajanje`,ipv4:`IPv4 naslov`,ipv6:`IPv6 naslov`,cidrv4:`obseg IPv4`,cidrv6:`obseg IPv6`,base64:`base64 kodiran niz`,base64url:`base64url kodiran niz`,json_string:`JSON niz`,e164:`E.164 številka`,jwt:`JWT`,template_literal:`vnos`},r={nan:`NaN`,number:`število`,array:`tabela`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: pričakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: pričakovano ${t}, prejeto ${i}`}case`invalid_value`:return e.values.length===1?`Neveljaven vnos: pričakovano ${r$(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} imelo ${n}${e.maximum.toString()} ${r.unit??`elementov`}`:`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Premajhno: pričakovano, da bo ${e.origin} imelo ${n}${e.minimum.toString()} ${r.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neveljaven niz: mora se začeti z "${t.prefix}"`:t.format===`ends_with`?`Neveljaven niz: mora se končati z "${t.suffix}"`:t.format===`includes`?`Neveljaven niz: mora vsebovati "${t.includes}"`:t.format===`regex`?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznan${e.keys.length>1?`i ključi`:` ključ`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Neveljaven ključ v ${e.origin}`;case`invalid_union`:return`Neveljaven vnos`;case`invalid_element`:return`Neveljavna vrednost v ${e.origin}`;default:return`Neveljaven vnos`}}};function Lke(){return{localeError:Ike()}}var Rke=()=>{let e={string:{unit:`tecken`,verb:`att ha`},file:{unit:`bytes`,verb:`att ha`},array:{unit:`objekt`,verb:`att innehålla`},set:{unit:`objekt`,verb:`att innehålla`}};function t(t){return e[t]??null}let n={regex:`reguljärt uttryck`,email:`e-postadress`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datum och tid`,date:`ISO-datum`,time:`ISO-tid`,duration:`ISO-varaktighet`,ipv4:`IPv4-intervall`,ipv6:`IPv6-intervall`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodad sträng`,base64url:`base64url-kodad sträng`,json_string:`JSON-sträng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`mall-literal`},r={nan:`NaN`,number:`antal`,array:`lista`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: förväntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: förväntat ${t}, fick ${i}`}case`invalid_value`:return e.values.length===1?`Ogiltig inmatning: förväntat ${r$(e.values[0])}`:`Ogiltigt val: förväntade en av ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`För stor(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()} ${r.unit??`element`}`:`För stor(t): förväntat ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()} ${r.unit}`:`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ogiltig sträng: måste börja med "${t.prefix}"`:t.format===`ends_with`?`Ogiltig sträng: måste sluta med "${t.suffix}"`:t.format===`includes`?`Ogiltig sträng: måste innehålla "${t.includes}"`:t.format===`regex`?`Ogiltig sträng: måste matcha mönstret "${t.pattern}"`:`Ogiltig(t) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Okända nycklar`:`Okänd nyckel`}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Ogiltig nyckel i ${e.origin??`värdet`}`;case`invalid_union`:return`Ogiltig input`;case`invalid_element`:return`Ogiltigt värde i ${e.origin??`värdet`}`;default:return`Ogiltig input`}}};function zke(){return{localeError:Rke()}}var Bke=()=>{let e={string:{unit:`எழுத்துக்கள்`,verb:`கொண்டிருக்க வேண்டும்`},file:{unit:`பைட்டுகள்`,verb:`கொண்டிருக்க வேண்டும்`},array:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`},set:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`}};function t(t){return e[t]??null}let n={regex:`உள்ளீடு`,email:`மின்னஞ்சல் முகவரி`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO தேதி நேரம்`,date:`ISO தேதி`,time:`ISO நேரம்`,duration:`ISO கால அளவு`,ipv4:`IPv4 முகவரி`,ipv6:`IPv6 முகவரி`,cidrv4:`IPv4 வரம்பு`,cidrv6:`IPv6 வரம்பு`,base64:`base64-encoded சரம்`,base64url:`base64url-encoded சரம்`,json_string:`JSON சரம்`,e164:`E.164 எண்`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`எண்`,array:`அணி`,null:`வெறுமை`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${e.expected}, பெறப்பட்டது ${i}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t}, பெறப்பட்டது ${i}`}case`invalid_value`:return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r$(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${FQ(e.values,`|`)} இல் ஒன்று`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ${r.unit??`உறுப்புகள்`} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`தவறான சரம்: "${t.prefix}" இல் தொடங்க வேண்டும்`:t.format===`ends_with`?`தவறான சரம்: "${t.suffix}" இல் முடிவடைய வேண்டும்`:t.format===`includes`?`தவறான சரம்: "${t.includes}" ஐ உள்ளடக்க வேண்டும்`:t.format===`regex`?`தவறான சரம்: ${t.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[t.format]??e.format}`}case`not_multiple_of`:return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case`unrecognized_keys`:return`அடையாளம் தெரியாத விசை${e.keys.length>1?`கள்`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} இல் தவறான விசை`;case`invalid_union`:return`தவறான உள்ளீடு`;case`invalid_element`:return`${e.origin} இல் தவறான மதிப்பு`;default:return`தவறான உள்ளீடு`}}};function Vke(){return{localeError:Bke()}}var Hke=()=>{let e={string:{unit:`ตัวอักษร`,verb:`ควรมี`},file:{unit:`ไบต์`,verb:`ควรมี`},array:{unit:`รายการ`,verb:`ควรมี`},set:{unit:`รายการ`,verb:`ควรมี`}};function t(t){return e[t]??null}let n={regex:`ข้อมูลที่ป้อน`,email:`ที่อยู่อีเมล`,url:`URL`,emoji:`อิโมจิ`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`วันที่เวลาแบบ ISO`,date:`วันที่แบบ ISO`,time:`เวลาแบบ ISO`,duration:`ช่วงเวลาแบบ ISO`,ipv4:`ที่อยู่ IPv4`,ipv6:`ที่อยู่ IPv6`,cidrv4:`ช่วง IP แบบ IPv4`,cidrv6:`ช่วง IP แบบ IPv6`,base64:`ข้อความแบบ Base64`,base64url:`ข้อความแบบ Base64 สำหรับ URL`,json_string:`ข้อความแบบ JSON`,e164:`เบอร์โทรศัพท์ระหว่างประเทศ (E.164)`,jwt:`โทเคน JWT`,template_literal:`ข้อมูลที่ป้อน`},r={nan:`NaN`,number:`ตัวเลข`,array:`อาร์เรย์ (Array)`,null:`ไม่มีค่า (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${e.expected} แต่ได้รับ ${i}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t} แต่ได้รับ ${i}`}case`invalid_value`:return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${r$(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`ไม่เกิน`:`น้อยกว่า`,r=t(e.origin);return r?`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()} ${r.unit??`รายการ`}`:`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`อย่างน้อย`:`มากกว่า`,r=t(e.origin);return r?`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()} ${r.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${t.prefix}"`:t.format===`ends_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${t.suffix}"`:t.format===`includes`?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${t.includes}" อยู่ในข้อความ`:t.format===`regex`?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${t.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[t.format]??e.format}`}case`not_multiple_of`:return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case`unrecognized_keys`:return`พบคีย์ที่ไม่รู้จัก: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`คีย์ไม่ถูกต้องใน ${e.origin}`;case`invalid_union`:return`ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้`;case`invalid_element`:return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return`ข้อมูลไม่ถูกต้อง`}}};function Uke(){return{localeError:Hke()}}var Wke=()=>{let e={string:{unit:`karakter`,verb:`olmalı`},file:{unit:`bayt`,verb:`olmalı`},array:{unit:`öğe`,verb:`olmalı`},set:{unit:`öğe`,verb:`olmalı`}};function t(t){return e[t]??null}let n={regex:`girdi`,email:`e-posta adresi`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO tarih ve saat`,date:`ISO tarih`,time:`ISO saat`,duration:`ISO süre`,ipv4:`IPv4 adresi`,ipv6:`IPv6 adresi`,cidrv4:`IPv4 aralığı`,cidrv6:`IPv6 aralığı`,base64:`base64 ile şifrelenmiş metin`,base64url:`base64url ile şifrelenmiş metin`,json_string:`JSON dizesi`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`Şablon dizesi`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Geçersiz değer: beklenen instanceof ${e.expected}, alınan ${i}`:`Geçersiz değer: beklenen ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Geçersiz değer: beklenen ${r$(e.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()} ${r.unit??`öğe`}`:`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Geçersiz metin: "${t.prefix}" ile başlamalı`:t.format===`ends_with`?`Geçersiz metin: "${t.suffix}" ile bitmeli`:t.format===`includes`?`Geçersiz metin: "${t.includes}" içermeli`:t.format===`regex`?`Geçersiz metin: ${t.pattern} desenine uymalı`:`Geçersiz ${n[t.format]??e.format}`}case`not_multiple_of`:return`Geçersiz sayı: ${e.divisor} ile tam bölünebilmeli`;case`unrecognized_keys`:return`Tanınmayan anahtar${e.keys.length>1?`lar`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} içinde geçersiz anahtar`;case`invalid_union`:return`Geçersiz değer`;case`invalid_element`:return`${e.origin} içinde geçersiz değer`;default:return`Geçersiz değer`}}};function Gke(){return{localeError:Wke()}}var Kke=()=>{let e={string:{unit:`символів`,verb:`матиме`},file:{unit:`байтів`,verb:`матиме`},array:{unit:`елементів`,verb:`матиме`},set:{unit:`елементів`,verb:`матиме`}};function t(t){return e[t]??null}let n={regex:`вхідні дані`,email:`адреса електронної пошти`,url:`URL`,emoji:`емодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`дата та час ISO`,date:`дата ISO`,time:`час ISO`,duration:`тривалість ISO`,ipv4:`адреса IPv4`,ipv6:`адреса IPv6`,cidrv4:`діапазон IPv4`,cidrv6:`діапазон IPv6`,base64:`рядок у кодуванні base64`,base64url:`рядок у кодуванні base64url`,json_string:`рядок JSON`,e164:`номер E.164`,jwt:`JWT`,template_literal:`вхідні дані`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неправильні вхідні дані: очікується instanceof ${e.expected}, отримано ${i}`:`Неправильні вхідні дані: очікується ${t}, отримано ${i}`}case`invalid_value`:return e.values.length===1?`Неправильні вхідні дані: очікується ${r$(e.values[0])}`:`Неправильна опція: очікується одне з ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Занадто велике: очікується, що ${e.origin??`значення`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`елементів`}`:`Занадто велике: очікується, що ${e.origin??`значення`} буде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Занадто мале: очікується, що ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неправильний рядок: повинен починатися з "${t.prefix}"`:t.format===`ends_with`?`Неправильний рядок: повинен закінчуватися на "${t.suffix}"`:t.format===`includes`?`Неправильний рядок: повинен містити "${t.includes}"`:t.format===`regex`?`Неправильний рядок: повинен відповідати шаблону ${t.pattern}`:`Неправильний ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неправильне число: повинно бути кратним ${e.divisor}`;case`unrecognized_keys`:return`Нерозпізнаний ключ${e.keys.length>1?`і`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Неправильний ключ у ${e.origin}`;case`invalid_union`:return`Неправильні вхідні дані`;case`invalid_element`:return`Неправильне значення у ${e.origin}`;default:return`Неправильні вхідні дані`}}};function K2(){return{localeError:Kke()}}function qke(){return K2()}var Jke=()=>{let e={string:{unit:`حروف`,verb:`ہونا`},file:{unit:`بائٹس`,verb:`ہونا`},array:{unit:`آئٹمز`,verb:`ہونا`},set:{unit:`آئٹمز`,verb:`ہونا`}};function t(t){return e[t]??null}let n={regex:`ان پٹ`,email:`ای میل ایڈریس`,url:`یو آر ایل`,emoji:`ایموجی`,uuid:`یو یو آئی ڈی`,uuidv4:`یو یو آئی ڈی وی 4`,uuidv6:`یو یو آئی ڈی وی 6`,nanoid:`نینو آئی ڈی`,guid:`جی یو آئی ڈی`,cuid:`سی یو آئی ڈی`,cuid2:`سی یو آئی ڈی 2`,ulid:`یو ایل آئی ڈی`,xid:`ایکس آئی ڈی`,ksuid:`کے ایس یو آئی ڈی`,datetime:`آئی ایس او ڈیٹ ٹائم`,date:`آئی ایس او تاریخ`,time:`آئی ایس او وقت`,duration:`آئی ایس او مدت`,ipv4:`آئی پی وی 4 ایڈریس`,ipv6:`آئی پی وی 6 ایڈریس`,cidrv4:`آئی پی وی 4 رینج`,cidrv6:`آئی پی وی 6 رینج`,base64:`بیس 64 ان کوڈڈ سٹرنگ`,base64url:`بیس 64 یو آر ایل ان کوڈڈ سٹرنگ`,json_string:`جے ایس او این سٹرنگ`,e164:`ای 164 نمبر`,jwt:`جے ڈبلیو ٹی`,template_literal:`ان پٹ`},r={nan:`NaN`,number:`نمبر`,array:`آرے`,null:`نل`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`غلط ان پٹ: instanceof ${e.expected} متوقع تھا، ${i} موصول ہوا`:`غلط ان پٹ: ${t} متوقع تھا، ${i} موصول ہوا`}case`invalid_value`:return e.values.length===1?`غلط ان پٹ: ${r$(e.values[0])} متوقع تھا`:`غلط آپشن: ${FQ(e.values,`|`)} میں سے ایک متوقع تھا`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`بہت بڑا: ${e.origin??`ویلیو`} کے ${n}${e.maximum.toString()} ${r.unit??`عناصر`} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??`ویلیو`} کا ${n}${e.maximum.toString()} ہونا متوقع تھا`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`بہت چھوٹا: ${e.origin} کے ${n}${e.minimum.toString()} ${r.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${n}${e.minimum.toString()} ہونا متوقع تھا`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`غلط سٹرنگ: "${t.prefix}" سے شروع ہونا چاہیے`:t.format===`ends_with`?`غلط سٹرنگ: "${t.suffix}" پر ختم ہونا چاہیے`:t.format===`includes`?`غلط سٹرنگ: "${t.includes}" شامل ہونا چاہیے`:t.format===`regex`?`غلط سٹرنگ: پیٹرن ${t.pattern} سے میچ ہونا چاہیے`:`غلط ${n[t.format]??e.format}`}case`not_multiple_of`:return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case`unrecognized_keys`:return`غیر تسلیم شدہ کی${e.keys.length>1?`ز`:``}: ${FQ(e.keys,`، `)}`;case`invalid_key`:return`${e.origin} میں غلط کی`;case`invalid_union`:return`غلط ان پٹ`;case`invalid_element`:return`${e.origin} میں غلط ویلیو`;default:return`غلط ان پٹ`}}};function Yke(){return{localeError:Jke()}}var Xke=()=>{let e={string:{unit:`belgi`,verb:`bo‘lishi kerak`},file:{unit:`bayt`,verb:`bo‘lishi kerak`},array:{unit:`element`,verb:`bo‘lishi kerak`},set:{unit:`element`,verb:`bo‘lishi kerak`}};function t(t){return e[t]??null}let n={regex:`kirish`,email:`elektron pochta manzili`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO sana va vaqti`,date:`ISO sana`,time:`ISO vaqt`,duration:`ISO davomiylik`,ipv4:`IPv4 manzil`,ipv6:`IPv6 manzil`,mac:`MAC manzil`,cidrv4:`IPv4 diapazon`,cidrv6:`IPv6 diapazon`,base64:`base64 kodlangan satr`,base64url:`base64url kodlangan satr`,json_string:`JSON satr`,e164:`E.164 raqam`,jwt:`JWT`,template_literal:`kirish`},r={nan:`NaN`,number:`raqam`,array:`massiv`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Noto‘g‘ri kirish: kutilgan ${t}, qabul qilingan ${i}`}case`invalid_value`:return e.values.length===1?`Noto‘g‘ri kirish: kutilgan ${r$(e.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()} ${r.unit} ${r.verb}`:`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Noto‘g‘ri satr: "${t.prefix}" bilan boshlanishi kerak`:t.format===`ends_with`?`Noto‘g‘ri satr: "${t.suffix}" bilan tugashi kerak`:t.format===`includes`?`Noto‘g‘ri satr: "${t.includes}" ni o‘z ichiga olishi kerak`:t.format===`regex`?`Noto‘g‘ri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${n[t.format]??e.format}`}case`not_multiple_of`:return`Noto‘g‘ri raqam: ${e.divisor} ning karralisi bo‘lishi kerak`;case`unrecognized_keys`:return`Noma’lum kalit${e.keys.length>1?`lar`:``}: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} dagi kalit noto‘g‘ri`;case`invalid_union`:return`Noto‘g‘ri kirish`;case`invalid_element`:return`${e.origin} da noto‘g‘ri qiymat`;default:return`Noto‘g‘ri kirish`}}};function Zke(){return{localeError:Xke()}}var Qke=()=>{let e={string:{unit:`ký tự`,verb:`có`},file:{unit:`byte`,verb:`có`},array:{unit:`phần tử`,verb:`có`},set:{unit:`phần tử`,verb:`có`}};function t(t){return e[t]??null}let n={regex:`đầu vào`,email:`địa chỉ email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ngày giờ ISO`,date:`ngày ISO`,time:`giờ ISO`,duration:`khoảng thời gian ISO`,ipv4:`địa chỉ IPv4`,ipv6:`địa chỉ IPv6`,cidrv4:`dải IPv4`,cidrv6:`dải IPv6`,base64:`chuỗi mã hóa base64`,base64url:`chuỗi mã hóa base64url`,json_string:`chuỗi JSON`,e164:`số E.164`,jwt:`JWT`,template_literal:`đầu vào`},r={nan:`NaN`,number:`số`,array:`mảng`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${e.expected}, nhận được ${i}`:`Đầu vào không hợp lệ: mong đợi ${t}, nhận được ${i}`}case`invalid_value`:return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${r$(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Quá lớn: mong đợi ${e.origin??`giá trị`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`phần tử`}`:`Quá lớn: mong đợi ${e.origin??`giá trị`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Quá nhỏ: mong đợi ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chuỗi không hợp lệ: phải bắt đầu bằng "${t.prefix}"`:t.format===`ends_with`?`Chuỗi không hợp lệ: phải kết thúc bằng "${t.suffix}"`:t.format===`includes`?`Chuỗi không hợp lệ: phải bao gồm "${t.includes}"`:t.format===`regex`?`Chuỗi không hợp lệ: phải khớp với mẫu ${t.pattern}`:`${n[t.format]??e.format} không hợp lệ`}case`not_multiple_of`:return`Số không hợp lệ: phải là bội số của ${e.divisor}`;case`unrecognized_keys`:return`Khóa không được nhận dạng: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Khóa không hợp lệ trong ${e.origin}`;case`invalid_union`:return`Đầu vào không hợp lệ`;case`invalid_element`:return`Giá trị không hợp lệ trong ${e.origin}`;default:return`Đầu vào không hợp lệ`}}};function $ke(){return{localeError:Qke()}}var eAe=()=>{let e={string:{unit:`字符`,verb:`包含`},file:{unit:`字节`,verb:`包含`},array:{unit:`项`,verb:`包含`},set:{unit:`项`,verb:`包含`}};function t(t){return e[t]??null}let n={regex:`输入`,email:`电子邮件`,url:`URL`,emoji:`表情符号`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日期时间`,date:`ISO日期`,time:`ISO时间`,duration:`ISO时长`,ipv4:`IPv4地址`,ipv6:`IPv6地址`,cidrv4:`IPv4网段`,cidrv6:`IPv6网段`,base64:`base64编码字符串`,base64url:`base64url编码字符串`,json_string:`JSON字符串`,e164:`E.164号码`,jwt:`JWT`,template_literal:`输入`},r={nan:`NaN`,number:`数字`,array:`数组`,null:`空值(null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`无效输入:期望 instanceof ${e.expected},实际接收 ${i}`:`无效输入:期望 ${t},实际接收 ${i}`}case`invalid_value`:return e.values.length===1?`无效输入:期望 ${r$(e.values[0])}`:`无效选项:期望以下之一 ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()} ${r.unit??`个元素`}`:`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`无效字符串:必须以 "${t.prefix}" 开头`:t.format===`ends_with`?`无效字符串:必须以 "${t.suffix}" 结尾`:t.format===`includes`?`无效字符串:必须包含 "${t.includes}"`:t.format===`regex`?`无效字符串:必须满足正则表达式 ${t.pattern}`:`无效${n[t.format]??e.format}`}case`not_multiple_of`:return`无效数字:必须是 ${e.divisor} 的倍数`;case`unrecognized_keys`:return`出现未知的键(key): ${FQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} 中的键(key)无效`;case`invalid_union`:return`无效输入`;case`invalid_element`:return`${e.origin} 中包含无效值(value)`;default:return`无效输入`}}};function tAe(){return{localeError:eAe()}}var nAe=()=>{let e={string:{unit:`字元`,verb:`擁有`},file:{unit:`位元組`,verb:`擁有`},array:{unit:`項目`,verb:`擁有`},set:{unit:`項目`,verb:`擁有`}};function t(t){return e[t]??null}let n={regex:`輸入`,email:`郵件地址`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 日期時間`,date:`ISO 日期`,time:`ISO 時間`,duration:`ISO 期間`,ipv4:`IPv4 位址`,ipv6:`IPv6 位址`,cidrv4:`IPv4 範圍`,cidrv6:`IPv6 範圍`,base64:`base64 編碼字串`,base64url:`base64url 編碼字串`,json_string:`JSON 字串`,e164:`E.164 數值`,jwt:`JWT`,template_literal:`輸入`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無效的輸入值:預期為 instanceof ${e.expected},但收到 ${i}`:`無效的輸入值:預期為 ${t},但收到 ${i}`}case`invalid_value`:return e.values.length===1?`無效的輸入值:預期為 ${r$(e.values[0])}`:`無效的選項:預期為以下其中之一 ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()} ${r.unit??`個元素`}`:`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()} ${r.unit}`:`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無效的字串:必須以 "${t.prefix}" 開頭`:t.format===`ends_with`?`無效的字串:必須以 "${t.suffix}" 結尾`:t.format===`includes`?`無效的字串:必須包含 "${t.includes}"`:t.format===`regex`?`無效的字串:必須符合格式 ${t.pattern}`:`無效的 ${n[t.format]??e.format}`}case`not_multiple_of`:return`無效的數字:必須為 ${e.divisor} 的倍數`;case`unrecognized_keys`:return`無法識別的鍵值${e.keys.length>1?`們`:``}:${FQ(e.keys,`、`)}`;case`invalid_key`:return`${e.origin} 中有無效的鍵值`;case`invalid_union`:return`無效的輸入值`;case`invalid_element`:return`${e.origin} 中有無效的值`;default:return`無效的輸入值`}}};function rAe(){return{localeError:nAe()}}var iAe=()=>{let e={string:{unit:`àmi`,verb:`ní`},file:{unit:`bytes`,verb:`ní`},array:{unit:`nkan`,verb:`ní`},set:{unit:`nkan`,verb:`ní`}};function t(t){return e[t]??null}let n={regex:`ẹ̀rọ ìbáwọlé`,email:`àdírẹ́sì ìmẹ́lì`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`àkókò ISO`,date:`ọjọ́ ISO`,time:`àkókò ISO`,duration:`àkókò tó pé ISO`,ipv4:`àdírẹ́sì IPv4`,ipv6:`àdírẹ́sì IPv6`,cidrv4:`àgbègbè IPv4`,cidrv6:`àgbègbè IPv6`,base64:`ọ̀rọ̀ tí a kọ́ ní base64`,base64url:`ọ̀rọ̀ base64url`,json_string:`ọ̀rọ̀ JSON`,e164:`nọ́mbà E.164`,jwt:`JWT`,template_literal:`ẹ̀rọ ìbáwọlé`},r={nan:`NaN`,number:`nọ́mbà`,array:`akopọ`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=p$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${e.expected}, àmọ̀ a rí ${i}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${t}, àmọ̀ a rí ${i}`}case`invalid_value`:return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${r$(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${FQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??`iye`} ${r.verb} ${n}${e.maximum} ${r.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${e.maximum}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${r.verb} ${n}${e.minimum} ${r.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${e.minimum}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${t.prefix}"`:t.format===`ends_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${t.suffix}"`:t.format===`includes`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${t.includes}"`:t.format===`regex`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${t.pattern}`:`Aṣìṣe: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case`unrecognized_keys`:return`Bọtìnì àìmọ̀: ${FQ(e.keys,`, `)}`;case`invalid_key`:return`Bọtìnì aṣìṣe nínú ${e.origin}`;case`invalid_union`:return`Ìbáwọlé aṣìṣe`;case`invalid_element`:return`Iye aṣìṣe nínú ${e.origin}`;default:return`Ìbáwọlé aṣìṣe`}}};function aAe(){return{localeError:iAe()}}var q2,J2=Symbol(`ZodOutput`),Y2=Symbol(`ZodInput`),X2=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Z2(){return new X2}(q2=globalThis).__zod_globalRegistry??(q2.__zod_globalRegistry=Z2());var Q2=globalThis.__zod_globalRegistry;function $2(e,t){return new e({type:`string`,...n$(t)})}function e4(e,t){return new e({type:`string`,coerce:!0,...n$(t)})}function t4(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...n$(t)})}function n4(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...n$(t)})}function r4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...n$(t)})}function i4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...n$(t)})}function a4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...n$(t)})}function o4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...n$(t)})}function s4(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...n$(t)})}function c4(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...n$(t)})}function l4(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...n$(t)})}function u4(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...n$(t)})}function d4(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...n$(t)})}function f4(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...n$(t)})}function p4(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...n$(t)})}function m4(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...n$(t)})}function h4(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...n$(t)})}function g4(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...n$(t)})}function _4(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...n$(t)})}function v4(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...n$(t)})}function y4(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...n$(t)})}function b4(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...n$(t)})}function x4(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...n$(t)})}function S4(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...n$(t)})}function C4(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...n$(t)})}var w4={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function T4(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...n$(t)})}function E4(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...n$(t)})}function D4(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...n$(t)})}function O4(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...n$(t)})}function k4(e,t){return new e({type:`number`,checks:[],...n$(t)})}function A4(e,t){return new e({type:`number`,coerce:!0,checks:[],...n$(t)})}function j4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...n$(t)})}function M4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...n$(t)})}function N4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...n$(t)})}function P4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...n$(t)})}function F4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...n$(t)})}function I4(e,t){return new e({type:`boolean`,...n$(t)})}function L4(e,t){return new e({type:`boolean`,coerce:!0,...n$(t)})}function R4(e,t){return new e({type:`bigint`,...n$(t)})}function z4(e,t){return new e({type:`bigint`,coerce:!0,...n$(t)})}function B4(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...n$(t)})}function V4(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...n$(t)})}function H4(e,t){return new e({type:`symbol`,...n$(t)})}function U4(e,t){return new e({type:`undefined`,...n$(t)})}function W4(e,t){return new e({type:`null`,...n$(t)})}function G4(e){return new e({type:`any`})}function K4(e){return new e({type:`unknown`})}function q4(e,t){return new e({type:`never`,...n$(t)})}function J4(e,t){return new e({type:`void`,...n$(t)})}function Y4(e,t){return new e({type:`date`,...n$(t)})}function X4(e,t){return new e({type:`date`,coerce:!0,...n$(t)})}function Z4(e,t){return new e({type:`nan`,...n$(t)})}function Q4(e,t){return new E1({check:`less_than`,...n$(t),value:e,inclusive:!1})}function $4(e,t){return new E1({check:`less_than`,...n$(t),value:e,inclusive:!0})}function e3(e,t){return new D1({check:`greater_than`,...n$(t),value:e,inclusive:!1})}function t3(e,t){return new D1({check:`greater_than`,...n$(t),value:e,inclusive:!0})}function n3(e){return e3(0,e)}function r3(e){return Q4(0,e)}function i3(e){return $4(0,e)}function a3(e){return t3(0,e)}function o3(e,t){return new O1({check:`multiple_of`,...n$(t),value:e})}function s3(e,t){return new j1({check:`max_size`,...n$(t),maximum:e})}function c3(e,t){return new M1({check:`min_size`,...n$(t),minimum:e})}function l3(e,t){return new N1({check:`size_equals`,...n$(t),size:e})}function u3(e,t){return new P1({check:`max_length`,...n$(t),maximum:e})}function d3(e,t){return new F1({check:`min_length`,...n$(t),minimum:e})}function f3(e,t){return new I1({check:`length_equals`,...n$(t),length:e})}function p3(e,t){return new R1({check:`string_format`,format:`regex`,...n$(t),pattern:e})}function m3(e){return new z1({check:`string_format`,format:`lowercase`,...n$(e)})}function h3(e){return new B1({check:`string_format`,format:`uppercase`,...n$(e)})}function g3(e,t){return new V1({check:`string_format`,format:`includes`,...n$(t),includes:e})}function _3(e,t){return new H1({check:`string_format`,format:`starts_with`,...n$(t),prefix:e})}function v3(e,t){return new U1({check:`string_format`,format:`ends_with`,...n$(t),suffix:e})}function y3(e,t,n){return new G1({check:`property`,property:e,schema:t,...n$(n)})}function b3(e,t){return new K1({check:`mime_type`,mime:e,...n$(t)})}function x3(e){return new q1({check:`overwrite`,tx:e})}function S3(e){return x3(t=>t.normalize(e))}function C3(){return x3(e=>e.trim())}function w3(){return x3(e=>e.toLowerCase())}function T3(){return x3(e=>e.toUpperCase())}function E3(){return x3(e=>KQ(e))}function D3(e,t,n){return new e({type:`array`,element:t,...n$(n)})}function oAe(e,t,n){return new e({type:`union`,options:t,...n$(n)})}function sAe(e,t,n){return new e({type:`union`,options:t,inclusive:!1,...n$(n)})}function cAe(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,...n$(r)})}function lAe(e,t,n){return new e({type:`intersection`,left:t,right:n})}function uAe(e,t,n,r){let i=n instanceof X1;return new e({type:`tuple`,items:t,rest:i?n:null,...n$(i?r:n)})}function dAe(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,...n$(r)})}function fAe(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,...n$(r)})}function pAe(e,t,n){return new e({type:`set`,valueType:t,...n$(n)})}function mAe(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...n$(n)})}function hAe(e,t,n){return new e({type:`enum`,entries:t,...n$(n)})}function gAe(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],...n$(n)})}function O3(e,t){return new e({type:`file`,...n$(t)})}function _Ae(e,t){return new e({type:`transform`,transform:t})}function vAe(e,t){return new e({type:`optional`,innerType:t})}function yAe(e,t){return new e({type:`nullable`,innerType:t})}function bAe(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():ZQ(n)}})}function xAe(e,t,n){return new e({type:`nonoptional`,innerType:t,...n$(n)})}function SAe(e,t){return new e({type:`success`,innerType:t})}function CAe(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function wAe(e,t,n){return new e({type:`pipe`,in:t,out:n})}function TAe(e,t){return new e({type:`readonly`,innerType:t})}function EAe(e,t,n){return new e({type:`template_literal`,parts:t,...n$(n)})}function DAe(e,t){return new e({type:`lazy`,getter:t})}function OAe(e,t){return new e({type:`promise`,innerType:t})}function k3(e,t,n){let r=n$(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function A3(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...n$(n)})}function j3(e){let t=M3(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(m$(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(m$(r))}},e(n.value,n)));return t}function M3(e,t){let n=new w1({check:`custom`,...n$(t)});return n._zod.check=e,n}function N3(e){let t=new w1({check:`describe`});return t._zod.onattach=[t=>{let n=Q2.get(t)??{};Q2.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function P3(e){let t=new w1({check:`meta`});return t._zod.onattach=[t=>{let n=Q2.get(t)??{};Q2.add(t,{...n,...e})}],t._zod.check=()=>{},t}function F3(e,t){let n=n$(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??E2,c=e.Boolean??k0,l=new s({type:`pipe`,in:new(e.String??Z1)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:(e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})},reverseTransform:(e,t)=>e===!0?r[0]||`true`:i[0]||`false`,error:n.error});return l}function I3(e,t,n,r={}){let i=n$(r),a={...n$(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function L3(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Q2,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function R3(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,R3(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&V3(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function z3(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
614
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=YQ,s=!MQ.jitless,c=s&&XQ.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?G0([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function J0(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!c$(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>d$(e,r,NQ())))}),t)}var Y0=$(`$ZodUnion`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),UQ(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),UQ(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),UQ(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>BQ(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>J0(t,i,e,a)):J0(s,i,e,a)}});function X0(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>d$(e,r,NQ())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}var Z0=$(`$ZodXor`,(e,t)=>{Y0.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>X0(t,i,e,a)):X0(s,i,e,a)}}),Q0=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Y0.init(e,t);let n=e._zod.parse;UQ(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=RQ(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!YQ(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),$0=$(`$ZodIntersection`,(e,t)=>{Z1.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>t2(e,t,n)):t2(e,i,a)}});function e2(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ZQ(e)&&ZQ(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=e2(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=e2(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function t2(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),c$(e))return e;let o=e2(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var n2=$(`$ZodTuple`,(e,t)=>{Z1.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length<c-1;if(t||i)return r.issues.push({...t?{code:`too_big`,maximum:n.length,inclusive:!0}:{code:`too_small`,minimum:n.length},input:a,inst:e,origin:`array`}),r}let l=-1;for(let e of n){if(l++,l>=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>r2(e,r,l))):r2(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>r2(e,r,l))):r2(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function r2(e,t,n){e.issues.length&&t.issues.push(...l$(n,e.issues)),t.value[n]=e.value}var i2=$(`$ZodRecord`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ZQ(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...l$(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...l$(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&_1.test(o)&&s.issues.length&&s.issues.some(e=>e.code===`invalid_type`&&e.expected===`number`)){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>d$(e,r,NQ())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...l$(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...l$(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),a2=$(`$ZodMap`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{o2(t,a,n,o,i,e,r)})):o2(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function o2(e,t,n,r,i,a,o){e.issues.length&&($Q.has(typeof r)?n.issues.push(...l$(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>d$(e,o,NQ()))})),t.issues.length&&($Q.has(typeof r)?n.issues.push(...l$(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>d$(e,o,NQ()))})),n.value.set(e.value,t.value)}var s2=$(`$ZodSet`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>c2(e,n))):c2(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function c2(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var l2=$(`$ZodEnum`,(e,t)=>{Z1.init(e,t);let n=FQ(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>$Q.has(typeof e)).map(e=>typeof e==`string`?t$(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),u2=$(`$ZodLiteral`,(e,t)=>{if(Z1.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?t$(e):e?t$(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),d2=$(`$ZodFile`,(e,t)=>{Z1.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),f2=$(`$ZodTransform`,(e,t)=>{Z1.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new jQ(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new AQ;return n.value=i,n}});function p2(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var m2=$(`$ZodOptional`,(e,t)=>{Z1.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,UQ(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),UQ(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${BQ(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>p2(t,e.value)):p2(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),h2=$(`$ZodExactOptional`,(e,t)=>{m2.init(e,t),UQ(e._zod,`values`,()=>t.innerType._zod.values),UQ(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),g2=$(`$ZodNullable`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`optin`,()=>t.innerType._zod.optin),UQ(e._zod,`optout`,()=>t.innerType._zod.optout),UQ(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${BQ(e.source)}|null)$`):void 0}),UQ(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),_2=$(`$ZodDefault`,(e,t)=>{Z1.init(e,t),e._zod.optin=`optional`,UQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>v2(e,t)):v2(r,t)}});function v2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var y2=$(`$ZodPrefault`,(e,t)=>{Z1.init(e,t),e._zod.optin=`optional`,UQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),b2=$(`$ZodNonOptional`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>x2(t,e)):x2(i,e)}});function x2(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var S2=$(`$ZodSuccess`,(e,t)=>{Z1.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new jQ(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),C2=$(`$ZodCatch`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`optin`,()=>t.innerType._zod.optin),UQ(e._zod,`optout`,()=>t.innerType._zod.optout),UQ(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>d$(e,n,NQ()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>d$(e,n,NQ()))},input:e.value}),e.issues=[]),e)}}),w2=$(`$ZodNaN`,(e,t)=>{Z1.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),T2=$(`$ZodPipe`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`values`,()=>t.in._zod.values),UQ(e._zod,`optin`,()=>t.in._zod.optin),UQ(e._zod,`optout`,()=>t.out._zod.optout),UQ(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>E2(e,t.in,n)):E2(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>E2(e,t.out,n)):E2(r,t.out,n)}});function E2(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var D2=$(`$ZodCodec`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`values`,()=>t.in._zod.values),UQ(e._zod,`optin`,()=>t.in._zod.optin),UQ(e._zod,`optout`,()=>t.out._zod.optout),UQ(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>O2(e,t,n)):O2(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>O2(e,t,n)):O2(r,t,n)}}});function O2(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>k2(e,r,t.out,n)):k2(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>k2(e,r,t.in,n)):k2(e,r,t.in,n)}}function k2(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var A2=$(`$ZodReadonly`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`propValues`,()=>t.innerType._zod.propValues),UQ(e._zod,`values`,()=>t.innerType._zod.values),UQ(e._zod,`optin`,()=>t.innerType?._zod?.optin),UQ(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(j2):j2(r)}});function j2(e){return e.value=Object.freeze(e.value),e}var M2=$(`$ZodTemplateLiteral`,(e,t)=>{Z1.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||e$.has(typeof e))n.push(t$(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),N2=$(`$ZodFunction`,(e,t)=>(Z1.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?D$(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?D$(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await k$(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await k$(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new n2({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:`function`,input:e._def.input,output:t}),e)),P2=$(`$ZodPromise`,(e,t)=>{Z1.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),F2=$(`$ZodLazy`,(e,t)=>{Z1.init(e,t),UQ(e._zod,`innerType`,()=>t.getter()),UQ(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),UQ(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),UQ(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),UQ(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),I2=$(`$ZodCustom`,(e,t)=>{T1.init(e,t),Z1.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>L2(t,n,r,e));L2(i,n,r,e)}});function L2(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(h$(e))}}var R2={};TQ(R2,{zhTW:()=>nAe,zhCN:()=>eAe,yo:()=>iAe,vi:()=>Qke,uz:()=>Xke,ur:()=>Jke,uk:()=>q2,ua:()=>Kke,tr:()=>Wke,th:()=>Hke,ta:()=>Bke,sv:()=>Rke,sl:()=>Ike,ru:()=>Pke,pt:()=>Mke,ps:()=>Oke,pl:()=>Ake,ota:()=>Eke,no:()=>wke,nl:()=>Ske,ms:()=>bke,mk:()=>vke,lt:()=>gke,ko:()=>mke,km:()=>U2,kh:()=>fke,ka:()=>uke,ja:()=>cke,it:()=>oke,is:()=>ike,id:()=>nke,hy:()=>eke,hu:()=>QOe,he:()=>XOe,frCA:()=>JOe,fr:()=>KOe,fi:()=>WOe,fa:()=>HOe,es:()=>BOe,eo:()=>ROe,en:()=>B2,de:()=>FOe,da:()=>NOe,cs:()=>jOe,ca:()=>kOe,bg:()=>DOe,be:()=>TOe,az:()=>COe,ar:()=>xOe});var bOe=()=>{let e={string:{unit:`حرف`,verb:`أن يحوي`},file:{unit:`بايت`,verb:`أن يحوي`},array:{unit:`عنصر`,verb:`أن يحوي`},set:{unit:`عنصر`,verb:`أن يحوي`}};function t(t){return e[t]??null}let n={regex:`مدخل`,email:`بريد إلكتروني`,url:`رابط`,emoji:`إيموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاريخ ووقت بمعيار ISO`,date:`تاريخ بمعيار ISO`,time:`وقت بمعيار ISO`,duration:`مدة بمعيار ISO`,ipv4:`عنوان IPv4`,ipv6:`عنوان IPv6`,cidrv4:`مدى عناوين بصيغة IPv4`,cidrv6:`مدى عناوين بصيغة IPv6`,base64:`نَص بترميز base64-encoded`,base64url:`نَص بترميز base64url-encoded`,json_string:`نَص على هيئة JSON`,e164:`رقم هاتف بمعيار E.164`,jwt:`JWT`,template_literal:`مدخل`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${e.expected}، ولكن تم إدخال ${i}`:`مدخلات غير مقبولة: يفترض إدخال ${t}، ولكن تم إدخال ${i}`}case`invalid_value`:return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${i$(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?` أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()} ${r.unit??`عنصر`}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()} ${r.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:t.format===`ends_with`?`نَص غير مقبول: يجب أن ينتهي بـ "${t.suffix}"`:t.format===`includes`?`نَص غير مقبول: يجب أن يتضمَّن "${t.includes}"`:t.format===`regex`?`نَص غير مقبول: يجب أن يطابق النمط ${t.pattern}`:`${n[t.format]??e.format} غير مقبول`}case`not_multiple_of`:return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case`unrecognized_keys`:return`معرف${e.keys.length>1?`ات`:``} غريب${e.keys.length>1?`ة`:``}: ${IQ(e.keys,`، `)}`;case`invalid_key`:return`معرف غير مقبول في ${e.origin}`;case`invalid_union`:return`مدخل غير مقبول`;case`invalid_element`:return`مدخل غير مقبول في ${e.origin}`;default:return`مدخل غير مقبول`}}};function xOe(){return{localeError:bOe()}}var SOe=()=>{let e={string:{unit:`simvol`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`element`,verb:`olmalıdır`},set:{unit:`element`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Yanlış dəyər: gözlənilən instanceof ${e.expected}, daxil olan ${i}`:`Yanlış dəyər: gözlənilən ${t}, daxil olan ${i}`}case`invalid_value`:return e.values.length===1?`Yanlış dəyər: gözlənilən ${i$(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()} ${r.unit??`element`}`:`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Yanlış mətn: "${t.prefix}" ilə başlamalıdır`:t.format===`ends_with`?`Yanlış mətn: "${t.suffix}" ilə bitməlidir`:t.format===`includes`?`Yanlış mətn: "${t.includes}" daxil olmalıdır`:t.format===`regex`?`Yanlış mətn: ${t.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[t.format]??e.format}`}case`not_multiple_of`:return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case`unrecognized_keys`:return`Tanınmayan açar${e.keys.length>1?`lar`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} daxilində yanlış açar`;case`invalid_union`:return`Yanlış dəyər`;case`invalid_element`:return`${e.origin} daxilində yanlış dəyər`;default:return`Yanlış dəyər`}}};function COe(){return{localeError:SOe()}}function z2(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var wOe=()=>{let e={string:{unit:{one:`сімвал`,few:`сімвалы`,many:`сімвалаў`},verb:`мець`},array:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},set:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},file:{unit:{one:`байт`,few:`байты`,many:`байтаў`},verb:`мець`}};function t(t){return e[t]??null}let n={regex:`увод`,email:`email адрас`,url:`URL`,emoji:`эмодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата і час`,date:`ISO дата`,time:`ISO час`,duration:`ISO працягласць`,ipv4:`IPv4 адрас`,ipv6:`IPv6 адрас`,cidrv4:`IPv4 дыяпазон`,cidrv6:`IPv6 дыяпазон`,base64:`радок у фармаце base64`,base64url:`радок у фармаце base64url`,json_string:`JSON радок`,e164:`нумар E.164`,jwt:`JWT`,template_literal:`увод`},r={nan:`NaN`,number:`лік`,array:`масіў`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Няправільны ўвод: чакаўся instanceof ${e.expected}, атрымана ${i}`:`Няправільны ўвод: чакаўся ${t}, атрымана ${i}`}case`invalid_value`:return e.values.length===1?`Няправільны ўвод: чакалася ${i$(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=z2(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна ${r.verb} ${n}${e.maximum.toString()} ${t}`}return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна быць ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=z2(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${r.verb} ${n}${e.minimum.toString()} ${t}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Няправільны радок: павінен пачынацца з "${t.prefix}"`:t.format===`ends_with`?`Няправільны радок: павінен заканчвацца на "${t.suffix}"`:t.format===`includes`?`Няправільны радок: павінен змяшчаць "${t.includes}"`:t.format===`regex`?`Няправільны радок: павінен адпавядаць шаблону ${t.pattern}`:`Няправільны ${n[t.format]??e.format}`}case`not_multiple_of`:return`Няправільны лік: павінен быць кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспазнаны ${e.keys.length>1?`ключы`:`ключ`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Няправільны ключ у ${e.origin}`;case`invalid_union`:return`Няправільны ўвод`;case`invalid_element`:return`Няправільнае значэнне ў ${e.origin}`;default:return`Няправільны ўвод`}}};function TOe(){return{localeError:wOe()}}var EOe=()=>{let e={string:{unit:`символа`,verb:`да съдържа`},file:{unit:`байта`,verb:`да съдържа`},array:{unit:`елемента`,verb:`да съдържа`},set:{unit:`елемента`,verb:`да съдържа`}};function t(t){return e[t]??null}let n={regex:`вход`,email:`имейл адрес`,url:`URL`,emoji:`емоджи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO време`,date:`ISO дата`,time:`ISO време`,duration:`ISO продължителност`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`base64-кодиран низ`,base64url:`base64url-кодиран низ`,json_string:`JSON низ`,e164:`E.164 номер`,jwt:`JWT`,template_literal:`вход`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Невалиден вход: очакван instanceof ${e.expected}, получен ${i}`:`Невалиден вход: очакван ${t}, получен ${i}`}case`invalid_value`:return e.values.length===1?`Невалиден вход: очакван ${i$(e.values[0])}`:`Невалидна опция: очаквано едно от ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Твърде голямо: очаква се ${e.origin??`стойност`} да съдържа ${n}${e.maximum.toString()} ${r.unit??`елемента`}`:`Твърде голямо: очаква се ${e.origin??`стойност`} да бъде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Твърде малко: очаква се ${e.origin} да съдържа ${n}${e.minimum.toString()} ${r.unit}`:`Твърде малко: очаква се ${e.origin} да бъде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;if(t.format===`starts_with`)return`Невалиден низ: трябва да започва с "${t.prefix}"`;if(t.format===`ends_with`)return`Невалиден низ: трябва да завършва с "${t.suffix}"`;if(t.format===`includes`)return`Невалиден низ: трябва да включва "${t.includes}"`;if(t.format===`regex`)return`Невалиден низ: трябва да съвпада с ${t.pattern}`;let r=`Невалиден`;return t.format===`emoji`&&(r=`Невалидно`),t.format===`datetime`&&(r=`Невалидно`),t.format===`date`&&(r=`Невалидна`),t.format===`time`&&(r=`Невалидно`),t.format===`duration`&&(r=`Невалидна`),`${r} ${n[t.format]??e.format}`}case`not_multiple_of`:return`Невалидно число: трябва да бъде кратно на ${e.divisor}`;case`unrecognized_keys`:return`Неразпознат${e.keys.length>1?`и`:``} ключ${e.keys.length>1?`ове`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Невалиден ключ в ${e.origin}`;case`invalid_union`:return`Невалиден вход`;case`invalid_element`:return`Невалидна стойност в ${e.origin}`;default:return`Невалиден вход`}}};function DOe(){return{localeError:EOe()}}var OOe=()=>{let e={string:{unit:`caràcters`,verb:`contenir`},file:{unit:`bytes`,verb:`contenir`},array:{unit:`elements`,verb:`contenir`},set:{unit:`elements`,verb:`contenir`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`adreça electrònica`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`durada ISO`,ipv4:`adreça IPv4`,ipv6:`adreça IPv6`,cidrv4:`rang IPv4`,cidrv6:`rang IPv6`,base64:`cadena codificada en base64`,base64url:`cadena codificada en base64url`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipus invàlid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invàlid: s'esperava ${t}, s'ha rebut ${i}`}case`invalid_value`:return e.values.length===1?`Valor invàlid: s'esperava ${i$(e.values[0])}`:`Opció invàlida: s'esperava una de ${IQ(e.values,` o `)}`;case`too_big`:{let n=e.inclusive?`com a màxim`:`menys de`,r=t(e.origin);return r?`Massa gran: s'esperava que ${e.origin??`el valor`} contingués ${n} ${e.maximum.toString()} ${r.unit??`elements`}`:`Massa gran: s'esperava que ${e.origin??`el valor`} fos ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`com a mínim`:`més de`,r=t(e.origin);return r?`Massa petit: s'esperava que ${e.origin} contingués ${n} ${e.minimum.toString()} ${r.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Format invàlid: ha de començar amb "${t.prefix}"`:t.format===`ends_with`?`Format invàlid: ha d'acabar amb "${t.suffix}"`:t.format===`includes`?`Format invàlid: ha d'incloure "${t.includes}"`:t.format===`regex`?`Format invàlid: ha de coincidir amb el patró ${t.pattern}`:`Format invàlid per a ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case`unrecognized_keys`:return`Clau${e.keys.length>1?`s`:``} no reconeguda${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Clau invàlida a ${e.origin}`;case`invalid_union`:return`Entrada invàlida`;case`invalid_element`:return`Element invàlid a ${e.origin}`;default:return`Entrada invàlida`}}};function kOe(){return{localeError:OOe()}}var AOe=()=>{let e={string:{unit:`znaků`,verb:`mít`},file:{unit:`bajtů`,verb:`mít`},array:{unit:`prvků`,verb:`mít`},set:{unit:`prvků`,verb:`mít`}};function t(t){return e[t]??null}let n={regex:`regulární výraz`,email:`e-mailová adresa`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`datum a čas ve formátu ISO`,date:`datum ve formátu ISO`,time:`čas ve formátu ISO`,duration:`doba trvání ISO`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`rozsah IPv4`,cidrv6:`rozsah IPv6`,base64:`řetězec zakódovaný ve formátu base64`,base64url:`řetězec zakódovaný ve formátu base64url`,json_string:`řetězec ve formátu JSON`,e164:`číslo E.164`,jwt:`JWT`,template_literal:`vstup`},r={nan:`NaN`,number:`číslo`,string:`řetězec`,function:`funkce`,array:`pole`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: očekáváno instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: očekáváno ${t}, obdrženo ${i}`}case`invalid_value`:return e.values.length===1?`Neplatný vstup: očekáváno ${i$(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Hodnota je příliš velká: ${e.origin??`hodnota`} musí mít ${n}${e.maximum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš velká: ${e.origin??`hodnota`} musí být ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Hodnota je příliš malá: ${e.origin??`hodnota`} musí mít ${n}${e.minimum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš malá: ${e.origin??`hodnota`} musí být ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neplatný řetězec: musí začínat na "${t.prefix}"`:t.format===`ends_with`?`Neplatný řetězec: musí končit na "${t.suffix}"`:t.format===`includes`?`Neplatný řetězec: musí obsahovat "${t.includes}"`:t.format===`regex`?`Neplatný řetězec: musí odpovídat vzoru ${t.pattern}`:`Neplatný formát ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neplatné číslo: musí být násobkem ${e.divisor}`;case`unrecognized_keys`:return`Neznámé klíče: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Neplatný klíč v ${e.origin}`;case`invalid_union`:return`Neplatný vstup`;case`invalid_element`:return`Neplatná hodnota v ${e.origin}`;default:return`Neplatný vstup`}}};function jOe(){return{localeError:AOe()}}var MOe=()=>{let e={string:{unit:`tegn`,verb:`havde`},file:{unit:`bytes`,verb:`havde`},array:{unit:`elementer`,verb:`indeholdt`},set:{unit:`elementer`,verb:`indeholdt`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-mailadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslæt`,date:`ISO-dato`,time:`ISO-klokkeslæt`,duration:`ISO-varighed`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodet streng`,base64url:`base64url-kodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,string:`streng`,number:`tal`,boolean:`boolean`,array:`liste`,object:`objekt`,set:`sæt`,file:`fil`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig værdi: forventede ${i$(e.values[0])}`:`Ugyldigt valg: forventede en af følgende ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For stor: forventede ${a??`value`} ${i.verb} ${n} ${e.maximum.toString()} ${i.unit??`elementer`}`:`For stor: forventede ${a??`value`} havde ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For lille: forventede ${a} ${i.verb} ${n} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${a} havde ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: skal starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: skal ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: skal indeholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: skal matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldigt tal: skal være deleligt med ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukendte nøgler`:`Ukendt nøgle`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøgle i ${e.origin}`;case`invalid_union`:return`Ugyldigt input: matcher ingen af de tilladte typer`;case`invalid_element`:return`Ugyldig værdi i ${e.origin}`;default:return`Ugyldigt input`}}};function NOe(){return{localeError:MOe()}}var POe=()=>{let e={string:{unit:`Zeichen`,verb:`zu haben`},file:{unit:`Bytes`,verb:`zu haben`},array:{unit:`Elemente`,verb:`zu haben`},set:{unit:`Elemente`,verb:`zu haben`}};function t(t){return e[t]??null}let n={regex:`Eingabe`,email:`E-Mail-Adresse`,url:`URL`,emoji:`Emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-Datum und -Uhrzeit`,date:`ISO-Datum`,time:`ISO-Uhrzeit`,duration:`ISO-Dauer`,ipv4:`IPv4-Adresse`,ipv6:`IPv6-Adresse`,cidrv4:`IPv4-Bereich`,cidrv6:`IPv6-Bereich`,base64:`Base64-codierter String`,base64url:`Base64-URL-codierter String`,json_string:`JSON-String`,e164:`E.164-Nummer`,jwt:`JWT`,template_literal:`Eingabe`},r={nan:`NaN`,number:`Zahl`,array:`Array`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case`invalid_value`:return e.values.length===1?`Ungültige Eingabe: erwartet ${i$(e.values[0])}`:`Ungültige Option: erwartet eine von ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ${r.unit??`Elemente`} hat`:`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ist`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ${r.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ist`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ungültiger String: muss mit "${t.prefix}" beginnen`:t.format===`ends_with`?`Ungültiger String: muss mit "${t.suffix}" enden`:t.format===`includes`?`Ungültiger String: muss "${t.includes}" enthalten`:t.format===`regex`?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case`unrecognized_keys`:return`${e.keys.length>1?`Unbekannte Schlüssel`:`Unbekannter Schlüssel`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Ungültiger Schlüssel in ${e.origin}`;case`invalid_union`:return`Ungültige Eingabe`;case`invalid_element`:return`Ungültiger Wert in ${e.origin}`;default:return`Ungültige Eingabe`}}};function FOe(){return{localeError:POe()}}var IOe=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${i$(e.values[0])}`:`Invalid option: expected one of ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function B2(){return{localeError:IOe()}}var LOe=()=>{let e={string:{unit:`karaktrojn`,verb:`havi`},file:{unit:`bajtojn`,verb:`havi`},array:{unit:`elementojn`,verb:`havi`},set:{unit:`elementojn`,verb:`havi`}};function t(t){return e[t]??null}let n={regex:`enigo`,email:`retadreso`,url:`URL`,emoji:`emoĝio`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datotempo`,date:`ISO-dato`,time:`ISO-tempo`,duration:`ISO-daŭro`,ipv4:`IPv4-adreso`,ipv6:`IPv6-adreso`,cidrv4:`IPv4-rango`,cidrv6:`IPv6-rango`,base64:`64-ume kodita karaktraro`,base64url:`URL-64-ume kodita karaktraro`,json_string:`JSON-karaktraro`,e164:`E.164-nombro`,jwt:`JWT`,template_literal:`enigo`},r={nan:`NaN`,number:`nombro`,array:`tabelo`,null:`senvalora`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiĝis instanceof ${e.expected}, riceviĝis ${i}`:`Nevalida enigo: atendiĝis ${t}, riceviĝis ${i}`}case`invalid_value`:return e.values.length===1?`Nevalida enigo: atendiĝis ${i$(e.values[0])}`:`Nevalida opcio: atendiĝis unu el ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()} ${r.unit??`elementojn`}`:`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Tro malgranda: atendiĝis ke ${e.origin} havu ${n}${e.minimum.toString()} ${r.unit}`:`Tro malgranda: atendiĝis ke ${e.origin} estu ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nevalida karaktraro: devas komenciĝi per "${t.prefix}"`:t.format===`ends_with`?`Nevalida karaktraro: devas finiĝi per "${t.suffix}"`:t.format===`includes`?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:t.format===`regex`?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case`unrecognized_keys`:return`Nekonata${e.keys.length>1?`j`:``} ŝlosilo${e.keys.length>1?`j`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Nevalida ŝlosilo en ${e.origin}`;case`invalid_union`:return`Nevalida enigo`;case`invalid_element`:return`Nevalida valoro en ${e.origin}`;default:return`Nevalida enigo`}}};function ROe(){return{localeError:LOe()}}var zOe=()=>{let e={string:{unit:`caracteres`,verb:`tener`},file:{unit:`bytes`,verb:`tener`},array:{unit:`elementos`,verb:`tener`},set:{unit:`elementos`,verb:`tener`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`dirección de correo electrónico`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`fecha y hora ISO`,date:`fecha ISO`,time:`hora ISO`,duration:`duración ISO`,ipv4:`dirección IPv4`,ipv6:`dirección IPv6`,cidrv4:`rango IPv4`,cidrv6:`rango IPv6`,base64:`cadena codificada en base64`,base64url:`URL codificada en base64`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,string:`texto`,number:`número`,boolean:`booleano`,array:`arreglo`,object:`objeto`,set:`conjunto`,file:`archivo`,date:`fecha`,bigint:`número grande`,symbol:`símbolo`,undefined:`indefinido`,null:`nulo`,function:`función`,map:`mapa`,record:`registro`,tuple:`tupla`,enum:`enumeración`,union:`unión`,literal:`literal`,promise:`promesa`,void:`vacío`,never:`nunca`,unknown:`desconocido`,any:`cualquiera`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrada inválida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada inválida: se esperaba ${t}, recibido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: se esperaba ${i$(e.values[0])}`:`Opción inválida: se esperaba una de ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${a??`valor`} tuviera ${n}${e.maximum.toString()} ${i.unit??`elementos`}`:`Demasiado grande: se esperaba que ${a??`valor`} fuera ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado pequeño: se esperaba que ${a} tuviera ${n}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeño: se esperaba que ${a} fuera ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Cadena inválida: debe comenzar con "${t.prefix}"`:t.format===`ends_with`?`Cadena inválida: debe terminar en "${t.suffix}"`:t.format===`includes`?`Cadena inválida: debe incluir "${t.includes}"`:t.format===`regex`?`Cadena inválida: debe coincidir con el patrón ${t.pattern}`:`Inválido ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número inválido: debe ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Llave${e.keys.length>1?`s`:``} desconocida${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Llave inválida en ${r[e.origin]??e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido en ${r[e.origin]??e.origin}`;default:return`Entrada inválida`}}};function BOe(){return{localeError:zOe()}}var VOe=()=>{let e={string:{unit:`کاراکتر`,verb:`داشته باشد`},file:{unit:`بایت`,verb:`داشته باشد`},array:{unit:`آیتم`,verb:`داشته باشد`},set:{unit:`آیتم`,verb:`داشته باشد`}};function t(t){return e[t]??null}let n={regex:`ورودی`,email:`آدرس ایمیل`,url:`URL`,emoji:`ایموجی`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاریخ و زمان ایزو`,date:`تاریخ ایزو`,time:`زمان ایزو`,duration:`مدت زمان ایزو`,ipv4:`IPv4 آدرس`,ipv6:`IPv6 آدرس`,cidrv4:`IPv4 دامنه`,cidrv6:`IPv6 دامنه`,base64:`base64-encoded رشته`,base64url:`base64url-encoded رشته`,json_string:`JSON رشته`,e164:`E.164 عدد`,jwt:`JWT`,template_literal:`ورودی`},r={nan:`NaN`,number:`عدد`,array:`آرایه`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ورودی نامعتبر: میبایست instanceof ${e.expected} میبود، ${i} دریافت شد`:`ورودی نامعتبر: میبایست ${t} میبود، ${i} دریافت شد`}case`invalid_value`:return e.values.length===1?`ورودی نامعتبر: میبایست ${i$(e.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${IQ(e.values,`|`)} میبود`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصر`} باشد`:`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} باشد`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} باشد`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`رشته نامعتبر: باید با "${t.prefix}" شروع شود`:t.format===`ends_with`?`رشته نامعتبر: باید با "${t.suffix}" تمام شود`:t.format===`includes`?`رشته نامعتبر: باید شامل "${t.includes}" باشد`:t.format===`regex`?`رشته نامعتبر: باید با الگوی ${t.pattern} مطابقت داشته باشد`:`${n[t.format]??e.format} نامعتبر`}case`not_multiple_of`:return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case`unrecognized_keys`:return`کلید${e.keys.length>1?`های`:``} ناشناس: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`کلید ناشناس در ${e.origin}`;case`invalid_union`:return`ورودی نامعتبر`;case`invalid_element`:return`مقدار نامعتبر در ${e.origin}`;default:return`ورودی نامعتبر`}}};function HOe(){return{localeError:VOe()}}var UOe=()=>{let e={string:{unit:`merkkiä`,subject:`merkkijonon`},file:{unit:`tavua`,subject:`tiedoston`},array:{unit:`alkiota`,subject:`listan`},set:{unit:`alkiota`,subject:`joukon`},number:{unit:``,subject:`luvun`},bigint:{unit:``,subject:`suuren kokonaisluvun`},int:{unit:``,subject:`kokonaisluvun`},date:{unit:``,subject:`päivämäärän`}};function t(t){return e[t]??null}let n={regex:`säännöllinen lauseke`,email:`sähköpostiosoite`,url:`URL-osoite`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-aikaleima`,date:`ISO-päivämäärä`,time:`ISO-aika`,duration:`ISO-kesto`,ipv4:`IPv4-osoite`,ipv6:`IPv6-osoite`,cidrv4:`IPv4-alue`,cidrv6:`IPv6-alue`,base64:`base64-koodattu merkkijono`,base64url:`base64url-koodattu merkkijono`,json_string:`JSON-merkkijono`,e164:`E.164-luku`,jwt:`JWT`,template_literal:`templaattimerkkijono`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case`invalid_value`:return e.values.length===1?`Virheellinen syöte: täytyy olla ${i$(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Liian suuri: ${r.subject} täytyy olla ${n}${e.maximum.toString()} ${r.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Liian pieni: ${r.subject} täytyy olla ${n}${e.minimum.toString()} ${r.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Virheellinen syöte: täytyy alkaa "${t.prefix}"`:t.format===`ends_with`?`Virheellinen syöte: täytyy loppua "${t.suffix}"`:t.format===`includes`?`Virheellinen syöte: täytyy sisältää "${t.includes}"`:t.format===`regex`?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${t.pattern}`:`Virheellinen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case`unrecognized_keys`:return`${e.keys.length>1?`Tuntemattomat avaimet`:`Tuntematon avain`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Virheellinen avain tietueessa`;case`invalid_union`:return`Virheellinen unioni`;case`invalid_element`:return`Virheellinen arvo joukossa`;default:return`Virheellinen syöte`}}};function WOe(){return{localeError:UOe()}}var GOe=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date et heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`,number:`nombre`,array:`tableau`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : instanceof ${e.expected} attendu, ${i} reçu`:`Entrée invalide : ${t} attendu, ${i} reçu`}case`invalid_value`:return e.values.length===1?`Entrée invalide : ${i$(e.values[0])} attendu`:`Option invalide : une valeur parmi ${IQ(e.values,`|`)} attendue`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Trop grand : ${e.origin??`valeur`} doit ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`élément(s)`}`:`Trop grand : ${e.origin??`valeur`} doit être ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Trop petit : ${e.origin} doit ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : ${e.origin} doit être ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au modèle ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function KOe(){return{localeError:GOe()}}var qOe=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse courriel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date-heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : attendu instanceof ${e.expected}, reçu ${i}`:`Entrée invalide : attendu ${t}, reçu ${i}`}case`invalid_value`:return e.values.length===1?`Entrée invalide : attendu ${i$(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`≤`:`<`,r=t(e.origin);return r?`Trop grand : attendu que ${e.origin??`la valeur`} ait ${n}${e.maximum.toString()} ${r.unit}`:`Trop grand : attendu que ${e.origin??`la valeur`} soit ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`≥`:`>`,r=t(e.origin);return r?`Trop petit : attendu que ${e.origin} ait ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : attendu que ${e.origin} soit ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au motif ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function JOe(){return{localeError:qOe()}}var YOe=()=>{let e={string:{label:`מחרוזת`,gender:`f`},number:{label:`מספר`,gender:`m`},boolean:{label:`ערך בוליאני`,gender:`m`},bigint:{label:`BigInt`,gender:`m`},date:{label:`תאריך`,gender:`m`},array:{label:`מערך`,gender:`m`},object:{label:`אובייקט`,gender:`m`},null:{label:`ערך ריק (null)`,gender:`m`},undefined:{label:`ערך לא מוגדר (undefined)`,gender:`m`},symbol:{label:`סימבול (Symbol)`,gender:`m`},function:{label:`פונקציה`,gender:`f`},map:{label:`מפה (Map)`,gender:`f`},set:{label:`קבוצה (Set)`,gender:`f`},file:{label:`קובץ`,gender:`m`},promise:{label:`Promise`,gender:`m`},NaN:{label:`NaN`,gender:`m`},unknown:{label:`ערך לא ידוע`,gender:`m`},value:{label:`ערך`,gender:`m`}},t={string:{unit:`תווים`,shortLabel:`קצר`,longLabel:`ארוך`},file:{unit:`בייטים`,shortLabel:`קטן`,longLabel:`גדול`},array:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},set:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},number:{unit:``,shortLabel:`קטן`,longLabel:`גדול`}},n=t=>t?e[t]:void 0,r=t=>{let r=n(t);return r?r.label:t??e.unknown.label},i=e=>`ה${r(e)}`,a=e=>(n(e)?.gender??`m`)===`f`?`צריכה להיות`:`צריך להיות`,o=e=>e?t[e]??null:null,s={regex:{label:`קלט`,gender:`m`},email:{label:`כתובת אימייל`,gender:`f`},url:{label:`כתובת רשת`,gender:`f`},emoji:{label:`אימוג'י`,gender:`m`},uuid:{label:`UUID`,gender:`m`},nanoid:{label:`nanoid`,gender:`m`},guid:{label:`GUID`,gender:`m`},cuid:{label:`cuid`,gender:`m`},cuid2:{label:`cuid2`,gender:`m`},ulid:{label:`ULID`,gender:`m`},xid:{label:`XID`,gender:`m`},ksuid:{label:`KSUID`,gender:`m`},datetime:{label:`תאריך וזמן ISO`,gender:`m`},date:{label:`תאריך ISO`,gender:`m`},time:{label:`זמן ISO`,gender:`m`},duration:{label:`משך זמן ISO`,gender:`m`},ipv4:{label:`כתובת IPv4`,gender:`f`},ipv6:{label:`כתובת IPv6`,gender:`f`},cidrv4:{label:`טווח IPv4`,gender:`m`},cidrv6:{label:`טווח IPv6`,gender:`m`},base64:{label:`מחרוזת בבסיס 64`,gender:`f`},base64url:{label:`מחרוזת בבסיס 64 לכתובות רשת`,gender:`f`},json_string:{label:`מחרוזת JSON`,gender:`f`},e164:{label:`מספר E.164`,gender:`m`},jwt:{label:`JWT`,gender:`m`},ends_with:{label:`קלט`,gender:`m`},includes:{label:`קלט`,gender:`m`},lowercase:{label:`קלט`,gender:`m`},starts_with:{label:`קלט`,gender:`m`},uppercase:{label:`קלט`,gender:`m`}},c={nan:`NaN`};return t=>{switch(t.code){case`invalid_type`:{let n=t.expected,i=c[n??``]??r(n),a=m$(t.input),o=c[a]??e[a]?.label??a;return/^[A-Z]/.test(t.expected)?`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`:`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case`invalid_value`:{if(t.values.length===1)return`ערך לא תקין: הערך חייב להיות ${i$(t.values[0])}`;let e=t.values.map(e=>i$(e));if(t.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let n=e[e.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${e.slice(0,-1).join(`, `)} או ${n}`}case`too_big`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.longLabel??`ארוך`} מדי: ${n} צריכה להכיל ${t.maximum.toString()} ${e?.unit??``} ${t.inclusive?`או פחות`:`לכל היותר`}`.trim();if(t.origin===`number`)return`גדול מדי: ${n} צריך להיות ${t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`}`;if(t.origin===`array`||t.origin===`set`)return`גדול מדי: ${n} ${t.origin===`set`?`צריכה`:`צריך`} להכיל ${t.inclusive?`${t.maximum} ${e?.unit??``} או פחות`:`פחות מ-${t.maximum} ${e?.unit??``}`}`.trim();let r=t.inclusive?`<=`:`<`,s=a(t.origin??`value`);return e?.unit?`${e.longLabel} מדי: ${n} ${s} ${r}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??`גדול`} מדי: ${n} ${s} ${r}${t.maximum.toString()}`}case`too_small`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.shortLabel??`קצר`} מדי: ${n} צריכה להכיל ${t.minimum.toString()} ${e?.unit??``} ${t.inclusive?`או יותר`:`לפחות`}`.trim();if(t.origin===`number`)return`קטן מדי: ${n} צריך להיות ${t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`}`;if(t.origin===`array`||t.origin===`set`){let r=t.origin===`set`?`צריכה`:`צריך`;return t.minimum===1&&t.inclusive?`קטן מדי: ${n} ${r} להכיל ${t.origin,`לפחות פריט אחד`}`:`קטן מדי: ${n} ${r} להכיל ${t.inclusive?`${t.minimum} ${e?.unit??``} או יותר`:`יותר מ-${t.minimum} ${e?.unit??``}`}`.trim()}let r=t.inclusive?`>=`:`>`,s=a(t.origin??`value`);return e?.unit?`${e.shortLabel} מדי: ${n} ${s} ${r}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??`קטן`} מדי: ${n} ${s} ${r}${t.minimum.toString()}`}case`invalid_format`:{let e=t;if(e.format===`starts_with`)return`המחרוזת חייבת להתחיל ב "${e.prefix}"`;if(e.format===`ends_with`)return`המחרוזת חייבת להסתיים ב "${e.suffix}"`;if(e.format===`includes`)return`המחרוזת חייבת לכלול "${e.includes}"`;if(e.format===`regex`)return`המחרוזת חייבת להתאים לתבנית ${e.pattern}`;let n=s[e.format];return`${n?.label??e.format} לא ${(n?.gender??`m`)===`f`?`תקינה`:`תקין`}`}case`not_multiple_of`:return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case`unrecognized_keys`:return`מפתח${t.keys.length>1?`ות`:``} לא מזוה${t.keys.length>1?`ים`:`ה`}: ${IQ(t.keys,`, `)}`;case`invalid_key`:return`שדה לא תקין באובייקט`;case`invalid_union`:return`קלט לא תקין`;case`invalid_element`:return`ערך לא תקין ב${i(t.origin??`array`)}`;default:return`קלט לא תקין`}}};function XOe(){return{localeError:YOe()}}var ZOe=()=>{let e={string:{unit:`karakter`,verb:`legyen`},file:{unit:`byte`,verb:`legyen`},array:{unit:`elem`,verb:`legyen`},set:{unit:`elem`,verb:`legyen`}};function t(t){return e[t]??null}let n={regex:`bemenet`,email:`email cím`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO időbélyeg`,date:`ISO dátum`,time:`ISO idő`,duration:`ISO időintervallum`,ipv4:`IPv4 cím`,ipv6:`IPv6 cím`,cidrv4:`IPv4 tartomány`,cidrv6:`IPv6 tartomány`,base64:`base64-kódolt string`,base64url:`base64url-kódolt string`,json_string:`JSON string`,e164:`E.164 szám`,jwt:`JWT`,template_literal:`bemenet`},r={nan:`NaN`,number:`szám`,array:`tömb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Érvénytelen bemenet: a várt érték instanceof ${e.expected}, a kapott érték ${i}`:`Érvénytelen bemenet: a várt érték ${t}, a kapott érték ${i}`}case`invalid_value`:return e.values.length===1?`Érvénytelen bemenet: a várt érték ${i$(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Túl nagy: ${e.origin??`érték`} mérete túl nagy ${n}${e.maximum.toString()} ${r.unit??`elem`}`:`Túl nagy: a bemeneti érték ${e.origin??`érték`} túl nagy: ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${n}${e.minimum.toString()} ${r.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Érvénytelen string: "${t.prefix}" értékkel kell kezdődnie`:t.format===`ends_with`?`Érvénytelen string: "${t.suffix}" értékkel kell végződnie`:t.format===`includes`?`Érvénytelen string: "${t.includes}" értéket kell tartalmaznia`:t.format===`regex`?`Érvénytelen string: ${t.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case`unrecognized_keys`:return`Ismeretlen kulcs${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Érvénytelen kulcs ${e.origin}`;case`invalid_union`:return`Érvénytelen bemenet`;case`invalid_element`:return`Érvénytelen érték: ${e.origin}`;default:return`Érvénytelen bemenet`}}};function QOe(){return{localeError:ZOe()}}function V2(e,t,n){return Math.abs(e)===1?t:n}function H2(e){if(!e)return``;let t=[`ա`,`ե`,`ը`,`ի`,`ո`,`ու`,`օ`],n=e[e.length-1];return e+(t.includes(n)?`ն`:`ը`)}var $Oe=()=>{let e={string:{unit:{one:`նշան`,many:`նշաններ`},verb:`ունենալ`},file:{unit:{one:`բայթ`,many:`բայթեր`},verb:`ունենալ`},array:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`},set:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`}};function t(t){return e[t]??null}let n={regex:`մուտք`,email:`էլ. հասցե`,url:`URL`,emoji:`էմոջի`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO ամսաթիվ և ժամ`,date:`ISO ամսաթիվ`,time:`ISO ժամ`,duration:`ISO տևողություն`,ipv4:`IPv4 հասցե`,ipv6:`IPv6 հասցե`,cidrv4:`IPv4 միջակայք`,cidrv6:`IPv6 միջակայք`,base64:`base64 ձևաչափով տող`,base64url:`base64url ձևաչափով տող`,json_string:`JSON տող`,e164:`E.164 համար`,jwt:`JWT`,template_literal:`մուտք`},r={nan:`NaN`,number:`թիվ`,array:`զանգված`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${e.expected}, ստացվել է ${i}`:`Սխալ մուտքագրում․ սպասվում էր ${t}, ստացվել է ${i}`}case`invalid_value`:return e.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${i$(e.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=V2(Number(e.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${H2(e.origin??`արժեք`)} կունենա ${n}${e.maximum.toString()} ${t}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${H2(e.origin??`արժեք`)} լինի ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=V2(Number(e.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${H2(e.origin)} կունենա ${n}${e.minimum.toString()} ${t}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${H2(e.origin)} լինի ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Սխալ տող․ պետք է սկսվի "${t.prefix}"-ով`:t.format===`ends_with`?`Սխալ տող․ պետք է ավարտվի "${t.suffix}"-ով`:t.format===`includes`?`Սխալ տող․ պետք է պարունակի "${t.includes}"`:t.format===`regex`?`Սխալ տող․ պետք է համապատասխանի ${t.pattern} ձևաչափին`:`Սխալ ${n[t.format]??e.format}`}case`not_multiple_of`:return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${e.divisor}-ի`;case`unrecognized_keys`:return`Չճանաչված բանալի${e.keys.length>1?`ներ`:``}. ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Սխալ բանալի ${H2(e.origin)}-ում`;case`invalid_union`:return`Սխալ մուտքագրում`;case`invalid_element`:return`Սխալ արժեք ${H2(e.origin)}-ում`;default:return`Սխալ մուտքագրում`}}};function eke(){return{localeError:$Oe()}}var tke=()=>{let e={string:{unit:`karakter`,verb:`memiliki`},file:{unit:`byte`,verb:`memiliki`},array:{unit:`item`,verb:`memiliki`},set:{unit:`item`,verb:`memiliki`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tanggal dan waktu format ISO`,date:`tanggal format ISO`,time:`jam format ISO`,duration:`durasi format ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`rentang alamat IPv4`,cidrv6:`rentang alamat IPv6`,base64:`string dengan enkode base64`,base64url:`string dengan enkode base64url`,json_string:`string JSON`,e164:`angka E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak valid: diharapkan ${i$(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: diharapkan ${e.origin??`value`} memiliki ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: diharapkan ${e.origin??`value`} menjadi ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: diharapkan ${e.origin} memiliki ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak valid: harus dimulai dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak valid: harus berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak valid: harus menyertakan "${t.includes}"`:t.format===`regex`?`String tidak valid: harus sesuai pola ${t.pattern}`:`${n[t.format]??e.format} tidak valid`}case`not_multiple_of`:return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali ${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak valid di ${e.origin}`;case`invalid_union`:return`Input tidak valid`;case`invalid_element`:return`Nilai tidak valid di ${e.origin}`;default:return`Input tidak valid`}}};function nke(){return{localeError:tke()}}var rke=()=>{let e={string:{unit:`stafi`,verb:`að hafa`},file:{unit:`bæti`,verb:`að hafa`},array:{unit:`hluti`,verb:`að hafa`},set:{unit:`hluti`,verb:`að hafa`}};function t(t){return e[t]??null}let n={regex:`gildi`,email:`netfang`,url:`vefslóð`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dagsetning og tími`,date:`ISO dagsetning`,time:`ISO tími`,duration:`ISO tímalengd`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded strengur`,base64url:`base64url-encoded strengur`,json_string:`JSON strengur`,e164:`E.164 tölugildi`,jwt:`JWT`,template_literal:`gildi`},r={nan:`NaN`,number:`númer`,array:`fylki`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${e.expected}`:`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${t}`}case`invalid_value`:return e.values.length===1?`Rangt gildi: gert ráð fyrir ${i$(e.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} hafi ${n}${e.maximum.toString()} ${r.unit??`hluti`}`:`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} sé ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Of lítið: gert er ráð fyrir að ${e.origin} hafi ${n}${e.minimum.toString()} ${r.unit}`:`Of lítið: gert er ráð fyrir að ${e.origin} sé ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ógildur strengur: verður að byrja á "${t.prefix}"`:t.format===`ends_with`?`Ógildur strengur: verður að enda á "${t.suffix}"`:t.format===`includes`?`Ógildur strengur: verður að innihalda "${t.includes}"`:t.format===`regex`?`Ógildur strengur: verður að fylgja mynstri ${t.pattern}`:`Rangt ${n[t.format]??e.format}`}case`not_multiple_of`:return`Röng tala: verður að vera margfeldi af ${e.divisor}`;case`unrecognized_keys`:return`Óþekkt ${e.keys.length>1?`ir lyklar`:`ur lykill`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Rangur lykill í ${e.origin}`;case`invalid_union`:return`Rangt gildi`;case`invalid_element`:return`Rangt gildi í ${e.origin}`;default:return`Rangt gildi`}}};function ike(){return{localeError:rke()}}var ake=()=>{let e={string:{unit:`caratteri`,verb:`avere`},file:{unit:`byte`,verb:`avere`},array:{unit:`elementi`,verb:`avere`},set:{unit:`elementi`,verb:`avere`}};function t(t){return e[t]??null}let n={regex:`input`,email:`indirizzo email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e ora ISO`,date:`data ISO`,time:`ora ISO`,duration:`durata ISO`,ipv4:`indirizzo IPv4`,ipv6:`indirizzo IPv6`,cidrv4:`intervallo IPv4`,cidrv6:`intervallo IPv6`,base64:`stringa codificata in base64`,base64url:`URL codificata in base64`,json_string:`stringa JSON`,e164:`numero E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`numero`,array:`vettore`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case`invalid_value`:return e.values.length===1?`Input non valido: atteso ${i$(e.values[0])}`:`Opzione non valida: atteso uno tra ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Troppo grande: ${e.origin??`valore`} deve avere ${n}${e.maximum.toString()} ${r.unit??`elementi`}`:`Troppo grande: ${e.origin??`valore`} deve essere ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Troppo piccolo: ${e.origin} deve avere ${n}${e.minimum.toString()} ${r.unit}`:`Troppo piccolo: ${e.origin} deve essere ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Stringa non valida: deve iniziare con "${t.prefix}"`:t.format===`ends_with`?`Stringa non valida: deve terminare con "${t.suffix}"`:t.format===`includes`?`Stringa non valida: deve includere "${t.includes}"`:t.format===`regex`?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case`unrecognized_keys`:return`Chiav${e.keys.length>1?`i`:`e`} non riconosciut${e.keys.length>1?`e`:`a`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Chiave non valida in ${e.origin}`;case`invalid_union`:return`Input non valido`;case`invalid_element`:return`Valore non valido in ${e.origin}`;default:return`Input non valido`}}};function oke(){return{localeError:ake()}}var ske=()=>{let e={string:{unit:`文字`,verb:`である`},file:{unit:`バイト`,verb:`である`},array:{unit:`要素`,verb:`である`},set:{unit:`要素`,verb:`である`}};function t(t){return e[t]??null}let n={regex:`入力値`,email:`メールアドレス`,url:`URL`,emoji:`絵文字`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日時`,date:`ISO日付`,time:`ISO時刻`,duration:`ISO期間`,ipv4:`IPv4アドレス`,ipv6:`IPv6アドレス`,cidrv4:`IPv4範囲`,cidrv6:`IPv6範囲`,base64:`base64エンコード文字列`,base64url:`base64urlエンコード文字列`,json_string:`JSON文字列`,e164:`E.164番号`,jwt:`JWT`,template_literal:`入力値`},r={nan:`NaN`,number:`数値`,array:`配列`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無効な入力: instanceof ${e.expected}が期待されましたが、${i}が入力されました`:`無効な入力: ${t}が期待されましたが、${i}が入力されました`}case`invalid_value`:return e.values.length===1?`無効な入力: ${i$(e.values[0])}が期待されました`:`無効な選択: ${IQ(e.values,`、`)}のいずれかである必要があります`;case`too_big`:{let n=e.inclusive?`以下である`:`より小さい`,r=t(e.origin);return r?`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${r.unit??`要素`}${n}必要があります`:`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${n}必要があります`}case`too_small`:{let n=e.inclusive?`以上である`:`より大きい`,r=t(e.origin);return r?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${r.unit}${n}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${n}必要があります`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無効な文字列: "${t.prefix}"で始まる必要があります`:t.format===`ends_with`?`無効な文字列: "${t.suffix}"で終わる必要があります`:t.format===`includes`?`無効な文字列: "${t.includes}"を含む必要があります`:t.format===`regex`?`無効な文字列: パターン${t.pattern}に一致する必要があります`:`無効な${n[t.format]??e.format}`}case`not_multiple_of`:return`無効な数値: ${e.divisor}の倍数である必要があります`;case`unrecognized_keys`:return`認識されていないキー${e.keys.length>1?`群`:``}: ${IQ(e.keys,`、`)}`;case`invalid_key`:return`${e.origin}内の無効なキー`;case`invalid_union`:return`無効な入力`;case`invalid_element`:return`${e.origin}内の無効な値`;default:return`無効な入力`}}};function cke(){return{localeError:ske()}}var lke=()=>{let e={string:{unit:`სიმბოლო`,verb:`უნდა შეიცავდეს`},file:{unit:`ბაიტი`,verb:`უნდა შეიცავდეს`},array:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`},set:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`}};function t(t){return e[t]??null}let n={regex:`შეყვანა`,email:`ელ-ფოსტის მისამართი`,url:`URL`,emoji:`ემოჯი`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`თარიღი-დრო`,date:`თარიღი`,time:`დრო`,duration:`ხანგრძლივობა`,ipv4:`IPv4 მისამართი`,ipv6:`IPv6 მისამართი`,cidrv4:`IPv4 დიაპაზონი`,cidrv6:`IPv6 დიაპაზონი`,base64:`base64-კოდირებული სტრინგი`,base64url:`base64url-კოდირებული სტრინგი`,json_string:`JSON სტრინგი`,e164:`E.164 ნომერი`,jwt:`JWT`,template_literal:`შეყვანა`},r={nan:`NaN`,number:`რიცხვი`,string:`სტრინგი`,boolean:`ბულეანი`,function:`ფუნქცია`,array:`მასივი`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${e.expected}, მიღებული ${i}`:`არასწორი შეყვანა: მოსალოდნელი ${t}, მიღებული ${i}`}case`invalid_value`:return e.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${i$(e.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${IQ(e.values,`|`)}-დან`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} იყოს ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ზედმეტად პატარა: მოსალოდნელი ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${e.origin} იყოს ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`არასწორი სტრინგი: უნდა იწყებოდეს "${t.prefix}"-ით`:t.format===`ends_with`?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${t.suffix}"-ით`:t.format===`includes`?`არასწორი სტრინგი: უნდა შეიცავდეს "${t.includes}"-ს`:t.format===`regex`?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${t.pattern}`:`არასწორი ${n[t.format]??e.format}`}case`not_multiple_of`:return`არასწორი რიცხვი: უნდა იყოს ${e.divisor}-ის ჯერადი`;case`unrecognized_keys`:return`უცნობი გასაღებ${e.keys.length>1?`ები`:`ი`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`არასწორი გასაღები ${e.origin}-ში`;case`invalid_union`:return`არასწორი შეყვანა`;case`invalid_element`:return`არასწორი მნიშვნელობა ${e.origin}-ში`;default:return`არასწორი შეყვანა`}}};function uke(){return{localeError:lke()}}var dke=()=>{let e={string:{unit:`តួអក្សរ`,verb:`គួរមាន`},file:{unit:`បៃ`,verb:`គួរមាន`},array:{unit:`ធាតុ`,verb:`គួរមាន`},set:{unit:`ធាតុ`,verb:`គួរមាន`}};function t(t){return e[t]??null}let n={regex:`ទិន្នន័យបញ្ចូល`,email:`អាសយដ្ឋានអ៊ីមែល`,url:`URL`,emoji:`សញ្ញាអារម្មណ៍`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`កាលបរិច្ឆេទ និងម៉ោង ISO`,date:`កាលបរិច្ឆេទ ISO`,time:`ម៉ោង ISO`,duration:`រយៈពេល ISO`,ipv4:`អាសយដ្ឋាន IPv4`,ipv6:`អាសយដ្ឋាន IPv6`,cidrv4:`ដែនអាសយដ្ឋាន IPv4`,cidrv6:`ដែនអាសយដ្ឋាន IPv6`,base64:`ខ្សែអក្សរអ៊ិកូដ base64`,base64url:`ខ្សែអក្សរអ៊ិកូដ base64url`,json_string:`ខ្សែអក្សរ JSON`,e164:`លេខ E.164`,jwt:`JWT`,template_literal:`ទិន្នន័យបញ្ចូល`},r={nan:`NaN`,number:`លេខ`,array:`អារេ (Array)`,null:`គ្មានតម្លៃ (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${e.expected} ប៉ុន្តែទទួលបាន ${i}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t} ប៉ុន្តែទទួលបាន ${i}`}case`invalid_value`:return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${i$(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()} ${r.unit??`ធាតុ`}`:`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()} ${r.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${t.prefix}"`:t.format===`ends_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${t.suffix}"`:t.format===`includes`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${t.includes}"`:t.format===`regex`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${t.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[t.format]??e.format}`}case`not_multiple_of`:return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case`unrecognized_keys`:return`រកឃើញសោមិនស្គាល់៖ ${IQ(e.keys,`, `)}`;case`invalid_key`:return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case`invalid_union`:return`ទិន្នន័យមិនត្រឹមត្រូវ`;case`invalid_element`:return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return`ទិន្នន័យមិនត្រឹមត្រូវ`}}};function U2(){return{localeError:dke()}}function fke(){return U2()}var pke=()=>{let e={string:{unit:`문자`,verb:`to have`},file:{unit:`바이트`,verb:`to have`},array:{unit:`개`,verb:`to have`},set:{unit:`개`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`입력`,email:`이메일 주소`,url:`URL`,emoji:`이모지`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 날짜시간`,date:`ISO 날짜`,time:`ISO 시간`,duration:`ISO 기간`,ipv4:`IPv4 주소`,ipv6:`IPv6 주소`,cidrv4:`IPv4 범위`,cidrv6:`IPv6 범위`,base64:`base64 인코딩 문자열`,base64url:`base64url 인코딩 문자열`,json_string:`JSON 문자열`,e164:`E.164 번호`,jwt:`JWT`,template_literal:`입력`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`잘못된 입력: 예상 타입은 instanceof ${e.expected}, 받은 타입은 ${i}입니다`:`잘못된 입력: 예상 타입은 ${t}, 받은 타입은 ${i}입니다`}case`invalid_value`:return e.values.length===1?`잘못된 입력: 값은 ${i$(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${IQ(e.values,`또는 `)} 중 하나여야 합니다`;case`too_big`:{let n=e.inclusive?`이하`:`미만`,r=n===`미만`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()} ${n}${r}`}case`too_small`:{let n=e.inclusive?`이상`:`초과`,r=n===`이상`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()} ${n}${r}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`잘못된 문자열: "${t.prefix}"(으)로 시작해야 합니다`:t.format===`ends_with`?`잘못된 문자열: "${t.suffix}"(으)로 끝나야 합니다`:t.format===`includes`?`잘못된 문자열: "${t.includes}"을(를) 포함해야 합니다`:t.format===`regex`?`잘못된 문자열: 정규식 ${t.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[t.format]??e.format}`}case`not_multiple_of`:return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case`unrecognized_keys`:return`인식할 수 없는 키: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`잘못된 키: ${e.origin}`;case`invalid_union`:return`잘못된 입력`;case`invalid_element`:return`잘못된 값: ${e.origin}`;default:return`잘못된 입력`}}};function mke(){return{localeError:pke()}}var W2=e=>e.charAt(0).toUpperCase()+e.slice(1);function G2(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?`many`:n===1?`one`:`few`}var hke=()=>{let e={string:{unit:{one:`simbolis`,few:`simboliai`,many:`simbolių`},verb:{smaller:{inclusive:`turi būti ne ilgesnė kaip`,notInclusive:`turi būti trumpesnė kaip`},bigger:{inclusive:`turi būti ne trumpesnė kaip`,notInclusive:`turi būti ilgesnė kaip`}}},file:{unit:{one:`baitas`,few:`baitai`,many:`baitų`},verb:{smaller:{inclusive:`turi būti ne didesnis kaip`,notInclusive:`turi būti mažesnis kaip`},bigger:{inclusive:`turi būti ne mažesnis kaip`,notInclusive:`turi būti didesnis kaip`}}},array:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}},set:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}}};function t(t,n,r,i){let a=e[t]??null;return a===null?a:{unit:a.unit[n],verb:a.verb[i][r?`inclusive`:`notInclusive`]}}let n={regex:`įvestis`,email:`el. pašto adresas`,url:`URL`,emoji:`jaustukas`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO data ir laikas`,date:`ISO data`,time:`ISO laikas`,duration:`ISO trukmė`,ipv4:`IPv4 adresas`,ipv6:`IPv6 adresas`,cidrv4:`IPv4 tinklo prefiksas (CIDR)`,cidrv6:`IPv6 tinklo prefiksas (CIDR)`,base64:`base64 užkoduota eilutė`,base64url:`base64url užkoduota eilutė`,json_string:`JSON eilutė`,e164:`E.164 numeris`,jwt:`JWT`,template_literal:`įvestis`},r={nan:`NaN`,number:`skaičius`,bigint:`sveikasis skaičius`,string:`eilutė`,boolean:`loginė reikšmė`,undefined:`neapibrėžta reikšmė`,function:`funkcija`,symbol:`simbolis`,array:`masyvas`,object:`objektas`,null:`nulinė reikšmė`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikėtasi - ${t}`}case`invalid_value`:return e.values.length===1?`Privalo būti ${i$(e.values[0])}`:`Privalo būti vienas iš ${IQ(e.values,`|`)} pasirinkimų`;case`too_big`:{let n=r[e.origin]??e.origin,i=t(e.origin,G2(Number(e.maximum)),e.inclusive??!1,`smaller`);if(i?.verb)return`${W2(n??e.origin??`reikšmė`)} ${i.verb} ${e.maximum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne didesnis kaip`:`mažesnis kaip`;return`${W2(n??e.origin??`reikšmė`)} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case`too_small`:{let n=r[e.origin]??e.origin,i=t(e.origin,G2(Number(e.minimum)),e.inclusive??!1,`bigger`);if(i?.verb)return`${W2(n??e.origin??`reikšmė`)} ${i.verb} ${e.minimum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne mažesnis kaip`:`didesnis kaip`;return`${W2(n??e.origin??`reikšmė`)} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Eilutė privalo prasidėti "${t.prefix}"`:t.format===`ends_with`?`Eilutė privalo pasibaigti "${t.suffix}"`:t.format===`includes`?`Eilutė privalo įtraukti "${t.includes}"`:t.format===`regex`?`Eilutė privalo atitikti ${t.pattern}`:`Neteisingas ${n[t.format]??e.format}`}case`not_multiple_of`:return`Skaičius privalo būti ${e.divisor} kartotinis.`;case`unrecognized_keys`:return`Neatpažint${e.keys.length>1?`i`:`as`} rakt${e.keys.length>1?`ai`:`as`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Rastas klaidingas raktas`;case`invalid_union`:return`Klaidinga įvestis`;case`invalid_element`:return`${W2(r[e.origin]??e.origin??e.origin??`reikšmė`)} turi klaidingą įvestį`;default:return`Klaidinga įvestis`}}};function gke(){return{localeError:hke()}}var _ke=()=>{let e={string:{unit:`знаци`,verb:`да имаат`},file:{unit:`бајти`,verb:`да имаат`},array:{unit:`ставки`,verb:`да имаат`},set:{unit:`ставки`,verb:`да имаат`}};function t(t){return e[t]??null}let n={regex:`внес`,email:`адреса на е-пошта`,url:`URL`,emoji:`емоџи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO датум и време`,date:`ISO датум`,time:`ISO време`,duration:`ISO времетраење`,ipv4:`IPv4 адреса`,ipv6:`IPv6 адреса`,cidrv4:`IPv4 опсег`,cidrv6:`IPv6 опсег`,base64:`base64-енкодирана низа`,base64url:`base64url-енкодирана низа`,json_string:`JSON низа`,e164:`E.164 број`,jwt:`JWT`,template_literal:`внес`},r={nan:`NaN`,number:`број`,array:`низа`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Грешен внес: се очекува instanceof ${e.expected}, примено ${i}`:`Грешен внес: се очекува ${t}, примено ${i}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${i$(e.values[0])}`:`Грешана опција: се очекува една ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Премногу голем: се очекува ${e.origin??`вредноста`} да има ${n}${e.maximum.toString()} ${r.unit??`елементи`}`:`Премногу голем: се очекува ${e.origin??`вредноста`} да биде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Премногу мал: се очекува ${e.origin} да има ${n}${e.minimum.toString()} ${r.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неважечка низа: мора да започнува со "${t.prefix}"`:t.format===`ends_with`?`Неважечка низа: мора да завршува со "${t.suffix}"`:t.format===`includes`?`Неважечка низа: мора да вклучува "${t.includes}"`:t.format===`regex`?`Неважечка низа: мора да одгоара на патернот ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Грешен број: мора да биде делив со ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Непрепознаени клучеви`:`Непрепознаен клуч`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Грешен клуч во ${e.origin}`;case`invalid_union`:return`Грешен внес`;case`invalid_element`:return`Грешна вредност во ${e.origin}`;default:return`Грешен внес`}}};function vke(){return{localeError:_ke()}}var yke=()=>{let e={string:{unit:`aksara`,verb:`mempunyai`},file:{unit:`bait`,verb:`mempunyai`},array:{unit:`elemen`,verb:`mempunyai`},set:{unit:`elemen`,verb:`mempunyai`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat e-mel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tarikh masa ISO`,date:`tarikh ISO`,time:`masa ISO`,duration:`tempoh ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`julat IPv4`,cidrv6:`julat IPv6`,base64:`string dikodkan base64`,base64url:`string dikodkan base64url`,json_string:`string JSON`,e164:`nombor E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`nombor`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak sah: dijangka ${i$(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: dijangka ${e.origin??`nilai`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: dijangka ${e.origin??`nilai`} adalah ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: dijangka ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak sah: mesti bermula dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak sah: mesti mengandungi "${t.includes}"`:t.format===`regex`?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${n[t.format]??e.format} tidak sah`}case`not_multiple_of`:return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak sah dalam ${e.origin}`;case`invalid_union`:return`Input tidak sah`;case`invalid_element`:return`Nilai tidak sah dalam ${e.origin}`;default:return`Input tidak sah`}}};function bke(){return{localeError:yke()}}var xke=()=>{let e={string:{unit:`tekens`,verb:`heeft`},file:{unit:`bytes`,verb:`heeft`},array:{unit:`elementen`,verb:`heeft`},set:{unit:`elementen`,verb:`heeft`}};function t(t){return e[t]??null}let n={regex:`invoer`,email:`emailadres`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum en tijd`,date:`ISO datum`,time:`ISO tijd`,duration:`ISO duur`,ipv4:`IPv4-adres`,ipv6:`IPv6-adres`,cidrv4:`IPv4-bereik`,cidrv6:`IPv6-bereik`,base64:`base64-gecodeerde tekst`,base64url:`base64 URL-gecodeerde tekst`,json_string:`JSON string`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`invoer`},r={nan:`NaN`,number:`getal`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case`invalid_value`:return e.values.length===1?`Ongeldige invoer: verwacht ${i$(e.values[0])}`:`Ongeldige optie: verwacht één van ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin),i=e.origin===`date`?`laat`:e.origin===`string`?`lang`:`groot`;return r?`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} ${r.unit??`elementen`} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} is`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin),i=e.origin===`date`?`vroeg`:e.origin===`string`?`kort`:`klein`;return r?`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} is`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:t.format===`ends_with`?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:t.format===`includes`?`Ongeldige tekst: moet "${t.includes}" bevatten`:t.format===`regex`?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case`unrecognized_keys`:return`Onbekende key${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Ongeldige key in ${e.origin}`;case`invalid_union`:return`Ongeldige invoer`;case`invalid_element`:return`Ongeldige waarde in ${e.origin}`;default:return`Ongeldige invoer`}}};function Ske(){return{localeError:xke()}}var Cke=()=>{let e={string:{unit:`tegn`,verb:`å ha`},file:{unit:`bytes`,verb:`å ha`},array:{unit:`elementer`,verb:`å inneholde`},set:{unit:`elementer`,verb:`å inneholde`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-postadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslett`,date:`ISO-dato`,time:`ISO-klokkeslett`,duration:`ISO-varighet`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spekter`,cidrv6:`IPv6-spekter`,base64:`base64-enkodet streng`,base64url:`base64url-enkodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`tall`,array:`liste`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig verdi: forventet ${i$(e.values[0])}`:`Ugyldig valg: forventet en av ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()} ${r.unit??`elementer`}`:`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()} ${r.unit}`:`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: må starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: må ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: må inneholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: må matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukjente nøkler`:`Ukjent nøkkel`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøkkel i ${e.origin}`;case`invalid_union`:return`Ugyldig input`;case`invalid_element`:return`Ugyldig verdi i ${e.origin}`;default:return`Ugyldig input`}}};function wke(){return{localeError:Cke()}}var Tke=()=>{let e={string:{unit:`harf`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`unsur`,verb:`olmalıdır`},set:{unit:`unsur`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`giren`,email:`epostagâh`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO hengâmı`,date:`ISO tarihi`,time:`ISO zamanı`,duration:`ISO müddeti`,ipv4:`IPv4 nişânı`,ipv6:`IPv6 nişânı`,cidrv4:`IPv4 menzili`,cidrv6:`IPv6 menzili`,base64:`base64-şifreli metin`,base64url:`base64url-şifreli metin`,json_string:`JSON metin`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`giren`},r={nan:`NaN`,number:`numara`,array:`saf`,null:`gayb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Fâsit giren: umulan instanceof ${e.expected}, alınan ${i}`:`Fâsit giren: umulan ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Fâsit giren: umulan ${i$(e.values[0])}`:`Fâsit tercih: mûteberler ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} ${r.unit??`elements`} sahip olmalıydı.`:`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} olmalıydı.`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} ${r.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} olmalıydı.`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Fâsit metin: "${t.prefix}" ile başlamalı.`:t.format===`ends_with`?`Fâsit metin: "${t.suffix}" ile bitmeli.`:t.format===`includes`?`Fâsit metin: "${t.includes}" ihtivâ etmeli.`:t.format===`regex`?`Fâsit metin: ${t.pattern} nakşına uymalı.`:`Fâsit ${n[t.format]??e.format}`}case`not_multiple_of`:return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case`unrecognized_keys`:return`Tanınmayan anahtar ${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} için tanınmayan anahtar var.`;case`invalid_union`:return`Giren tanınamadı.`;case`invalid_element`:return`${e.origin} için tanınmayan kıymet var.`;default:return`Kıymet tanınamadı.`}}};function Eke(){return{localeError:Tke()}}var Dke=()=>{let e={string:{unit:`توکي`,verb:`ولري`},file:{unit:`بایټس`,verb:`ولري`},array:{unit:`توکي`,verb:`ولري`},set:{unit:`توکي`,verb:`ولري`}};function t(t){return e[t]??null}let n={regex:`ورودي`,email:`بریښنالیک`,url:`یو آر ال`,emoji:`ایموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`نیټه او وخت`,date:`نېټه`,time:`وخت`,duration:`موده`,ipv4:`د IPv4 پته`,ipv6:`د IPv6 پته`,cidrv4:`د IPv4 ساحه`,cidrv6:`د IPv6 ساحه`,base64:`base64-encoded متن`,base64url:`base64url-encoded متن`,json_string:`JSON متن`,e164:`د E.164 شمېره`,jwt:`JWT`,template_literal:`ورودي`},r={nan:`NaN`,number:`عدد`,array:`ارې`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ناسم ورودي: باید instanceof ${e.expected} وای, مګر ${i} ترلاسه شو`:`ناسم ورودي: باید ${t} وای, مګر ${i} ترلاسه شو`}case`invalid_value`:return e.values.length===1?`ناسم ورودي: باید ${i$(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${IQ(e.values,`|`)} څخه وای`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصرونه`} ولري`:`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} وي`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} وي`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ناسم متن: باید د "${t.prefix}" سره پیل شي`:t.format===`ends_with`?`ناسم متن: باید د "${t.suffix}" سره پای ته ورسيږي`:t.format===`includes`?`ناسم متن: باید "${t.includes}" ولري`:t.format===`regex`?`ناسم متن: باید د ${t.pattern} سره مطابقت ولري`:`${n[t.format]??e.format} ناسم دی`}case`not_multiple_of`:return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case`unrecognized_keys`:return`ناسم ${e.keys.length>1?`کلیډونه`:`کلیډ`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`ناسم کلیډ په ${e.origin} کې`;case`invalid_union`:return`ناسمه ورودي`;case`invalid_element`:return`ناسم عنصر په ${e.origin} کې`;default:return`ناسمه ورودي`}}};function Oke(){return{localeError:Dke()}}var kke=()=>{let e={string:{unit:`znaków`,verb:`mieć`},file:{unit:`bajtów`,verb:`mieć`},array:{unit:`elementów`,verb:`mieć`},set:{unit:`elementów`,verb:`mieć`}};function t(t){return e[t]??null}let n={regex:`wyrażenie`,email:`adres email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i godzina w formacie ISO`,date:`data w formacie ISO`,time:`godzina w formacie ISO`,duration:`czas trwania ISO`,ipv4:`adres IPv4`,ipv6:`adres IPv6`,cidrv4:`zakres IPv4`,cidrv6:`zakres IPv6`,base64:`ciąg znaków zakodowany w formacie base64`,base64url:`ciąg znaków zakodowany w formacie base64url`,json_string:`ciąg znaków w formacie JSON`,e164:`liczba E.164`,jwt:`JWT`,template_literal:`wejście`},r={nan:`NaN`,number:`liczba`,array:`tablica`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`Nieprawidłowe dane wejściowe: oczekiwano ${t}, otrzymano ${i}`}case`invalid_value`:return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${i$(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Za duża wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.maximum.toString()} ${r.unit??`elementów`}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Za mała wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.minimum.toString()} ${r.unit??`elementów`}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${t.prefix}"`:t.format===`ends_with`?`Nieprawidłowy ciąg znaków: musi kończyć się na "${t.suffix}"`:t.format===`includes`?`Nieprawidłowy ciąg znaków: musi zawierać "${t.includes}"`:t.format===`regex`?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${t.pattern}`:`Nieprawidłow(y/a/e) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case`unrecognized_keys`:return`Nierozpoznane klucze${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Nieprawidłowy klucz w ${e.origin}`;case`invalid_union`:return`Nieprawidłowe dane wejściowe`;case`invalid_element`:return`Nieprawidłowa wartość w ${e.origin}`;default:return`Nieprawidłowe dane wejściowe`}}};function Ake(){return{localeError:kke()}}var jke=()=>{let e={string:{unit:`caracteres`,verb:`ter`},file:{unit:`bytes`,verb:`ter`},array:{unit:`itens`,verb:`ter`},set:{unit:`itens`,verb:`ter`}};function t(t){return e[t]??null}let n={regex:`padrão`,email:`endereço de e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`duração ISO`,ipv4:`endereço IPv4`,ipv6:`endereço IPv6`,cidrv4:`faixa de IPv4`,cidrv6:`faixa de IPv6`,base64:`texto codificado em base64`,base64url:`URL codificada em base64`,json_string:`texto JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,number:`número`,null:`nulo`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipo inválido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo inválido: esperado ${t}, recebido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: esperado ${i$(e.values[0])}`:`Opção inválida: esperada uma das ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Muito grande: esperado que ${e.origin??`valor`} tivesse ${n}${e.maximum.toString()} ${r.unit??`elementos`}`:`Muito grande: esperado que ${e.origin??`valor`} fosse ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Muito pequeno: esperado que ${e.origin} tivesse ${n}${e.minimum.toString()} ${r.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Texto inválido: deve começar com "${t.prefix}"`:t.format===`ends_with`?`Texto inválido: deve terminar com "${t.suffix}"`:t.format===`includes`?`Texto inválido: deve incluir "${t.includes}"`:t.format===`regex`?`Texto inválido: deve corresponder ao padrão ${t.pattern}`:`${n[t.format]??e.format} inválido`}case`not_multiple_of`:return`Número inválido: deve ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Chave${e.keys.length>1?`s`:``} desconhecida${e.keys.length>1?`s`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Chave inválida em ${e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido em ${e.origin}`;default:return`Campo inválido`}}};function Mke(){return{localeError:jke()}}function K2(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var Nke=()=>{let e={string:{unit:{one:`символ`,few:`символа`,many:`символов`},verb:`иметь`},file:{unit:{one:`байт`,few:`байта`,many:`байт`},verb:`иметь`},array:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`},set:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`}};function t(t){return e[t]??null}let n={regex:`ввод`,email:`email адрес`,url:`URL`,emoji:`эмодзи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата и время`,date:`ISO дата`,time:`ISO время`,duration:`ISO длительность`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`строка в формате base64`,base64url:`строка в формате base64url`,json_string:`JSON строка`,e164:`номер E.164`,jwt:`JWT`,template_literal:`ввод`},r={nan:`NaN`,number:`число`,array:`массив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неверный ввод: ожидалось instanceof ${e.expected}, получено ${i}`:`Неверный ввод: ожидалось ${t}, получено ${i}`}case`invalid_value`:return e.values.length===1?`Неверный ввод: ожидалось ${i$(e.values[0])}`:`Неверный вариант: ожидалось одно из ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=K2(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет иметь ${n}${e.maximum.toString()} ${t}`}return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=K2(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${n}${e.minimum.toString()} ${t}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неверная строка: должна начинаться с "${t.prefix}"`:t.format===`ends_with`?`Неверная строка: должна заканчиваться на "${t.suffix}"`:t.format===`includes`?`Неверная строка: должна содержать "${t.includes}"`:t.format===`regex`?`Неверная строка: должна соответствовать шаблону ${t.pattern}`:`Неверный ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неверное число: должно быть кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспознанн${e.keys.length>1?`ые`:`ый`} ключ${e.keys.length>1?`и`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Неверный ключ в ${e.origin}`;case`invalid_union`:return`Неверные входные данные`;case`invalid_element`:return`Неверное значение в ${e.origin}`;default:return`Неверные входные данные`}}};function Pke(){return{localeError:Nke()}}var Fke=()=>{let e={string:{unit:`znakov`,verb:`imeti`},file:{unit:`bajtov`,verb:`imeti`},array:{unit:`elementov`,verb:`imeti`},set:{unit:`elementov`,verb:`imeti`}};function t(t){return e[t]??null}let n={regex:`vnos`,email:`e-poštni naslov`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum in čas`,date:`ISO datum`,time:`ISO čas`,duration:`ISO trajanje`,ipv4:`IPv4 naslov`,ipv6:`IPv6 naslov`,cidrv4:`obseg IPv4`,cidrv6:`obseg IPv6`,base64:`base64 kodiran niz`,base64url:`base64url kodiran niz`,json_string:`JSON niz`,e164:`E.164 številka`,jwt:`JWT`,template_literal:`vnos`},r={nan:`NaN`,number:`število`,array:`tabela`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: pričakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: pričakovano ${t}, prejeto ${i}`}case`invalid_value`:return e.values.length===1?`Neveljaven vnos: pričakovano ${i$(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} imelo ${n}${e.maximum.toString()} ${r.unit??`elementov`}`:`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Premajhno: pričakovano, da bo ${e.origin} imelo ${n}${e.minimum.toString()} ${r.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neveljaven niz: mora se začeti z "${t.prefix}"`:t.format===`ends_with`?`Neveljaven niz: mora se končati z "${t.suffix}"`:t.format===`includes`?`Neveljaven niz: mora vsebovati "${t.includes}"`:t.format===`regex`?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznan${e.keys.length>1?`i ključi`:` ključ`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Neveljaven ključ v ${e.origin}`;case`invalid_union`:return`Neveljaven vnos`;case`invalid_element`:return`Neveljavna vrednost v ${e.origin}`;default:return`Neveljaven vnos`}}};function Ike(){return{localeError:Fke()}}var Lke=()=>{let e={string:{unit:`tecken`,verb:`att ha`},file:{unit:`bytes`,verb:`att ha`},array:{unit:`objekt`,verb:`att innehålla`},set:{unit:`objekt`,verb:`att innehålla`}};function t(t){return e[t]??null}let n={regex:`reguljärt uttryck`,email:`e-postadress`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datum och tid`,date:`ISO-datum`,time:`ISO-tid`,duration:`ISO-varaktighet`,ipv4:`IPv4-intervall`,ipv6:`IPv6-intervall`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodad sträng`,base64url:`base64url-kodad sträng`,json_string:`JSON-sträng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`mall-literal`},r={nan:`NaN`,number:`antal`,array:`lista`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: förväntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: förväntat ${t}, fick ${i}`}case`invalid_value`:return e.values.length===1?`Ogiltig inmatning: förväntat ${i$(e.values[0])}`:`Ogiltigt val: förväntade en av ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`För stor(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()} ${r.unit??`element`}`:`För stor(t): förväntat ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()} ${r.unit}`:`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ogiltig sträng: måste börja med "${t.prefix}"`:t.format===`ends_with`?`Ogiltig sträng: måste sluta med "${t.suffix}"`:t.format===`includes`?`Ogiltig sträng: måste innehålla "${t.includes}"`:t.format===`regex`?`Ogiltig sträng: måste matcha mönstret "${t.pattern}"`:`Ogiltig(t) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Okända nycklar`:`Okänd nyckel`}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Ogiltig nyckel i ${e.origin??`värdet`}`;case`invalid_union`:return`Ogiltig input`;case`invalid_element`:return`Ogiltigt värde i ${e.origin??`värdet`}`;default:return`Ogiltig input`}}};function Rke(){return{localeError:Lke()}}var zke=()=>{let e={string:{unit:`எழுத்துக்கள்`,verb:`கொண்டிருக்க வேண்டும்`},file:{unit:`பைட்டுகள்`,verb:`கொண்டிருக்க வேண்டும்`},array:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`},set:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`}};function t(t){return e[t]??null}let n={regex:`உள்ளீடு`,email:`மின்னஞ்சல் முகவரி`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO தேதி நேரம்`,date:`ISO தேதி`,time:`ISO நேரம்`,duration:`ISO கால அளவு`,ipv4:`IPv4 முகவரி`,ipv6:`IPv6 முகவரி`,cidrv4:`IPv4 வரம்பு`,cidrv6:`IPv6 வரம்பு`,base64:`base64-encoded சரம்`,base64url:`base64url-encoded சரம்`,json_string:`JSON சரம்`,e164:`E.164 எண்`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`எண்`,array:`அணி`,null:`வெறுமை`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${e.expected}, பெறப்பட்டது ${i}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t}, பெறப்பட்டது ${i}`}case`invalid_value`:return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${i$(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${IQ(e.values,`|`)} இல் ஒன்று`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ${r.unit??`உறுப்புகள்`} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`தவறான சரம்: "${t.prefix}" இல் தொடங்க வேண்டும்`:t.format===`ends_with`?`தவறான சரம்: "${t.suffix}" இல் முடிவடைய வேண்டும்`:t.format===`includes`?`தவறான சரம்: "${t.includes}" ஐ உள்ளடக்க வேண்டும்`:t.format===`regex`?`தவறான சரம்: ${t.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[t.format]??e.format}`}case`not_multiple_of`:return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case`unrecognized_keys`:return`அடையாளம் தெரியாத விசை${e.keys.length>1?`கள்`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} இல் தவறான விசை`;case`invalid_union`:return`தவறான உள்ளீடு`;case`invalid_element`:return`${e.origin} இல் தவறான மதிப்பு`;default:return`தவறான உள்ளீடு`}}};function Bke(){return{localeError:zke()}}var Vke=()=>{let e={string:{unit:`ตัวอักษร`,verb:`ควรมี`},file:{unit:`ไบต์`,verb:`ควรมี`},array:{unit:`รายการ`,verb:`ควรมี`},set:{unit:`รายการ`,verb:`ควรมี`}};function t(t){return e[t]??null}let n={regex:`ข้อมูลที่ป้อน`,email:`ที่อยู่อีเมล`,url:`URL`,emoji:`อิโมจิ`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`วันที่เวลาแบบ ISO`,date:`วันที่แบบ ISO`,time:`เวลาแบบ ISO`,duration:`ช่วงเวลาแบบ ISO`,ipv4:`ที่อยู่ IPv4`,ipv6:`ที่อยู่ IPv6`,cidrv4:`ช่วง IP แบบ IPv4`,cidrv6:`ช่วง IP แบบ IPv6`,base64:`ข้อความแบบ Base64`,base64url:`ข้อความแบบ Base64 สำหรับ URL`,json_string:`ข้อความแบบ JSON`,e164:`เบอร์โทรศัพท์ระหว่างประเทศ (E.164)`,jwt:`โทเคน JWT`,template_literal:`ข้อมูลที่ป้อน`},r={nan:`NaN`,number:`ตัวเลข`,array:`อาร์เรย์ (Array)`,null:`ไม่มีค่า (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${e.expected} แต่ได้รับ ${i}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t} แต่ได้รับ ${i}`}case`invalid_value`:return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${i$(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`ไม่เกิน`:`น้อยกว่า`,r=t(e.origin);return r?`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()} ${r.unit??`รายการ`}`:`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`อย่างน้อย`:`มากกว่า`,r=t(e.origin);return r?`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()} ${r.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${t.prefix}"`:t.format===`ends_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${t.suffix}"`:t.format===`includes`?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${t.includes}" อยู่ในข้อความ`:t.format===`regex`?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${t.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[t.format]??e.format}`}case`not_multiple_of`:return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case`unrecognized_keys`:return`พบคีย์ที่ไม่รู้จัก: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`คีย์ไม่ถูกต้องใน ${e.origin}`;case`invalid_union`:return`ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้`;case`invalid_element`:return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return`ข้อมูลไม่ถูกต้อง`}}};function Hke(){return{localeError:Vke()}}var Uke=()=>{let e={string:{unit:`karakter`,verb:`olmalı`},file:{unit:`bayt`,verb:`olmalı`},array:{unit:`öğe`,verb:`olmalı`},set:{unit:`öğe`,verb:`olmalı`}};function t(t){return e[t]??null}let n={regex:`girdi`,email:`e-posta adresi`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO tarih ve saat`,date:`ISO tarih`,time:`ISO saat`,duration:`ISO süre`,ipv4:`IPv4 adresi`,ipv6:`IPv6 adresi`,cidrv4:`IPv4 aralığı`,cidrv6:`IPv6 aralığı`,base64:`base64 ile şifrelenmiş metin`,base64url:`base64url ile şifrelenmiş metin`,json_string:`JSON dizesi`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`Şablon dizesi`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Geçersiz değer: beklenen instanceof ${e.expected}, alınan ${i}`:`Geçersiz değer: beklenen ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Geçersiz değer: beklenen ${i$(e.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()} ${r.unit??`öğe`}`:`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Geçersiz metin: "${t.prefix}" ile başlamalı`:t.format===`ends_with`?`Geçersiz metin: "${t.suffix}" ile bitmeli`:t.format===`includes`?`Geçersiz metin: "${t.includes}" içermeli`:t.format===`regex`?`Geçersiz metin: ${t.pattern} desenine uymalı`:`Geçersiz ${n[t.format]??e.format}`}case`not_multiple_of`:return`Geçersiz sayı: ${e.divisor} ile tam bölünebilmeli`;case`unrecognized_keys`:return`Tanınmayan anahtar${e.keys.length>1?`lar`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} içinde geçersiz anahtar`;case`invalid_union`:return`Geçersiz değer`;case`invalid_element`:return`${e.origin} içinde geçersiz değer`;default:return`Geçersiz değer`}}};function Wke(){return{localeError:Uke()}}var Gke=()=>{let e={string:{unit:`символів`,verb:`матиме`},file:{unit:`байтів`,verb:`матиме`},array:{unit:`елементів`,verb:`матиме`},set:{unit:`елементів`,verb:`матиме`}};function t(t){return e[t]??null}let n={regex:`вхідні дані`,email:`адреса електронної пошти`,url:`URL`,emoji:`емодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`дата та час ISO`,date:`дата ISO`,time:`час ISO`,duration:`тривалість ISO`,ipv4:`адреса IPv4`,ipv6:`адреса IPv6`,cidrv4:`діапазон IPv4`,cidrv6:`діапазон IPv6`,base64:`рядок у кодуванні base64`,base64url:`рядок у кодуванні base64url`,json_string:`рядок JSON`,e164:`номер E.164`,jwt:`JWT`,template_literal:`вхідні дані`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неправильні вхідні дані: очікується instanceof ${e.expected}, отримано ${i}`:`Неправильні вхідні дані: очікується ${t}, отримано ${i}`}case`invalid_value`:return e.values.length===1?`Неправильні вхідні дані: очікується ${i$(e.values[0])}`:`Неправильна опція: очікується одне з ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Занадто велике: очікується, що ${e.origin??`значення`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`елементів`}`:`Занадто велике: очікується, що ${e.origin??`значення`} буде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Занадто мале: очікується, що ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неправильний рядок: повинен починатися з "${t.prefix}"`:t.format===`ends_with`?`Неправильний рядок: повинен закінчуватися на "${t.suffix}"`:t.format===`includes`?`Неправильний рядок: повинен містити "${t.includes}"`:t.format===`regex`?`Неправильний рядок: повинен відповідати шаблону ${t.pattern}`:`Неправильний ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неправильне число: повинно бути кратним ${e.divisor}`;case`unrecognized_keys`:return`Нерозпізнаний ключ${e.keys.length>1?`і`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Неправильний ключ у ${e.origin}`;case`invalid_union`:return`Неправильні вхідні дані`;case`invalid_element`:return`Неправильне значення у ${e.origin}`;default:return`Неправильні вхідні дані`}}};function q2(){return{localeError:Gke()}}function Kke(){return q2()}var qke=()=>{let e={string:{unit:`حروف`,verb:`ہونا`},file:{unit:`بائٹس`,verb:`ہونا`},array:{unit:`آئٹمز`,verb:`ہونا`},set:{unit:`آئٹمز`,verb:`ہونا`}};function t(t){return e[t]??null}let n={regex:`ان پٹ`,email:`ای میل ایڈریس`,url:`یو آر ایل`,emoji:`ایموجی`,uuid:`یو یو آئی ڈی`,uuidv4:`یو یو آئی ڈی وی 4`,uuidv6:`یو یو آئی ڈی وی 6`,nanoid:`نینو آئی ڈی`,guid:`جی یو آئی ڈی`,cuid:`سی یو آئی ڈی`,cuid2:`سی یو آئی ڈی 2`,ulid:`یو ایل آئی ڈی`,xid:`ایکس آئی ڈی`,ksuid:`کے ایس یو آئی ڈی`,datetime:`آئی ایس او ڈیٹ ٹائم`,date:`آئی ایس او تاریخ`,time:`آئی ایس او وقت`,duration:`آئی ایس او مدت`,ipv4:`آئی پی وی 4 ایڈریس`,ipv6:`آئی پی وی 6 ایڈریس`,cidrv4:`آئی پی وی 4 رینج`,cidrv6:`آئی پی وی 6 رینج`,base64:`بیس 64 ان کوڈڈ سٹرنگ`,base64url:`بیس 64 یو آر ایل ان کوڈڈ سٹرنگ`,json_string:`جے ایس او این سٹرنگ`,e164:`ای 164 نمبر`,jwt:`جے ڈبلیو ٹی`,template_literal:`ان پٹ`},r={nan:`NaN`,number:`نمبر`,array:`آرے`,null:`نل`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`غلط ان پٹ: instanceof ${e.expected} متوقع تھا، ${i} موصول ہوا`:`غلط ان پٹ: ${t} متوقع تھا، ${i} موصول ہوا`}case`invalid_value`:return e.values.length===1?`غلط ان پٹ: ${i$(e.values[0])} متوقع تھا`:`غلط آپشن: ${IQ(e.values,`|`)} میں سے ایک متوقع تھا`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`بہت بڑا: ${e.origin??`ویلیو`} کے ${n}${e.maximum.toString()} ${r.unit??`عناصر`} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??`ویلیو`} کا ${n}${e.maximum.toString()} ہونا متوقع تھا`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`بہت چھوٹا: ${e.origin} کے ${n}${e.minimum.toString()} ${r.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${n}${e.minimum.toString()} ہونا متوقع تھا`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`غلط سٹرنگ: "${t.prefix}" سے شروع ہونا چاہیے`:t.format===`ends_with`?`غلط سٹرنگ: "${t.suffix}" پر ختم ہونا چاہیے`:t.format===`includes`?`غلط سٹرنگ: "${t.includes}" شامل ہونا چاہیے`:t.format===`regex`?`غلط سٹرنگ: پیٹرن ${t.pattern} سے میچ ہونا چاہیے`:`غلط ${n[t.format]??e.format}`}case`not_multiple_of`:return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case`unrecognized_keys`:return`غیر تسلیم شدہ کی${e.keys.length>1?`ز`:``}: ${IQ(e.keys,`، `)}`;case`invalid_key`:return`${e.origin} میں غلط کی`;case`invalid_union`:return`غلط ان پٹ`;case`invalid_element`:return`${e.origin} میں غلط ویلیو`;default:return`غلط ان پٹ`}}};function Jke(){return{localeError:qke()}}var Yke=()=>{let e={string:{unit:`belgi`,verb:`bo‘lishi kerak`},file:{unit:`bayt`,verb:`bo‘lishi kerak`},array:{unit:`element`,verb:`bo‘lishi kerak`},set:{unit:`element`,verb:`bo‘lishi kerak`}};function t(t){return e[t]??null}let n={regex:`kirish`,email:`elektron pochta manzili`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO sana va vaqti`,date:`ISO sana`,time:`ISO vaqt`,duration:`ISO davomiylik`,ipv4:`IPv4 manzil`,ipv6:`IPv6 manzil`,mac:`MAC manzil`,cidrv4:`IPv4 diapazon`,cidrv6:`IPv6 diapazon`,base64:`base64 kodlangan satr`,base64url:`base64url kodlangan satr`,json_string:`JSON satr`,e164:`E.164 raqam`,jwt:`JWT`,template_literal:`kirish`},r={nan:`NaN`,number:`raqam`,array:`massiv`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Noto‘g‘ri kirish: kutilgan ${t}, qabul qilingan ${i}`}case`invalid_value`:return e.values.length===1?`Noto‘g‘ri kirish: kutilgan ${i$(e.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()} ${r.unit} ${r.verb}`:`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Noto‘g‘ri satr: "${t.prefix}" bilan boshlanishi kerak`:t.format===`ends_with`?`Noto‘g‘ri satr: "${t.suffix}" bilan tugashi kerak`:t.format===`includes`?`Noto‘g‘ri satr: "${t.includes}" ni o‘z ichiga olishi kerak`:t.format===`regex`?`Noto‘g‘ri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${n[t.format]??e.format}`}case`not_multiple_of`:return`Noto‘g‘ri raqam: ${e.divisor} ning karralisi bo‘lishi kerak`;case`unrecognized_keys`:return`Noma’lum kalit${e.keys.length>1?`lar`:``}: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} dagi kalit noto‘g‘ri`;case`invalid_union`:return`Noto‘g‘ri kirish`;case`invalid_element`:return`${e.origin} da noto‘g‘ri qiymat`;default:return`Noto‘g‘ri kirish`}}};function Xke(){return{localeError:Yke()}}var Zke=()=>{let e={string:{unit:`ký tự`,verb:`có`},file:{unit:`byte`,verb:`có`},array:{unit:`phần tử`,verb:`có`},set:{unit:`phần tử`,verb:`có`}};function t(t){return e[t]??null}let n={regex:`đầu vào`,email:`địa chỉ email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ngày giờ ISO`,date:`ngày ISO`,time:`giờ ISO`,duration:`khoảng thời gian ISO`,ipv4:`địa chỉ IPv4`,ipv6:`địa chỉ IPv6`,cidrv4:`dải IPv4`,cidrv6:`dải IPv6`,base64:`chuỗi mã hóa base64`,base64url:`chuỗi mã hóa base64url`,json_string:`chuỗi JSON`,e164:`số E.164`,jwt:`JWT`,template_literal:`đầu vào`},r={nan:`NaN`,number:`số`,array:`mảng`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${e.expected}, nhận được ${i}`:`Đầu vào không hợp lệ: mong đợi ${t}, nhận được ${i}`}case`invalid_value`:return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${i$(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Quá lớn: mong đợi ${e.origin??`giá trị`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`phần tử`}`:`Quá lớn: mong đợi ${e.origin??`giá trị`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Quá nhỏ: mong đợi ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chuỗi không hợp lệ: phải bắt đầu bằng "${t.prefix}"`:t.format===`ends_with`?`Chuỗi không hợp lệ: phải kết thúc bằng "${t.suffix}"`:t.format===`includes`?`Chuỗi không hợp lệ: phải bao gồm "${t.includes}"`:t.format===`regex`?`Chuỗi không hợp lệ: phải khớp với mẫu ${t.pattern}`:`${n[t.format]??e.format} không hợp lệ`}case`not_multiple_of`:return`Số không hợp lệ: phải là bội số của ${e.divisor}`;case`unrecognized_keys`:return`Khóa không được nhận dạng: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Khóa không hợp lệ trong ${e.origin}`;case`invalid_union`:return`Đầu vào không hợp lệ`;case`invalid_element`:return`Giá trị không hợp lệ trong ${e.origin}`;default:return`Đầu vào không hợp lệ`}}};function Qke(){return{localeError:Zke()}}var $ke=()=>{let e={string:{unit:`字符`,verb:`包含`},file:{unit:`字节`,verb:`包含`},array:{unit:`项`,verb:`包含`},set:{unit:`项`,verb:`包含`}};function t(t){return e[t]??null}let n={regex:`输入`,email:`电子邮件`,url:`URL`,emoji:`表情符号`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日期时间`,date:`ISO日期`,time:`ISO时间`,duration:`ISO时长`,ipv4:`IPv4地址`,ipv6:`IPv6地址`,cidrv4:`IPv4网段`,cidrv6:`IPv6网段`,base64:`base64编码字符串`,base64url:`base64url编码字符串`,json_string:`JSON字符串`,e164:`E.164号码`,jwt:`JWT`,template_literal:`输入`},r={nan:`NaN`,number:`数字`,array:`数组`,null:`空值(null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`无效输入:期望 instanceof ${e.expected},实际接收 ${i}`:`无效输入:期望 ${t},实际接收 ${i}`}case`invalid_value`:return e.values.length===1?`无效输入:期望 ${i$(e.values[0])}`:`无效选项:期望以下之一 ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()} ${r.unit??`个元素`}`:`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`无效字符串:必须以 "${t.prefix}" 开头`:t.format===`ends_with`?`无效字符串:必须以 "${t.suffix}" 结尾`:t.format===`includes`?`无效字符串:必须包含 "${t.includes}"`:t.format===`regex`?`无效字符串:必须满足正则表达式 ${t.pattern}`:`无效${n[t.format]??e.format}`}case`not_multiple_of`:return`无效数字:必须是 ${e.divisor} 的倍数`;case`unrecognized_keys`:return`出现未知的键(key): ${IQ(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} 中的键(key)无效`;case`invalid_union`:return`无效输入`;case`invalid_element`:return`${e.origin} 中包含无效值(value)`;default:return`无效输入`}}};function eAe(){return{localeError:$ke()}}var tAe=()=>{let e={string:{unit:`字元`,verb:`擁有`},file:{unit:`位元組`,verb:`擁有`},array:{unit:`項目`,verb:`擁有`},set:{unit:`項目`,verb:`擁有`}};function t(t){return e[t]??null}let n={regex:`輸入`,email:`郵件地址`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 日期時間`,date:`ISO 日期`,time:`ISO 時間`,duration:`ISO 期間`,ipv4:`IPv4 位址`,ipv6:`IPv6 位址`,cidrv4:`IPv4 範圍`,cidrv6:`IPv6 範圍`,base64:`base64 編碼字串`,base64url:`base64url 編碼字串`,json_string:`JSON 字串`,e164:`E.164 數值`,jwt:`JWT`,template_literal:`輸入`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無效的輸入值:預期為 instanceof ${e.expected},但收到 ${i}`:`無效的輸入值:預期為 ${t},但收到 ${i}`}case`invalid_value`:return e.values.length===1?`無效的輸入值:預期為 ${i$(e.values[0])}`:`無效的選項:預期為以下其中之一 ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()} ${r.unit??`個元素`}`:`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()} ${r.unit}`:`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無效的字串:必須以 "${t.prefix}" 開頭`:t.format===`ends_with`?`無效的字串:必須以 "${t.suffix}" 結尾`:t.format===`includes`?`無效的字串:必須包含 "${t.includes}"`:t.format===`regex`?`無效的字串:必須符合格式 ${t.pattern}`:`無效的 ${n[t.format]??e.format}`}case`not_multiple_of`:return`無效的數字:必須為 ${e.divisor} 的倍數`;case`unrecognized_keys`:return`無法識別的鍵值${e.keys.length>1?`們`:``}:${IQ(e.keys,`、`)}`;case`invalid_key`:return`${e.origin} 中有無效的鍵值`;case`invalid_union`:return`無效的輸入值`;case`invalid_element`:return`${e.origin} 中有無效的值`;default:return`無效的輸入值`}}};function nAe(){return{localeError:tAe()}}var rAe=()=>{let e={string:{unit:`àmi`,verb:`ní`},file:{unit:`bytes`,verb:`ní`},array:{unit:`nkan`,verb:`ní`},set:{unit:`nkan`,verb:`ní`}};function t(t){return e[t]??null}let n={regex:`ẹ̀rọ ìbáwọlé`,email:`àdírẹ́sì ìmẹ́lì`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`àkókò ISO`,date:`ọjọ́ ISO`,time:`àkókò ISO`,duration:`àkókò tó pé ISO`,ipv4:`àdírẹ́sì IPv4`,ipv6:`àdírẹ́sì IPv6`,cidrv4:`àgbègbè IPv4`,cidrv6:`àgbègbè IPv6`,base64:`ọ̀rọ̀ tí a kọ́ ní base64`,base64url:`ọ̀rọ̀ base64url`,json_string:`ọ̀rọ̀ JSON`,e164:`nọ́mbà E.164`,jwt:`JWT`,template_literal:`ẹ̀rọ ìbáwọlé`},r={nan:`NaN`,number:`nọ́mbà`,array:`akopọ`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=m$(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${e.expected}, àmọ̀ a rí ${i}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${t}, àmọ̀ a rí ${i}`}case`invalid_value`:return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${i$(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${IQ(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??`iye`} ${r.verb} ${n}${e.maximum} ${r.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${e.maximum}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${r.verb} ${n}${e.minimum} ${r.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${e.minimum}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${t.prefix}"`:t.format===`ends_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${t.suffix}"`:t.format===`includes`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${t.includes}"`:t.format===`regex`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${t.pattern}`:`Aṣìṣe: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case`unrecognized_keys`:return`Bọtìnì àìmọ̀: ${IQ(e.keys,`, `)}`;case`invalid_key`:return`Bọtìnì aṣìṣe nínú ${e.origin}`;case`invalid_union`:return`Ìbáwọlé aṣìṣe`;case`invalid_element`:return`Iye aṣìṣe nínú ${e.origin}`;default:return`Ìbáwọlé aṣìṣe`}}};function iAe(){return{localeError:rAe()}}var J2,Y2=Symbol(`ZodOutput`),X2=Symbol(`ZodInput`),Z2=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Q2(){return new Z2}(J2=globalThis).__zod_globalRegistry??(J2.__zod_globalRegistry=Q2());var $2=globalThis.__zod_globalRegistry;function e4(e,t){return new e({type:`string`,...r$(t)})}function t4(e,t){return new e({type:`string`,coerce:!0,...r$(t)})}function n4(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...r$(t)})}function r4(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...r$(t)})}function i4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...r$(t)})}function a4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...r$(t)})}function o4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...r$(t)})}function s4(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...r$(t)})}function c4(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...r$(t)})}function l4(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...r$(t)})}function u4(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...r$(t)})}function d4(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...r$(t)})}function f4(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...r$(t)})}function p4(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...r$(t)})}function m4(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...r$(t)})}function h4(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...r$(t)})}function g4(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...r$(t)})}function _4(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...r$(t)})}function v4(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...r$(t)})}function y4(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...r$(t)})}function b4(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...r$(t)})}function x4(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...r$(t)})}function S4(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...r$(t)})}function C4(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...r$(t)})}function w4(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...r$(t)})}var T4={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function E4(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...r$(t)})}function D4(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...r$(t)})}function O4(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...r$(t)})}function k4(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...r$(t)})}function A4(e,t){return new e({type:`number`,checks:[],...r$(t)})}function j4(e,t){return new e({type:`number`,coerce:!0,checks:[],...r$(t)})}function M4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...r$(t)})}function N4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...r$(t)})}function P4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...r$(t)})}function F4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...r$(t)})}function I4(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...r$(t)})}function L4(e,t){return new e({type:`boolean`,...r$(t)})}function R4(e,t){return new e({type:`boolean`,coerce:!0,...r$(t)})}function z4(e,t){return new e({type:`bigint`,...r$(t)})}function B4(e,t){return new e({type:`bigint`,coerce:!0,...r$(t)})}function V4(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...r$(t)})}function H4(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...r$(t)})}function U4(e,t){return new e({type:`symbol`,...r$(t)})}function W4(e,t){return new e({type:`undefined`,...r$(t)})}function G4(e,t){return new e({type:`null`,...r$(t)})}function K4(e){return new e({type:`any`})}function q4(e){return new e({type:`unknown`})}function J4(e,t){return new e({type:`never`,...r$(t)})}function Y4(e,t){return new e({type:`void`,...r$(t)})}function X4(e,t){return new e({type:`date`,...r$(t)})}function Z4(e,t){return new e({type:`date`,coerce:!0,...r$(t)})}function Q4(e,t){return new e({type:`nan`,...r$(t)})}function $4(e,t){return new D1({check:`less_than`,...r$(t),value:e,inclusive:!1})}function e3(e,t){return new D1({check:`less_than`,...r$(t),value:e,inclusive:!0})}function t3(e,t){return new O1({check:`greater_than`,...r$(t),value:e,inclusive:!1})}function n3(e,t){return new O1({check:`greater_than`,...r$(t),value:e,inclusive:!0})}function r3(e){return t3(0,e)}function i3(e){return $4(0,e)}function a3(e){return e3(0,e)}function o3(e){return n3(0,e)}function s3(e,t){return new k1({check:`multiple_of`,...r$(t),value:e})}function c3(e,t){return new M1({check:`max_size`,...r$(t),maximum:e})}function l3(e,t){return new N1({check:`min_size`,...r$(t),minimum:e})}function u3(e,t){return new P1({check:`size_equals`,...r$(t),size:e})}function d3(e,t){return new F1({check:`max_length`,...r$(t),maximum:e})}function f3(e,t){return new I1({check:`min_length`,...r$(t),minimum:e})}function p3(e,t){return new L1({check:`length_equals`,...r$(t),length:e})}function m3(e,t){return new z1({check:`string_format`,format:`regex`,...r$(t),pattern:e})}function h3(e){return new B1({check:`string_format`,format:`lowercase`,...r$(e)})}function g3(e){return new V1({check:`string_format`,format:`uppercase`,...r$(e)})}function _3(e,t){return new H1({check:`string_format`,format:`includes`,...r$(t),includes:e})}function v3(e,t){return new U1({check:`string_format`,format:`starts_with`,...r$(t),prefix:e})}function y3(e,t){return new W1({check:`string_format`,format:`ends_with`,...r$(t),suffix:e})}function b3(e,t,n){return new K1({check:`property`,property:e,schema:t,...r$(n)})}function x3(e,t){return new q1({check:`mime_type`,mime:e,...r$(t)})}function S3(e){return new J1({check:`overwrite`,tx:e})}function C3(e){return S3(t=>t.normalize(e))}function w3(){return S3(e=>e.trim())}function T3(){return S3(e=>e.toLowerCase())}function E3(){return S3(e=>e.toUpperCase())}function D3(){return S3(e=>qQ(e))}function O3(e,t,n){return new e({type:`array`,element:t,...r$(n)})}function aAe(e,t,n){return new e({type:`union`,options:t,...r$(n)})}function oAe(e,t,n){return new e({type:`union`,options:t,inclusive:!1,...r$(n)})}function sAe(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,...r$(r)})}function cAe(e,t,n){return new e({type:`intersection`,left:t,right:n})}function lAe(e,t,n,r){let i=n instanceof Z1;return new e({type:`tuple`,items:t,rest:i?n:null,...r$(i?r:n)})}function uAe(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,...r$(r)})}function dAe(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,...r$(r)})}function fAe(e,t,n){return new e({type:`set`,valueType:t,...r$(n)})}function pAe(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...r$(n)})}function mAe(e,t,n){return new e({type:`enum`,entries:t,...r$(n)})}function hAe(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],...r$(n)})}function k3(e,t){return new e({type:`file`,...r$(t)})}function gAe(e,t){return new e({type:`transform`,transform:t})}function _Ae(e,t){return new e({type:`optional`,innerType:t})}function vAe(e,t){return new e({type:`nullable`,innerType:t})}function yAe(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():QQ(n)}})}function bAe(e,t,n){return new e({type:`nonoptional`,innerType:t,...r$(n)})}function xAe(e,t){return new e({type:`success`,innerType:t})}function SAe(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function CAe(e,t,n){return new e({type:`pipe`,in:t,out:n})}function wAe(e,t){return new e({type:`readonly`,innerType:t})}function TAe(e,t,n){return new e({type:`template_literal`,parts:t,...r$(n)})}function EAe(e,t){return new e({type:`lazy`,getter:t})}function DAe(e,t){return new e({type:`promise`,innerType:t})}function A3(e,t,n){let r=r$(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function j3(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...r$(n)})}function M3(e){let t=N3(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(h$(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(h$(r))}},e(n.value,n)));return t}function N3(e,t){let n=new T1({check:`custom`,...r$(t)});return n._zod.check=e,n}function P3(e){let t=new T1({check:`describe`});return t._zod.onattach=[t=>{let n=$2.get(t)??{};$2.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function F3(e){let t=new T1({check:`meta`});return t._zod.onattach=[t=>{let n=$2.get(t)??{};$2.add(t,{...n,...e})}],t._zod.check=()=>{},t}function I3(e,t){let n=r$(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??D2,c=e.Boolean??A0,l=new s({type:`pipe`,in:new(e.String??Q1)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:(e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})},reverseTransform:(e,t)=>e===!0?r[0]||`true`:i[0]||`false`,error:n.error});return l}function L3(e,t,n,r={}){let i=r$(r),a={...r$(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function R3(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??$2,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function z3(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,z3(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&H3(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function B3(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
615
615
|
|
|
616
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function B3(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:U3(t,`input`,e.processors),output:U3(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function V3(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return V3(r.element,n);if(r.type===`set`)return V3(r.valueType,n);if(r.type===`lazy`)return V3(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return V3(r.innerType,n);if(r.type===`intersection`)return V3(r.left,n)||V3(r.right,n);if(r.type===`record`||r.type===`map`)return V3(r.keyType,n)||V3(r.valueType,n);if(r.type===`pipe`)return V3(r.in,n)||V3(r.out,n);if(r.type===`object`){for(let e in r.shape)if(V3(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(V3(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(V3(e,n))return!0;return!!(r.rest&&V3(r.rest,n))}return!1}var H3=(e,t={})=>n=>{let r=L3({...n,processors:t});return R3(e,r),z3(r,e),B3(r,e)},U3=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=L3({...i??{},target:a,io:t,processors:n});return R3(e,o),z3(o,e),B3(o,e)},kAe={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},W3=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=kAe[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},G3=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},K3=(e,t,n,r)=>{n.type=`boolean`},q3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},J3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Y3=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},X3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Z3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Q3=(e,t,n,r)=>{n.not={}},AAe=(e,t,n,r)=>{},jAe=(e,t,n,r)=>{},$3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},e6=(e,t,n,r)=>{let i=e._zod.def,a=PQ(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},t6=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},n6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},r6=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},i6=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},a6=(e,t,n,r)=>{n.type=`boolean`},o6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},s6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},c6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},l6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},u6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},d6=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=R3(a.element,t,{...r,path:[...r.path,`items`]})},f6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=R3(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=R3(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},p6=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>R3(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},m6=(e,t,n,r)=>{let i=e._zod.def,a=R3(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=R3(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},h6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>R3(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?R3(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,!l&&(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},g6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=R3(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=R3(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=R3(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},_6=(e,t,n,r)=>{let i=e._zod.def,a=R3(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},v6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},y6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},b6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},x6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},S6=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;R3(a,t,r);let o=t.seen.get(e);o.ref=a},C6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},w6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},T6=(e,t,n,r)=>{let i=e._zod.def;R3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},E6=(e,t,n,r)=>{let i=e._zod.innerType;R3(i,t,r);let a=t.seen.get(e);a.ref=i},D6={string:W3,number:G3,boolean:K3,bigint:q3,symbol:J3,null:Y3,undefined:X3,void:Z3,never:Q3,any:AAe,unknown:jAe,date:$3,enum:e6,literal:t6,nan:n6,template_literal:r6,file:i6,success:a6,custom:o6,function:s6,transform:c6,map:l6,set:u6,array:d6,object:f6,union:p6,intersection:m6,tuple:h6,record:g6,nullable:_6,nonoptional:v6,default:y6,prefault:b6,catch:x6,pipe:S6,readonly:C6,promise:w6,optional:T6,lazy:E6};function O6(e,t){if(`_idmap`in e){let n=e,r=L3({...t,processors:D6}),i={};for(let e of n._idmap.entries()){let[t,n]=e;R3(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;z3(r,n),a[t]=B3(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=L3({...t,processors:D6});return R3(e,n),z3(n,e),B3(n,e)}var MAe=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??`draft-2020-12`;t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),this.ctx=L3({processors:D6,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return R3(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),z3(this.ctx,e);let{"~standard":n,...r}=B3(this.ctx,e);return r}},NAe={},k6={};wQ(k6,{xor:()=>HAe,xid:()=>O8,void:()=>IAe,uuidv7:()=>p8,uuidv6:()=>f8,uuidv4:()=>d8,uuid:()=>u8,url:()=>h8,unknown:()=>C5,union:()=>M5,undefined:()=>v5,ulid:()=>E8,uint64:()=>m5,uint32:()=>s5,tuple:()=>R5,transform:()=>J5,templateLiteral:()=>tje,symbol:()=>g5,superRefine:()=>w7,success:()=>QAe,stringbool:()=>cje,stringFormat:()=>X8,string:()=>r8,strictObject:()=>BAe,set:()=>qAe,refine:()=>C7,record:()=>B5,readonly:()=>h7,promise:()=>nje,preprocess:()=>uje,prefault:()=>i7,pipe:()=>f7,partialRecord:()=>WAe,optional:()=>X5,object:()=>zAe,number:()=>t5,nullish:()=>ZAe,nullable:()=>e7,null:()=>b5,nonoptional:()=>o7,never:()=>T5,nativeEnum:()=>JAe,nanoid:()=>b8,nan:()=>$Ae,meta:()=>oje,map:()=>KAe,mac:()=>P8,looseRecord:()=>GAe,looseObject:()=>VAe,literal:()=>YAe,lazy:()=>v7,ksuid:()=>A8,keyof:()=>RAe,jwt:()=>J8,json:()=>lje,ipv6:()=>I8,ipv4:()=>M8,intersection:()=>I5,int64:()=>p5,int32:()=>o5,int:()=>r5,instanceof:()=>sje,httpUrl:()=>g8,hostname:()=>Z8,hex:()=>Q8,hash:()=>$8,guid:()=>c8,function:()=>x7,float64:()=>a5,float32:()=>i5,file:()=>XAe,exactOptional:()=>Q5,enum:()=>W5,emoji:()=>v8,email:()=>o8,e164:()=>K8,discriminatedUnion:()=>UAe,describe:()=>aje,date:()=>LAe,custom:()=>ije,cuid2:()=>w8,cuid:()=>S8,codec:()=>eje,cidrv6:()=>B8,cidrv4:()=>R8,check:()=>rje,catch:()=>l7,boolean:()=>l5,bigint:()=>d5,base64url:()=>W8,base64:()=>H8,array:()=>k5,any:()=>FAe,_function:()=>x7,_default:()=>n7,_ZodString:()=>t8,ZodXor:()=>N5,ZodXID:()=>D8,ZodVoid:()=>E5,ZodUnknown:()=>S5,ZodUnion:()=>j5,ZodUndefined:()=>_5,ZodUUID:()=>l8,ZodURL:()=>m8,ZodULID:()=>T8,ZodType:()=>e8,ZodTuple:()=>L5,ZodTransform:()=>q5,ZodTemplateLiteral:()=>g7,ZodSymbol:()=>h5,ZodSuccess:()=>s7,ZodStringFormat:()=>i8,ZodString:()=>n8,ZodSet:()=>H5,ZodRecord:()=>z5,ZodReadonly:()=>m7,ZodPromise:()=>y7,ZodPrefault:()=>r7,ZodPipe:()=>d7,ZodOptional:()=>Y5,ZodObject:()=>A5,ZodNumberFormat:()=>n5,ZodNumber:()=>e5,ZodNullable:()=>$5,ZodNull:()=>y5,ZodNonOptional:()=>a7,ZodNever:()=>w5,ZodNanoID:()=>y8,ZodNaN:()=>u7,ZodMap:()=>V5,ZodMAC:()=>N8,ZodLiteral:()=>G5,ZodLazy:()=>_7,ZodKSUID:()=>k8,ZodJWT:()=>q8,ZodIntersection:()=>F5,ZodIPv6:()=>F8,ZodIPv4:()=>j8,ZodGUID:()=>s8,ZodFunction:()=>b7,ZodFile:()=>K5,ZodExactOptional:()=>Z5,ZodEnum:()=>U5,ZodEmoji:()=>_8,ZodEmail:()=>a8,ZodE164:()=>G8,ZodDiscriminatedUnion:()=>P5,ZodDefault:()=>t7,ZodDate:()=>D5,ZodCustomStringFormat:()=>Y8,ZodCustom:()=>S7,ZodCodec:()=>p7,ZodCatch:()=>c7,ZodCUID2:()=>C8,ZodCUID:()=>x8,ZodCIDRv6:()=>z8,ZodCIDRv4:()=>L8,ZodBoolean:()=>c5,ZodBigIntFormat:()=>f5,ZodBigInt:()=>u5,ZodBase64URL:()=>U8,ZodBase64:()=>V8,ZodArray:()=>O5,ZodAny:()=>x5});var A6={};wQ(A6,{uppercase:()=>h3,trim:()=>C3,toUpperCase:()=>T3,toLowerCase:()=>w3,startsWith:()=>_3,slugify:()=>E3,size:()=>l3,regex:()=>p3,property:()=>y3,positive:()=>n3,overwrite:()=>x3,normalize:()=>S3,nonpositive:()=>i3,nonnegative:()=>a3,negative:()=>r3,multipleOf:()=>o3,minSize:()=>c3,minLength:()=>d3,mime:()=>b3,maxSize:()=>s3,maxLength:()=>u3,lte:()=>$4,lt:()=>Q4,lowercase:()=>m3,length:()=>f3,includes:()=>g3,gte:()=>t3,gt:()=>e3,endsWith:()=>v3});var j6={};wQ(j6,{time:()=>L6,duration:()=>z6,datetime:()=>N6,date:()=>F6,ZodISOTime:()=>I6,ZodISODuration:()=>R6,ZodISODateTime:()=>M6,ZodISODate:()=>P6});var M6=$(`ZodISODateTime`,(e,t)=>{u0.init(e,t),i8.init(e,t)});function N6(e){return T4(M6,e)}var P6=$(`ZodISODate`,(e,t)=>{d0.init(e,t),i8.init(e,t)});function F6(e){return E4(P6,e)}var I6=$(`ZodISOTime`,(e,t)=>{f0.init(e,t),i8.init(e,t)});function L6(e){return D4(I6,e)}var R6=$(`ZodISODuration`,(e,t)=>{p0.init(e,t),i8.init(e,t)});function z6(e){return O4(R6,e)}var B6=(e,t)=>{v$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>x$(e,t)},flatten:{value:t=>b$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,IQ,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,IQ,2)}},isEmpty:{get(){return e.issues.length===0}}})},PAe=$(`ZodError`,B6),V6=$(`ZodError`,B6,{Parent:Error}),H6=T$(V6),U6=D$(V6),W6=k$(V6),G6=j$(V6),K6=N$(V6),q6=P$(V6),J6=F$(V6),Y6=I$(V6),X6=L$(V6),Z6=R$(V6),Q6=z$(V6),$6=B$(V6),e8=$(`ZodType`,(e,t)=>(X1.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:U3(e,`input`),output:U3(e,`output`)}}),e.toJSONSchema=H3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(NQ.mergeDefs(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>t$(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>H6(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>W6(e,t,n),e.parseAsync=async(t,n)=>U6(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>G6(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>K6(e,t,n),e.decode=(t,n)=>q6(e,t,n),e.encodeAsync=async(t,n)=>J6(e,t,n),e.decodeAsync=async(t,n)=>Y6(e,t,n),e.safeEncode=(t,n)=>X6(e,t,n),e.safeDecode=(t,n)=>Z6(e,t,n),e.safeEncodeAsync=async(t,n)=>Q6(e,t,n),e.safeDecodeAsync=async(t,n)=>$6(e,t,n),e.refine=(t,n)=>e.check(C7(t,n)),e.superRefine=t=>e.check(w7(t)),e.overwrite=t=>e.check(x3(t)),e.optional=()=>X5(e),e.exactOptional=()=>Q5(e),e.nullable=()=>e7(e),e.nullish=()=>X5(e7(e)),e.nonoptional=t=>o7(e,t),e.array=()=>k5(e),e.or=t=>M5([e,t]),e.and=t=>I5(e,t),e.transform=t=>f7(e,J5(t)),e.default=t=>n7(e,t),e.prefault=t=>i7(e,t),e.catch=t=>l7(e,t),e.pipe=t=>f7(e,t),e.readonly=()=>h7(e),e.describe=t=>{let n=e.clone();return Q2.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Q2.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Q2.get(e);let n=e.clone();return Q2.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),t8=$(`_ZodString`,(e,t)=>{Z1.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>W3(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(p3(...t)),e.includes=(...t)=>e.check(g3(...t)),e.startsWith=(...t)=>e.check(_3(...t)),e.endsWith=(...t)=>e.check(v3(...t)),e.min=(...t)=>e.check(d3(...t)),e.max=(...t)=>e.check(u3(...t)),e.length=(...t)=>e.check(f3(...t)),e.nonempty=(...t)=>e.check(d3(1,...t)),e.lowercase=t=>e.check(m3(t)),e.uppercase=t=>e.check(h3(t)),e.trim=()=>e.check(C3()),e.normalize=(...t)=>e.check(S3(...t)),e.toLowerCase=()=>e.check(w3()),e.toUpperCase=()=>e.check(T3()),e.slugify=()=>e.check(E3())}),n8=$(`ZodString`,(e,t)=>{Z1.init(e,t),t8.init(e,t),e.email=t=>e.check(t4(a8,t)),e.url=t=>e.check(s4(m8,t)),e.jwt=t=>e.check(C4(q8,t)),e.emoji=t=>e.check(c4(_8,t)),e.guid=t=>e.check(n4(s8,t)),e.uuid=t=>e.check(r4(l8,t)),e.uuidv4=t=>e.check(i4(l8,t)),e.uuidv6=t=>e.check(a4(l8,t)),e.uuidv7=t=>e.check(o4(l8,t)),e.nanoid=t=>e.check(l4(y8,t)),e.guid=t=>e.check(n4(s8,t)),e.cuid=t=>e.check(u4(x8,t)),e.cuid2=t=>e.check(d4(C8,t)),e.ulid=t=>e.check(f4(T8,t)),e.base64=t=>e.check(b4(V8,t)),e.base64url=t=>e.check(x4(U8,t)),e.xid=t=>e.check(p4(D8,t)),e.ksuid=t=>e.check(m4(k8,t)),e.ipv4=t=>e.check(h4(j8,t)),e.ipv6=t=>e.check(g4(F8,t)),e.cidrv4=t=>e.check(v4(L8,t)),e.cidrv6=t=>e.check(y4(z8,t)),e.e164=t=>e.check(S4(G8,t)),e.datetime=t=>e.check(N6(t)),e.date=t=>e.check(F6(t)),e.time=t=>e.check(L6(t)),e.duration=t=>e.check(z6(t))});function r8(e){return $2(n8,e)}var i8=$(`ZodStringFormat`,(e,t)=>{Q1.init(e,t),t8.init(e,t)}),a8=$(`ZodEmail`,(e,t)=>{t0.init(e,t),i8.init(e,t)});function o8(e){return t4(a8,e)}var s8=$(`ZodGUID`,(e,t)=>{$1.init(e,t),i8.init(e,t)});function c8(e){return n4(s8,e)}var l8=$(`ZodUUID`,(e,t)=>{e0.init(e,t),i8.init(e,t)});function u8(e){return r4(l8,e)}function d8(e){return i4(l8,e)}function f8(e){return a4(l8,e)}function p8(e){return o4(l8,e)}var m8=$(`ZodURL`,(e,t)=>{n0.init(e,t),i8.init(e,t)});function h8(e){return s4(m8,e)}function g8(e){return s4(m8,{protocol:/^https?$/,hostname:V$.domain,...NQ.normalizeParams(e)})}var _8=$(`ZodEmoji`,(e,t)=>{r0.init(e,t),i8.init(e,t)});function v8(e){return c4(_8,e)}var y8=$(`ZodNanoID`,(e,t)=>{i0.init(e,t),i8.init(e,t)});function b8(e){return l4(y8,e)}var x8=$(`ZodCUID`,(e,t)=>{a0.init(e,t),i8.init(e,t)});function S8(e){return u4(x8,e)}var C8=$(`ZodCUID2`,(e,t)=>{o0.init(e,t),i8.init(e,t)});function w8(e){return d4(C8,e)}var T8=$(`ZodULID`,(e,t)=>{s0.init(e,t),i8.init(e,t)});function E8(e){return f4(T8,e)}var D8=$(`ZodXID`,(e,t)=>{c0.init(e,t),i8.init(e,t)});function O8(e){return p4(D8,e)}var k8=$(`ZodKSUID`,(e,t)=>{l0.init(e,t),i8.init(e,t)});function A8(e){return m4(k8,e)}var j8=$(`ZodIPv4`,(e,t)=>{m0.init(e,t),i8.init(e,t)});function M8(e){return h4(j8,e)}var N8=$(`ZodMAC`,(e,t)=>{g0.init(e,t),i8.init(e,t)});function P8(e){return _4(N8,e)}var F8=$(`ZodIPv6`,(e,t)=>{h0.init(e,t),i8.init(e,t)});function I8(e){return g4(F8,e)}var L8=$(`ZodCIDRv4`,(e,t)=>{_0.init(e,t),i8.init(e,t)});function R8(e){return v4(L8,e)}var z8=$(`ZodCIDRv6`,(e,t)=>{v0.init(e,t),i8.init(e,t)});function B8(e){return y4(z8,e)}var V8=$(`ZodBase64`,(e,t)=>{b0.init(e,t),i8.init(e,t)});function H8(e){return b4(V8,e)}var U8=$(`ZodBase64URL`,(e,t)=>{S0.init(e,t),i8.init(e,t)});function W8(e){return x4(U8,e)}var G8=$(`ZodE164`,(e,t)=>{C0.init(e,t),i8.init(e,t)});function K8(e){return S4(G8,e)}var q8=$(`ZodJWT`,(e,t)=>{T0.init(e,t),i8.init(e,t)});function J8(e){return C4(q8,e)}var Y8=$(`ZodCustomStringFormat`,(e,t)=>{E0.init(e,t),i8.init(e,t)});function X8(e,t,n={}){return I3(Y8,e,t,n)}function Z8(e){return I3(Y8,`hostname`,V$.hostname,e)}function Q8(e){return I3(Y8,`hex`,V$.hex,e)}function $8(e,t){let n=`${e}_${t?.enc??`hex`}`,r=V$[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return I3(Y8,n,r,t)}var e5=$(`ZodNumber`,(e,t)=>{D0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G3(e,t,n,r),e.gt=(t,n)=>e.check(e3(t,n)),e.gte=(t,n)=>e.check(t3(t,n)),e.min=(t,n)=>e.check(t3(t,n)),e.lt=(t,n)=>e.check(Q4(t,n)),e.lte=(t,n)=>e.check($4(t,n)),e.max=(t,n)=>e.check($4(t,n)),e.int=t=>e.check(r5(t)),e.safe=t=>e.check(r5(t)),e.positive=t=>e.check(e3(0,t)),e.nonnegative=t=>e.check(t3(0,t)),e.negative=t=>e.check(Q4(0,t)),e.nonpositive=t=>e.check($4(0,t)),e.multipleOf=(t,n)=>e.check(o3(t,n)),e.step=(t,n)=>e.check(o3(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function t5(e){return k4(e5,e)}var n5=$(`ZodNumberFormat`,(e,t)=>{O0.init(e,t),e5.init(e,t)});function r5(e){return j4(n5,e)}function i5(e){return M4(n5,e)}function a5(e){return N4(n5,e)}function o5(e){return P4(n5,e)}function s5(e){return F4(n5,e)}var c5=$(`ZodBoolean`,(e,t)=>{k0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K3(e,t,n,r)});function l5(e){return I4(c5,e)}var u5=$(`ZodBigInt`,(e,t)=>{A0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q3(e,t,n,r),e.gte=(t,n)=>e.check(t3(t,n)),e.min=(t,n)=>e.check(t3(t,n)),e.gt=(t,n)=>e.check(e3(t,n)),e.gte=(t,n)=>e.check(t3(t,n)),e.min=(t,n)=>e.check(t3(t,n)),e.lt=(t,n)=>e.check(Q4(t,n)),e.lte=(t,n)=>e.check($4(t,n)),e.max=(t,n)=>e.check($4(t,n)),e.positive=t=>e.check(e3(BigInt(0),t)),e.negative=t=>e.check(Q4(BigInt(0),t)),e.nonpositive=t=>e.check($4(BigInt(0),t)),e.nonnegative=t=>e.check(t3(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(o3(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function d5(e){return R4(u5,e)}var f5=$(`ZodBigIntFormat`,(e,t)=>{j0.init(e,t),u5.init(e,t)});function p5(e){return B4(f5,e)}function m5(e){return V4(f5,e)}var h5=$(`ZodSymbol`,(e,t)=>{M0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J3(e,t,n,r)});function g5(e){return H4(h5,e)}var _5=$(`ZodUndefined`,(e,t)=>{N0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X3(e,t,n,r)});function v5(e){return U4(_5,e)}var y5=$(`ZodNull`,(e,t)=>{P0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y3(e,t,n,r)});function b5(e){return W4(y5,e)}var x5=$(`ZodAny`,(e,t)=>{F0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function FAe(){return G4(x5)}var S5=$(`ZodUnknown`,(e,t)=>{I0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function C5(){return K4(S5)}var w5=$(`ZodNever`,(e,t)=>{L0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q3(e,t,n,r)});function T5(e){return q4(w5,e)}var E5=$(`ZodVoid`,(e,t)=>{R0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z3(e,t,n,r)});function IAe(e){return J4(E5,e)}var D5=$(`ZodDate`,(e,t)=>{z0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$3(e,t,n,r),e.min=(t,n)=>e.check(t3(t,n)),e.max=(t,n)=>e.check($4(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function LAe(e){return Y4(D5,e)}var O5=$(`ZodArray`,(e,t)=>{V0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d6(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(d3(t,n)),e.nonempty=t=>e.check(d3(1,t)),e.max=(t,n)=>e.check(u3(t,n)),e.length=(t,n)=>e.check(f3(t,n)),e.unwrap=()=>e.element});function k5(e,t){return D3(O5,e,t)}function RAe(e){let t=e._zod.def.shape;return W5(Object.keys(t))}var A5=$(`ZodObject`,(e,t)=>{K0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>f6(e,t,n,r),NQ.defineLazy(e,`shape`,()=>t.shape),e.keyof=()=>W5(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:C5()}),e.loose=()=>e.clone({...e._zod.def,catchall:C5()}),e.strict=()=>e.clone({...e._zod.def,catchall:T5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>NQ.extend(e,t),e.safeExtend=t=>NQ.safeExtend(e,t),e.merge=t=>NQ.merge(e,t),e.pick=t=>NQ.pick(e,t),e.omit=t=>NQ.omit(e,t),e.partial=(...t)=>NQ.partial(Y5,e,t[0]),e.required=(...t)=>NQ.required(a7,e,t[0])});function zAe(e,t){return new A5({type:`object`,shape:e??{},...NQ.normalizeParams(t)})}function BAe(e,t){return new A5({type:`object`,shape:e,catchall:T5(),...NQ.normalizeParams(t)})}function VAe(e,t){return new A5({type:`object`,shape:e,catchall:C5(),...NQ.normalizeParams(t)})}var j5=$(`ZodUnion`,(e,t)=>{J0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>p6(e,t,n,r),e.options=t.options});function M5(e,t){return new j5({type:`union`,options:e,...NQ.normalizeParams(t)})}var N5=$(`ZodXor`,(e,t)=>{j5.init(e,t),X0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>p6(e,t,n,r),e.options=t.options});function HAe(e,t){return new N5({type:`union`,options:e,inclusive:!1,...NQ.normalizeParams(t)})}var P5=$(`ZodDiscriminatedUnion`,(e,t)=>{j5.init(e,t),Z0.init(e,t)});function UAe(e,t,n){return new P5({type:`union`,options:t,discriminator:e,...NQ.normalizeParams(n)})}var F5=$(`ZodIntersection`,(e,t)=>{Q0.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m6(e,t,n,r)});function I5(e,t){return new F5({type:`intersection`,left:e,right:t})}var L5=$(`ZodTuple`,(e,t)=>{t2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>h6(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function R5(e,t,n){let r=t instanceof X1,i=r?n:t;return new L5({type:`tuple`,items:e,rest:r?t:null,...NQ.normalizeParams(i)})}var z5=$(`ZodRecord`,(e,t)=>{r2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>g6(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B5(e,t,n){return new z5({type:`record`,keyType:e,valueType:t,...NQ.normalizeParams(n)})}function WAe(e,t,n){let r=t$(e);return r._zod.values=void 0,new z5({type:`record`,keyType:r,valueType:t,...NQ.normalizeParams(n)})}function GAe(e,t,n){return new z5({type:`record`,keyType:e,valueType:t,mode:`loose`,...NQ.normalizeParams(n)})}var V5=$(`ZodMap`,(e,t)=>{i2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>l6(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(c3(...t)),e.nonempty=t=>e.check(c3(1,t)),e.max=(...t)=>e.check(s3(...t)),e.size=(...t)=>e.check(l3(...t))});function KAe(e,t,n){return new V5({type:`map`,keyType:e,valueType:t,...NQ.normalizeParams(n)})}var H5=$(`ZodSet`,(e,t)=>{o2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>u6(e,t,n,r),e.min=(...t)=>e.check(c3(...t)),e.nonempty=t=>e.check(c3(1,t)),e.max=(...t)=>e.check(s3(...t)),e.size=(...t)=>e.check(l3(...t))});function qAe(e,t){return new H5({type:`set`,valueType:e,...NQ.normalizeParams(t)})}var U5=$(`ZodEnum`,(e,t)=>{c2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e6(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new U5({...t,checks:[],...NQ.normalizeParams(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new U5({...t,checks:[],...NQ.normalizeParams(r),entries:i})}});function W5(e,t){return new U5({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...NQ.normalizeParams(t)})}function JAe(e,t){return new U5({type:`enum`,entries:e,...NQ.normalizeParams(t)})}var G5=$(`ZodLiteral`,(e,t)=>{l2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t6(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function YAe(e,t){return new G5({type:`literal`,values:Array.isArray(e)?e:[e],...NQ.normalizeParams(t)})}var K5=$(`ZodFile`,(e,t)=>{u2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i6(e,t,n,r),e.min=(t,n)=>e.check(c3(t,n)),e.max=(t,n)=>e.check(s3(t,n)),e.mime=(t,n)=>e.check(b3(Array.isArray(t)?t:[t],n))});function XAe(e){return O3(K5,e)}var q5=$(`ZodTransform`,(e,t)=>{d2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c6(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new AQ(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(NQ.issue(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(NQ.issue(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function J5(e){return new q5({type:`transform`,transform:e})}var Y5=$(`ZodOptional`,(e,t)=>{p2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>T6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function X5(e){return new Y5({type:`optional`,innerType:e})}var Z5=$(`ZodExactOptional`,(e,t)=>{m2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>T6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Q5(e){return new Z5({type:`optional`,innerType:e})}var $5=$(`ZodNullable`,(e,t)=>{h2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function e7(e){return new $5({type:`nullable`,innerType:e})}function ZAe(e){return X5(e7(e))}var t7=$(`ZodDefault`,(e,t)=>{g2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function n7(e,t){return new t7({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():NQ.shallowClone(t)}})}var r7=$(`ZodPrefault`,(e,t)=>{v2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function i7(e,t){return new r7({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():NQ.shallowClone(t)}})}var a7=$(`ZodNonOptional`,(e,t)=>{y2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>v6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function o7(e,t){return new a7({type:`nonoptional`,innerType:e,...NQ.normalizeParams(t)})}var s7=$(`ZodSuccess`,(e,t)=>{x2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function QAe(e){return new s7({type:`success`,innerType:e})}var c7=$(`ZodCatch`,(e,t)=>{S2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>x6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function l7(e,t){return new c7({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var u7=$(`ZodNaN`,(e,t)=>{C2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n6(e,t,n,r)});function $Ae(e){return Z4(u7,e)}var d7=$(`ZodPipe`,(e,t)=>{w2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>S6(e,t,n,r),e.in=t.in,e.out=t.out});function f7(e,t){return new d7({type:`pipe`,in:e,out:t})}var p7=$(`ZodCodec`,(e,t)=>{d7.init(e,t),E2.init(e,t)});function eje(e,t,n){return new p7({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var m7=$(`ZodReadonly`,(e,t)=>{k2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>C6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function h7(e){return new m7({type:`readonly`,innerType:e})}var g7=$(`ZodTemplateLiteral`,(e,t)=>{j2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r6(e,t,n,r)});function tje(e,t){return new g7({type:`template_literal`,parts:e,...NQ.normalizeParams(t)})}var _7=$(`ZodLazy`,(e,t)=>{P2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E6(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function v7(e){return new _7({type:`lazy`,getter:e})}var y7=$(`ZodPromise`,(e,t)=>{N2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>w6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nje(e){return new y7({type:`promise`,innerType:e})}var b7=$(`ZodFunction`,(e,t)=>{M2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s6(e,t,n,r)});function x7(e){return new b7({type:`function`,input:Array.isArray(e?.input)?R5(e?.input):e?.input??k5(C5()),output:e?.output??C5()})}var S7=$(`ZodCustom`,(e,t)=>{F2.init(e,t),e8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o6(e,t,n,r)});function rje(e){let t=new w1({check:`custom`});return t._zod.check=e,t}function ije(e,t){return k3(S7,e??(()=>!0),t)}function C7(e,t={}){return A3(S7,e,t)}function w7(e){return j3(e)}var aje=N3,oje=P3;function sje(e,t={}){let n=new S7({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...NQ.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var cje=(...e)=>F3({Codec:p7,Boolean:c5,String:n8},...e);function lje(e){let t=v7(()=>M5([r8(e),t5(),l5(),b5(),k5(t),B5(r8(),t)]));return t}function uje(e,t){return f7(J5(e),t)}var dje={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function fje(e){MQ({customError:e})}function pje(){return MQ().customError}var mje;(function(e){})(mje||={});var T7={...k6,...A6,iso:j6},hje=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function gje(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function _je(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function vje(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return T7.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return T7.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=E7(_je(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return T7.null();if(n.length===0)return T7.never();if(n.length===1)return T7.literal(n[0]);if(n.every(e=>typeof e==`string`))return T7.enum(n);let r=n.map(e=>T7.literal(e));return r.length<2?r[0]:T7.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return T7.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>vje({...e,type:n},t));return r.length===0?T7.never():r.length===1?r[0]:T7.union(r)}if(!n)return T7.any();let r;switch(n){case`string`:{let t=T7.string();if(e.format){let n=e.format;n===`email`?t=t.check(T7.email()):n===`uri`||n===`uri-reference`?t=t.check(T7.url()):n===`uuid`||n===`guid`?t=t.check(T7.uuid()):n===`date-time`?t=t.check(T7.iso.datetime()):n===`date`?t=t.check(T7.iso.date()):n===`time`?t=t.check(T7.iso.time()):n===`duration`?t=t.check(T7.iso.duration()):n===`ipv4`?t=t.check(T7.ipv4()):n===`ipv6`?t=t.check(T7.ipv6()):n===`mac`?t=t.check(T7.mac()):n===`cidr`?t=t.check(T7.cidrv4()):n===`cidr-v6`?t=t.check(T7.cidrv6()):n===`base64`?t=t.check(T7.base64()):n===`base64url`?t=t.check(T7.base64url()):n===`e164`?t=t.check(T7.e164()):n===`jwt`?t=t.check(T7.jwt()):n===`emoji`?t=t.check(T7.emoji()):n===`nanoid`?t=t.check(T7.nanoid()):n===`cuid`?t=t.check(T7.cuid()):n===`cuid2`?t=t.check(T7.cuid2()):n===`ulid`?t=t.check(T7.ulid()):n===`xid`?t=t.check(T7.xid()):n===`ksuid`&&(t=t.check(T7.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?T7.number().int():T7.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=T7.boolean();break;case`null`:r=T7.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=E7(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=E7(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?E7(e.additionalProperties,t):T7.any();if(Object.keys(n).length===0){r=T7.record(i,a);break}let o=T7.object(n).passthrough(),s=T7.looseRecord(i,a);r=T7.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=E7(i[e],t),r=T7.string().regex(new RegExp(e));o.push(T7.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(T7.object(n).passthrough()),s.push(...o),s.length===0)r=T7.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=T7.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=T7.intersection(e,s[t]);r=e}break}let o=T7.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(E7(e.additionalProperties,t)):o.passthrough();break}case`array`:{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let a=n.map(e=>E7(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?E7(i,t):void 0;r=o?T7.tuple(a).rest(o):T7.tuple(a),typeof e.minItems==`number`&&(r=r.check(T7.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(T7.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>E7(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?E7(e.additionalItems,t):void 0;r=a?T7.tuple(n).rest(a):T7.tuple(n),typeof e.minItems==`number`&&(r=r.check(T7.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(T7.maxLength(e.maxItems)))}else if(i!==void 0){let n=E7(i,t),a=T7.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=T7.array(T7.any());break}default:throw Error(`Unsupported type: ${n}`)}return e.description&&(r=r.describe(e.description)),e.default!==void 0&&(r=r.default(e.default)),r}function E7(e,t){if(typeof e==`boolean`)return e?T7.any():T7.never();let n=vje(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>E7(e,t)),a=T7.union(i);n=r?T7.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>E7(e,t)),a=T7.xor(i);n=r?T7.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:T7.any();else{let i=r?n:E7(e.allOf[0],t),a=+!r;for(let n=a;n<e.allOf.length;n++)i=T7.intersection(i,E7(e.allOf[n],t));n=i}e.nullable===!0&&t.version===`openapi-3.0`&&(n=T7.nullable(n)),e.readOnly===!0&&(n=T7.readonly(n));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))hje.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),n}function yje(e,t){return typeof e==`boolean`?e?T7.any():T7.never():E7(e,{version:gje(e,t?.defaultTarget),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??Q2})}var bje={};wQ(bje,{string:()=>xje,number:()=>Sje,date:()=>Tje,boolean:()=>Cje,bigint:()=>wje});function xje(e){return e4(n8,e)}function Sje(e){return A4(e5,e)}function Cje(e){return L4(c5,e)}function wje(e){return z4(u5,e)}function Tje(e){return X4(D5,e)}MQ(z2());var Eje=Q.union([Q.literal(`light`),Q.literal(`dark`)]).describe(`Color theme preference for the host environment.`),D7=Q.union([Q.literal(`inline`),Q.literal(`fullscreen`),Q.literal(`pip`)]).describe(`Display mode for UI presentation.`),Dje=Q.union([Q.literal(`--color-background-primary`),Q.literal(`--color-background-secondary`),Q.literal(`--color-background-tertiary`),Q.literal(`--color-background-inverse`),Q.literal(`--color-background-ghost`),Q.literal(`--color-background-info`),Q.literal(`--color-background-danger`),Q.literal(`--color-background-success`),Q.literal(`--color-background-warning`),Q.literal(`--color-background-disabled`),Q.literal(`--color-text-primary`),Q.literal(`--color-text-secondary`),Q.literal(`--color-text-tertiary`),Q.literal(`--color-text-inverse`),Q.literal(`--color-text-ghost`),Q.literal(`--color-text-info`),Q.literal(`--color-text-danger`),Q.literal(`--color-text-success`),Q.literal(`--color-text-warning`),Q.literal(`--color-text-disabled`),Q.literal(`--color-text-ghost`),Q.literal(`--color-border-primary`),Q.literal(`--color-border-secondary`),Q.literal(`--color-border-tertiary`),Q.literal(`--color-border-inverse`),Q.literal(`--color-border-ghost`),Q.literal(`--color-border-info`),Q.literal(`--color-border-danger`),Q.literal(`--color-border-success`),Q.literal(`--color-border-warning`),Q.literal(`--color-border-disabled`),Q.literal(`--color-ring-primary`),Q.literal(`--color-ring-secondary`),Q.literal(`--color-ring-inverse`),Q.literal(`--color-ring-info`),Q.literal(`--color-ring-danger`),Q.literal(`--color-ring-success`),Q.literal(`--color-ring-warning`),Q.literal(`--font-sans`),Q.literal(`--font-mono`),Q.literal(`--font-weight-normal`),Q.literal(`--font-weight-medium`),Q.literal(`--font-weight-semibold`),Q.literal(`--font-weight-bold`),Q.literal(`--font-text-xs-size`),Q.literal(`--font-text-sm-size`),Q.literal(`--font-text-md-size`),Q.literal(`--font-text-lg-size`),Q.literal(`--font-heading-xs-size`),Q.literal(`--font-heading-sm-size`),Q.literal(`--font-heading-md-size`),Q.literal(`--font-heading-lg-size`),Q.literal(`--font-heading-xl-size`),Q.literal(`--font-heading-2xl-size`),Q.literal(`--font-heading-3xl-size`),Q.literal(`--font-text-xs-line-height`),Q.literal(`--font-text-sm-line-height`),Q.literal(`--font-text-md-line-height`),Q.literal(`--font-text-lg-line-height`),Q.literal(`--font-heading-xs-line-height`),Q.literal(`--font-heading-sm-line-height`),Q.literal(`--font-heading-md-line-height`),Q.literal(`--font-heading-lg-line-height`),Q.literal(`--font-heading-xl-line-height`),Q.literal(`--font-heading-2xl-line-height`),Q.literal(`--font-heading-3xl-line-height`),Q.literal(`--border-radius-xs`),Q.literal(`--border-radius-sm`),Q.literal(`--border-radius-md`),Q.literal(`--border-radius-lg`),Q.literal(`--border-radius-xl`),Q.literal(`--border-radius-full`),Q.literal(`--border-width-regular`),Q.literal(`--shadow-hairline`),Q.literal(`--shadow-sm`),Q.literal(`--shadow-md`),Q.literal(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`),Oje=Q.record(Dje.describe(`Style variables for theming MCP apps.
|
|
616
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function V3(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:W3(t,`input`,e.processors),output:W3(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function H3(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return H3(r.element,n);if(r.type===`set`)return H3(r.valueType,n);if(r.type===`lazy`)return H3(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return H3(r.innerType,n);if(r.type===`intersection`)return H3(r.left,n)||H3(r.right,n);if(r.type===`record`||r.type===`map`)return H3(r.keyType,n)||H3(r.valueType,n);if(r.type===`pipe`)return H3(r.in,n)||H3(r.out,n);if(r.type===`object`){for(let e in r.shape)if(H3(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(H3(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(H3(e,n))return!0;return!!(r.rest&&H3(r.rest,n))}return!1}var U3=(e,t={})=>n=>{let r=R3({...n,processors:t});return z3(e,r),B3(r,e),V3(r,e)},W3=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=R3({...i??{},target:a,io:t,processors:n});return z3(e,o),B3(o,e),V3(o,e)},OAe={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},G3=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=OAe[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},K3=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},q3=(e,t,n,r)=>{n.type=`boolean`},J3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Y3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},X3=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Z3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Q3=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},$3=(e,t,n,r)=>{n.not={}},kAe=(e,t,n,r)=>{},AAe=(e,t,n,r)=>{},e6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},t6=(e,t,n,r)=>{let i=e._zod.def,a=FQ(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},n6=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},r6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},i6=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},a6=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},o6=(e,t,n,r)=>{n.type=`boolean`},s6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},c6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},l6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},u6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},d6=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},f6=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=z3(a.element,t,{...r,path:[...r.path,`items`]})},p6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=z3(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=z3(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},m6=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>z3(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},h6=(e,t,n,r)=>{let i=e._zod.def,a=z3(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=z3(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},g6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>z3(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?z3(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,!l&&(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},_6=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=z3(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=z3(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=z3(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},v6=(e,t,n,r)=>{let i=e._zod.def,a=z3(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},y6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},b6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},x6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},S6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},C6=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;z3(a,t,r);let o=t.seen.get(e);o.ref=a},w6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},T6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},E6=(e,t,n,r)=>{let i=e._zod.def;z3(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},D6=(e,t,n,r)=>{let i=e._zod.innerType;z3(i,t,r);let a=t.seen.get(e);a.ref=i},O6={string:G3,number:K3,boolean:q3,bigint:J3,symbol:Y3,null:X3,undefined:Z3,void:Q3,never:$3,any:kAe,unknown:AAe,date:e6,enum:t6,literal:n6,nan:r6,template_literal:i6,file:a6,success:o6,custom:s6,function:c6,transform:l6,map:u6,set:d6,array:f6,object:p6,union:m6,intersection:h6,tuple:g6,record:_6,nullable:v6,nonoptional:y6,default:b6,prefault:x6,catch:S6,pipe:C6,readonly:w6,promise:T6,optional:E6,lazy:D6};function k6(e,t){if(`_idmap`in e){let n=e,r=R3({...t,processors:O6}),i={};for(let e of n._idmap.entries()){let[t,n]=e;z3(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;B3(r,n),a[t]=V3(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=R3({...t,processors:O6});return z3(e,n),B3(n,e),V3(n,e)}var jAe=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??`draft-2020-12`;t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),this.ctx=R3({processors:O6,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return z3(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),B3(this.ctx,e);let{"~standard":n,...r}=V3(this.ctx,e);return r}},MAe={},A6={};TQ(A6,{xor:()=>HAe,xid:()=>k8,void:()=>IAe,uuidv7:()=>m8,uuidv6:()=>p8,uuidv4:()=>f8,uuid:()=>d8,url:()=>g8,unknown:()=>C5,union:()=>M5,undefined:()=>PAe,ulid:()=>D8,uint64:()=>h5,uint32:()=>c5,tuple:()=>R5,transform:()=>J5,templateLiteral:()=>tje,symbol:()=>_5,superRefine:()=>w7,success:()=>QAe,stringbool:()=>cje,stringFormat:()=>Z8,string:()=>i8,strictObject:()=>BAe,set:()=>qAe,refine:()=>C7,record:()=>B5,readonly:()=>h7,promise:()=>nje,preprocess:()=>uje,prefault:()=>i7,pipe:()=>f7,partialRecord:()=>WAe,optional:()=>X5,object:()=>zAe,number:()=>n5,nullish:()=>ZAe,nullable:()=>e7,null:()=>b5,nonoptional:()=>o7,never:()=>T5,nativeEnum:()=>JAe,nanoid:()=>x8,nan:()=>$Ae,meta:()=>oje,map:()=>KAe,mac:()=>F8,looseRecord:()=>GAe,looseObject:()=>VAe,literal:()=>YAe,lazy:()=>v7,ksuid:()=>j8,keyof:()=>RAe,jwt:()=>Y8,json:()=>lje,ipv6:()=>L8,ipv4:()=>N8,intersection:()=>I5,int64:()=>m5,int32:()=>s5,int:()=>i5,instanceof:()=>sje,httpUrl:()=>_8,hostname:()=>Q8,hex:()=>$8,hash:()=>e5,guid:()=>l8,function:()=>x7,float64:()=>o5,float32:()=>a5,file:()=>XAe,exactOptional:()=>Q5,enum:()=>W5,emoji:()=>y8,email:()=>s8,e164:()=>q8,discriminatedUnion:()=>UAe,describe:()=>aje,date:()=>LAe,custom:()=>ije,cuid2:()=>T8,cuid:()=>C8,codec:()=>eje,cidrv6:()=>V8,cidrv4:()=>z8,check:()=>rje,catch:()=>l7,boolean:()=>u5,bigint:()=>f5,base64url:()=>G8,base64:()=>U8,array:()=>k5,any:()=>FAe,_function:()=>x7,_default:()=>n7,_ZodString:()=>n8,ZodXor:()=>N5,ZodXID:()=>O8,ZodVoid:()=>E5,ZodUnknown:()=>S5,ZodUnion:()=>j5,ZodUndefined:()=>v5,ZodUUID:()=>u8,ZodURL:()=>h8,ZodULID:()=>E8,ZodType:()=>t8,ZodTuple:()=>L5,ZodTransform:()=>q5,ZodTemplateLiteral:()=>g7,ZodSymbol:()=>g5,ZodSuccess:()=>s7,ZodStringFormat:()=>a8,ZodString:()=>r8,ZodSet:()=>H5,ZodRecord:()=>z5,ZodReadonly:()=>m7,ZodPromise:()=>y7,ZodPrefault:()=>r7,ZodPipe:()=>d7,ZodOptional:()=>Y5,ZodObject:()=>A5,ZodNumberFormat:()=>r5,ZodNumber:()=>t5,ZodNullable:()=>$5,ZodNull:()=>y5,ZodNonOptional:()=>a7,ZodNever:()=>w5,ZodNanoID:()=>b8,ZodNaN:()=>u7,ZodMap:()=>V5,ZodMAC:()=>P8,ZodLiteral:()=>G5,ZodLazy:()=>_7,ZodKSUID:()=>A8,ZodJWT:()=>J8,ZodIntersection:()=>F5,ZodIPv6:()=>I8,ZodIPv4:()=>M8,ZodGUID:()=>c8,ZodFunction:()=>b7,ZodFile:()=>K5,ZodExactOptional:()=>Z5,ZodEnum:()=>U5,ZodEmoji:()=>v8,ZodEmail:()=>o8,ZodE164:()=>K8,ZodDiscriminatedUnion:()=>P5,ZodDefault:()=>t7,ZodDate:()=>D5,ZodCustomStringFormat:()=>X8,ZodCustom:()=>S7,ZodCodec:()=>p7,ZodCatch:()=>c7,ZodCUID2:()=>w8,ZodCUID:()=>S8,ZodCIDRv6:()=>B8,ZodCIDRv4:()=>R8,ZodBoolean:()=>l5,ZodBigIntFormat:()=>p5,ZodBigInt:()=>d5,ZodBase64URL:()=>W8,ZodBase64:()=>H8,ZodArray:()=>O5,ZodAny:()=>x5});var j6={};TQ(j6,{uppercase:()=>g3,trim:()=>w3,toUpperCase:()=>E3,toLowerCase:()=>T3,startsWith:()=>v3,slugify:()=>D3,size:()=>u3,regex:()=>m3,property:()=>b3,positive:()=>r3,overwrite:()=>S3,normalize:()=>C3,nonpositive:()=>a3,nonnegative:()=>o3,negative:()=>i3,multipleOf:()=>s3,minSize:()=>l3,minLength:()=>f3,mime:()=>x3,maxSize:()=>c3,maxLength:()=>d3,lte:()=>e3,lt:()=>$4,lowercase:()=>h3,length:()=>p3,includes:()=>_3,gte:()=>n3,gt:()=>t3,endsWith:()=>y3});var M6={};TQ(M6,{time:()=>R6,duration:()=>B6,datetime:()=>P6,date:()=>I6,ZodISOTime:()=>L6,ZodISODuration:()=>z6,ZodISODateTime:()=>N6,ZodISODate:()=>F6});var N6=$(`ZodISODateTime`,(e,t)=>{d0.init(e,t),a8.init(e,t)});function P6(e){return E4(N6,e)}var F6=$(`ZodISODate`,(e,t)=>{f0.init(e,t),a8.init(e,t)});function I6(e){return D4(F6,e)}var L6=$(`ZodISOTime`,(e,t)=>{p0.init(e,t),a8.init(e,t)});function R6(e){return O4(L6,e)}var z6=$(`ZodISODuration`,(e,t)=>{m0.init(e,t),a8.init(e,t)});function B6(e){return k4(z6,e)}var V6=(e,t)=>{y$.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>S$(e,t)},flatten:{value:t=>x$(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,LQ,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,LQ,2)}},isEmpty:{get(){return e.issues.length===0}}})},NAe=$(`ZodError`,V6),H6=$(`ZodError`,V6,{Parent:Error}),U6=E$(H6),W6=O$(H6),G6=A$(H6),K6=M$(H6),q6=P$(H6),J6=F$(H6),Y6=I$(H6),X6=L$(H6),Z6=R$(H6),Q6=z$(H6),$6=B$(H6),e8=V$(H6),t8=$(`ZodType`,(e,t)=>(Z1.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:W3(e,`input`),output:W3(e,`output`)}}),e.toJSONSchema=U3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(PQ.mergeDefs(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>n$(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>U6(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>G6(e,t,n),e.parseAsync=async(t,n)=>W6(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>K6(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>q6(e,t,n),e.decode=(t,n)=>J6(e,t,n),e.encodeAsync=async(t,n)=>Y6(e,t,n),e.decodeAsync=async(t,n)=>X6(e,t,n),e.safeEncode=(t,n)=>Z6(e,t,n),e.safeDecode=(t,n)=>Q6(e,t,n),e.safeEncodeAsync=async(t,n)=>$6(e,t,n),e.safeDecodeAsync=async(t,n)=>e8(e,t,n),e.refine=(t,n)=>e.check(C7(t,n)),e.superRefine=t=>e.check(w7(t)),e.overwrite=t=>e.check(S3(t)),e.optional=()=>X5(e),e.exactOptional=()=>Q5(e),e.nullable=()=>e7(e),e.nullish=()=>X5(e7(e)),e.nonoptional=t=>o7(e,t),e.array=()=>k5(e),e.or=t=>M5([e,t]),e.and=t=>I5(e,t),e.transform=t=>f7(e,J5(t)),e.default=t=>n7(e,t),e.prefault=t=>i7(e,t),e.catch=t=>l7(e,t),e.pipe=t=>f7(e,t),e.readonly=()=>h7(e),e.describe=t=>{let n=e.clone();return $2.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return $2.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return $2.get(e);let n=e.clone();return $2.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),n8=$(`_ZodString`,(e,t)=>{Q1.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>G3(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(m3(...t)),e.includes=(...t)=>e.check(_3(...t)),e.startsWith=(...t)=>e.check(v3(...t)),e.endsWith=(...t)=>e.check(y3(...t)),e.min=(...t)=>e.check(f3(...t)),e.max=(...t)=>e.check(d3(...t)),e.length=(...t)=>e.check(p3(...t)),e.nonempty=(...t)=>e.check(f3(1,...t)),e.lowercase=t=>e.check(h3(t)),e.uppercase=t=>e.check(g3(t)),e.trim=()=>e.check(w3()),e.normalize=(...t)=>e.check(C3(...t)),e.toLowerCase=()=>e.check(T3()),e.toUpperCase=()=>e.check(E3()),e.slugify=()=>e.check(D3())}),r8=$(`ZodString`,(e,t)=>{Q1.init(e,t),n8.init(e,t),e.email=t=>e.check(n4(o8,t)),e.url=t=>e.check(c4(h8,t)),e.jwt=t=>e.check(w4(J8,t)),e.emoji=t=>e.check(l4(v8,t)),e.guid=t=>e.check(r4(c8,t)),e.uuid=t=>e.check(i4(u8,t)),e.uuidv4=t=>e.check(a4(u8,t)),e.uuidv6=t=>e.check(o4(u8,t)),e.uuidv7=t=>e.check(s4(u8,t)),e.nanoid=t=>e.check(u4(b8,t)),e.guid=t=>e.check(r4(c8,t)),e.cuid=t=>e.check(d4(S8,t)),e.cuid2=t=>e.check(f4(w8,t)),e.ulid=t=>e.check(p4(E8,t)),e.base64=t=>e.check(x4(H8,t)),e.base64url=t=>e.check(S4(W8,t)),e.xid=t=>e.check(m4(O8,t)),e.ksuid=t=>e.check(h4(A8,t)),e.ipv4=t=>e.check(g4(M8,t)),e.ipv6=t=>e.check(_4(I8,t)),e.cidrv4=t=>e.check(y4(R8,t)),e.cidrv6=t=>e.check(b4(B8,t)),e.e164=t=>e.check(C4(K8,t)),e.datetime=t=>e.check(P6(t)),e.date=t=>e.check(I6(t)),e.time=t=>e.check(R6(t)),e.duration=t=>e.check(B6(t))});function i8(e){return e4(r8,e)}var a8=$(`ZodStringFormat`,(e,t)=>{$1.init(e,t),n8.init(e,t)}),o8=$(`ZodEmail`,(e,t)=>{n0.init(e,t),a8.init(e,t)});function s8(e){return n4(o8,e)}var c8=$(`ZodGUID`,(e,t)=>{e0.init(e,t),a8.init(e,t)});function l8(e){return r4(c8,e)}var u8=$(`ZodUUID`,(e,t)=>{t0.init(e,t),a8.init(e,t)});function d8(e){return i4(u8,e)}function f8(e){return a4(u8,e)}function p8(e){return o4(u8,e)}function m8(e){return s4(u8,e)}var h8=$(`ZodURL`,(e,t)=>{r0.init(e,t),a8.init(e,t)});function g8(e){return c4(h8,e)}function _8(e){return c4(h8,{protocol:/^https?$/,hostname:H$.domain,...PQ.normalizeParams(e)})}var v8=$(`ZodEmoji`,(e,t)=>{i0.init(e,t),a8.init(e,t)});function y8(e){return l4(v8,e)}var b8=$(`ZodNanoID`,(e,t)=>{a0.init(e,t),a8.init(e,t)});function x8(e){return u4(b8,e)}var S8=$(`ZodCUID`,(e,t)=>{o0.init(e,t),a8.init(e,t)});function C8(e){return d4(S8,e)}var w8=$(`ZodCUID2`,(e,t)=>{s0.init(e,t),a8.init(e,t)});function T8(e){return f4(w8,e)}var E8=$(`ZodULID`,(e,t)=>{c0.init(e,t),a8.init(e,t)});function D8(e){return p4(E8,e)}var O8=$(`ZodXID`,(e,t)=>{l0.init(e,t),a8.init(e,t)});function k8(e){return m4(O8,e)}var A8=$(`ZodKSUID`,(e,t)=>{u0.init(e,t),a8.init(e,t)});function j8(e){return h4(A8,e)}var M8=$(`ZodIPv4`,(e,t)=>{h0.init(e,t),a8.init(e,t)});function N8(e){return g4(M8,e)}var P8=$(`ZodMAC`,(e,t)=>{_0.init(e,t),a8.init(e,t)});function F8(e){return v4(P8,e)}var I8=$(`ZodIPv6`,(e,t)=>{g0.init(e,t),a8.init(e,t)});function L8(e){return _4(I8,e)}var R8=$(`ZodCIDRv4`,(e,t)=>{v0.init(e,t),a8.init(e,t)});function z8(e){return y4(R8,e)}var B8=$(`ZodCIDRv6`,(e,t)=>{y0.init(e,t),a8.init(e,t)});function V8(e){return b4(B8,e)}var H8=$(`ZodBase64`,(e,t)=>{x0.init(e,t),a8.init(e,t)});function U8(e){return x4(H8,e)}var W8=$(`ZodBase64URL`,(e,t)=>{C0.init(e,t),a8.init(e,t)});function G8(e){return S4(W8,e)}var K8=$(`ZodE164`,(e,t)=>{w0.init(e,t),a8.init(e,t)});function q8(e){return C4(K8,e)}var J8=$(`ZodJWT`,(e,t)=>{E0.init(e,t),a8.init(e,t)});function Y8(e){return w4(J8,e)}var X8=$(`ZodCustomStringFormat`,(e,t)=>{D0.init(e,t),a8.init(e,t)});function Z8(e,t,n={}){return L3(X8,e,t,n)}function Q8(e){return L3(X8,`hostname`,H$.hostname,e)}function $8(e){return L3(X8,`hex`,H$.hex,e)}function e5(e,t){let n=`${e}_${t?.enc??`hex`}`,r=H$[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return L3(X8,n,r,t)}var t5=$(`ZodNumber`,(e,t)=>{O0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>K3(e,t,n,r),e.gt=(t,n)=>e.check(t3(t,n)),e.gte=(t,n)=>e.check(n3(t,n)),e.min=(t,n)=>e.check(n3(t,n)),e.lt=(t,n)=>e.check($4(t,n)),e.lte=(t,n)=>e.check(e3(t,n)),e.max=(t,n)=>e.check(e3(t,n)),e.int=t=>e.check(i5(t)),e.safe=t=>e.check(i5(t)),e.positive=t=>e.check(t3(0,t)),e.nonnegative=t=>e.check(n3(0,t)),e.negative=t=>e.check($4(0,t)),e.nonpositive=t=>e.check(e3(0,t)),e.multipleOf=(t,n)=>e.check(s3(t,n)),e.step=(t,n)=>e.check(s3(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function n5(e){return A4(t5,e)}var r5=$(`ZodNumberFormat`,(e,t)=>{k0.init(e,t),t5.init(e,t)});function i5(e){return M4(r5,e)}function a5(e){return N4(r5,e)}function o5(e){return P4(r5,e)}function s5(e){return F4(r5,e)}function c5(e){return I4(r5,e)}var l5=$(`ZodBoolean`,(e,t)=>{A0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>q3(e,t,n,r)});function u5(e){return L4(l5,e)}var d5=$(`ZodBigInt`,(e,t)=>{j0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>J3(e,t,n,r),e.gte=(t,n)=>e.check(n3(t,n)),e.min=(t,n)=>e.check(n3(t,n)),e.gt=(t,n)=>e.check(t3(t,n)),e.gte=(t,n)=>e.check(n3(t,n)),e.min=(t,n)=>e.check(n3(t,n)),e.lt=(t,n)=>e.check($4(t,n)),e.lte=(t,n)=>e.check(e3(t,n)),e.max=(t,n)=>e.check(e3(t,n)),e.positive=t=>e.check(t3(BigInt(0),t)),e.negative=t=>e.check($4(BigInt(0),t)),e.nonpositive=t=>e.check(e3(BigInt(0),t)),e.nonnegative=t=>e.check(n3(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(s3(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function f5(e){return z4(d5,e)}var p5=$(`ZodBigIntFormat`,(e,t)=>{M0.init(e,t),d5.init(e,t)});function m5(e){return V4(p5,e)}function h5(e){return H4(p5,e)}var g5=$(`ZodSymbol`,(e,t)=>{N0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Y3(e,t,n,r)});function _5(e){return U4(g5,e)}var v5=$(`ZodUndefined`,(e,t)=>{P0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Z3(e,t,n,r)});function PAe(e){return W4(v5,e)}var y5=$(`ZodNull`,(e,t)=>{F0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>X3(e,t,n,r)});function b5(e){return G4(y5,e)}var x5=$(`ZodAny`,(e,t)=>{I0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function FAe(){return K4(x5)}var S5=$(`ZodUnknown`,(e,t)=>{L0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function C5(){return q4(S5)}var w5=$(`ZodNever`,(e,t)=>{R0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$3(e,t,n,r)});function T5(e){return J4(w5,e)}var E5=$(`ZodVoid`,(e,t)=>{z0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Q3(e,t,n,r)});function IAe(e){return Y4(E5,e)}var D5=$(`ZodDate`,(e,t)=>{B0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e6(e,t,n,r),e.min=(t,n)=>e.check(n3(t,n)),e.max=(t,n)=>e.check(e3(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function LAe(e){return X4(D5,e)}var O5=$(`ZodArray`,(e,t)=>{H0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>f6(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(f3(t,n)),e.nonempty=t=>e.check(f3(1,t)),e.max=(t,n)=>e.check(d3(t,n)),e.length=(t,n)=>e.check(p3(t,n)),e.unwrap=()=>e.element});function k5(e,t){return O3(O5,e,t)}function RAe(e){let t=e._zod.def.shape;return W5(Object.keys(t))}var A5=$(`ZodObject`,(e,t)=>{q0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>p6(e,t,n,r),PQ.defineLazy(e,`shape`,()=>t.shape),e.keyof=()=>W5(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:C5()}),e.loose=()=>e.clone({...e._zod.def,catchall:C5()}),e.strict=()=>e.clone({...e._zod.def,catchall:T5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>PQ.extend(e,t),e.safeExtend=t=>PQ.safeExtend(e,t),e.merge=t=>PQ.merge(e,t),e.pick=t=>PQ.pick(e,t),e.omit=t=>PQ.omit(e,t),e.partial=(...t)=>PQ.partial(Y5,e,t[0]),e.required=(...t)=>PQ.required(a7,e,t[0])});function zAe(e,t){return new A5({type:`object`,shape:e??{},...PQ.normalizeParams(t)})}function BAe(e,t){return new A5({type:`object`,shape:e,catchall:T5(),...PQ.normalizeParams(t)})}function VAe(e,t){return new A5({type:`object`,shape:e,catchall:C5(),...PQ.normalizeParams(t)})}var j5=$(`ZodUnion`,(e,t)=>{Y0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m6(e,t,n,r),e.options=t.options});function M5(e,t){return new j5({type:`union`,options:e,...PQ.normalizeParams(t)})}var N5=$(`ZodXor`,(e,t)=>{j5.init(e,t),Z0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m6(e,t,n,r),e.options=t.options});function HAe(e,t){return new N5({type:`union`,options:e,inclusive:!1,...PQ.normalizeParams(t)})}var P5=$(`ZodDiscriminatedUnion`,(e,t)=>{j5.init(e,t),Q0.init(e,t)});function UAe(e,t,n){return new P5({type:`union`,options:t,discriminator:e,...PQ.normalizeParams(n)})}var F5=$(`ZodIntersection`,(e,t)=>{$0.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>h6(e,t,n,r)});function I5(e,t){return new F5({type:`intersection`,left:e,right:t})}var L5=$(`ZodTuple`,(e,t)=>{n2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>g6(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function R5(e,t,n){let r=t instanceof Z1,i=r?n:t;return new L5({type:`tuple`,items:e,rest:r?t:null,...PQ.normalizeParams(i)})}var z5=$(`ZodRecord`,(e,t)=>{i2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_6(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B5(e,t,n){return new z5({type:`record`,keyType:e,valueType:t,...PQ.normalizeParams(n)})}function WAe(e,t,n){let r=n$(e);return r._zod.values=void 0,new z5({type:`record`,keyType:r,valueType:t,...PQ.normalizeParams(n)})}function GAe(e,t,n){return new z5({type:`record`,keyType:e,valueType:t,mode:`loose`,...PQ.normalizeParams(n)})}var V5=$(`ZodMap`,(e,t)=>{a2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>u6(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(l3(...t)),e.nonempty=t=>e.check(l3(1,t)),e.max=(...t)=>e.check(c3(...t)),e.size=(...t)=>e.check(u3(...t))});function KAe(e,t,n){return new V5({type:`map`,keyType:e,valueType:t,...PQ.normalizeParams(n)})}var H5=$(`ZodSet`,(e,t)=>{s2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>d6(e,t,n,r),e.min=(...t)=>e.check(l3(...t)),e.nonempty=t=>e.check(l3(1,t)),e.max=(...t)=>e.check(c3(...t)),e.size=(...t)=>e.check(u3(...t))});function qAe(e,t){return new H5({type:`set`,valueType:e,...PQ.normalizeParams(t)})}var U5=$(`ZodEnum`,(e,t)=>{l2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t6(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new U5({...t,checks:[],...PQ.normalizeParams(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new U5({...t,checks:[],...PQ.normalizeParams(r),entries:i})}});function W5(e,t){return new U5({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...PQ.normalizeParams(t)})}function JAe(e,t){return new U5({type:`enum`,entries:e,...PQ.normalizeParams(t)})}var G5=$(`ZodLiteral`,(e,t)=>{u2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n6(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function YAe(e,t){return new G5({type:`literal`,values:Array.isArray(e)?e:[e],...PQ.normalizeParams(t)})}var K5=$(`ZodFile`,(e,t)=>{d2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a6(e,t,n,r),e.min=(t,n)=>e.check(l3(t,n)),e.max=(t,n)=>e.check(c3(t,n)),e.mime=(t,n)=>e.check(x3(Array.isArray(t)?t:[t],n))});function XAe(e){return k3(K5,e)}var q5=$(`ZodTransform`,(e,t)=>{f2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>l6(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new jQ(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(PQ.issue(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(PQ.issue(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function J5(e){return new q5({type:`transform`,transform:e})}var Y5=$(`ZodOptional`,(e,t)=>{m2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function X5(e){return new Y5({type:`optional`,innerType:e})}var Z5=$(`ZodExactOptional`,(e,t)=>{h2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Q5(e){return new Z5({type:`optional`,innerType:e})}var $5=$(`ZodNullable`,(e,t)=>{g2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>v6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function e7(e){return new $5({type:`nullable`,innerType:e})}function ZAe(e){return X5(e7(e))}var t7=$(`ZodDefault`,(e,t)=>{_2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function n7(e,t){return new t7({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():PQ.shallowClone(t)}})}var r7=$(`ZodPrefault`,(e,t)=>{y2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>x6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function i7(e,t){return new r7({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():PQ.shallowClone(t)}})}var a7=$(`ZodNonOptional`,(e,t)=>{b2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function o7(e,t){return new a7({type:`nonoptional`,innerType:e,...PQ.normalizeParams(t)})}var s7=$(`ZodSuccess`,(e,t)=>{S2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function QAe(e){return new s7({type:`success`,innerType:e})}var c7=$(`ZodCatch`,(e,t)=>{C2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>S6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function l7(e,t){return new c7({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var u7=$(`ZodNaN`,(e,t)=>{w2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r6(e,t,n,r)});function $Ae(e){return Q4(u7,e)}var d7=$(`ZodPipe`,(e,t)=>{T2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>C6(e,t,n,r),e.in=t.in,e.out=t.out});function f7(e,t){return new d7({type:`pipe`,in:e,out:t})}var p7=$(`ZodCodec`,(e,t)=>{d7.init(e,t),D2.init(e,t)});function eje(e,t,n){return new p7({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}var m7=$(`ZodReadonly`,(e,t)=>{A2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>w6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function h7(e){return new m7({type:`readonly`,innerType:e})}var g7=$(`ZodTemplateLiteral`,(e,t)=>{M2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i6(e,t,n,r)});function tje(e,t){return new g7({type:`template_literal`,parts:e,...PQ.normalizeParams(t)})}var _7=$(`ZodLazy`,(e,t)=>{F2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>D6(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function v7(e){return new _7({type:`lazy`,getter:e})}var y7=$(`ZodPromise`,(e,t)=>{P2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>T6(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nje(e){return new y7({type:`promise`,innerType:e})}var b7=$(`ZodFunction`,(e,t)=>{N2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>c6(e,t,n,r)});function x7(e){return new b7({type:`function`,input:Array.isArray(e?.input)?R5(e?.input):e?.input??k5(C5()),output:e?.output??C5()})}var S7=$(`ZodCustom`,(e,t)=>{I2.init(e,t),t8.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s6(e,t,n,r)});function rje(e){let t=new T1({check:`custom`});return t._zod.check=e,t}function ije(e,t){return A3(S7,e??(()=>!0),t)}function C7(e,t={}){return j3(S7,e,t)}function w7(e){return M3(e)}var aje=P3,oje=F3;function sje(e,t={}){let n=new S7({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...PQ.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var cje=(...e)=>I3({Codec:p7,Boolean:l5,String:r8},...e);function lje(e){let t=v7(()=>M5([i8(e),n5(),u5(),b5(),k5(t),B5(i8(),t)]));return t}function uje(e,t){return f7(J5(e),t)}var dje={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function fje(e){NQ({customError:e})}function pje(){return NQ().customError}var mje;(function(e){})(mje||={});var T7={...A6,...j6,iso:M6},hje=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function gje(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function _je(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function vje(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return T7.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return T7.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=E7(_je(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return T7.null();if(n.length===0)return T7.never();if(n.length===1)return T7.literal(n[0]);if(n.every(e=>typeof e==`string`))return T7.enum(n);let r=n.map(e=>T7.literal(e));return r.length<2?r[0]:T7.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return T7.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>vje({...e,type:n},t));return r.length===0?T7.never():r.length===1?r[0]:T7.union(r)}if(!n)return T7.any();let r;switch(n){case`string`:{let t=T7.string();if(e.format){let n=e.format;n===`email`?t=t.check(T7.email()):n===`uri`||n===`uri-reference`?t=t.check(T7.url()):n===`uuid`||n===`guid`?t=t.check(T7.uuid()):n===`date-time`?t=t.check(T7.iso.datetime()):n===`date`?t=t.check(T7.iso.date()):n===`time`?t=t.check(T7.iso.time()):n===`duration`?t=t.check(T7.iso.duration()):n===`ipv4`?t=t.check(T7.ipv4()):n===`ipv6`?t=t.check(T7.ipv6()):n===`mac`?t=t.check(T7.mac()):n===`cidr`?t=t.check(T7.cidrv4()):n===`cidr-v6`?t=t.check(T7.cidrv6()):n===`base64`?t=t.check(T7.base64()):n===`base64url`?t=t.check(T7.base64url()):n===`e164`?t=t.check(T7.e164()):n===`jwt`?t=t.check(T7.jwt()):n===`emoji`?t=t.check(T7.emoji()):n===`nanoid`?t=t.check(T7.nanoid()):n===`cuid`?t=t.check(T7.cuid()):n===`cuid2`?t=t.check(T7.cuid2()):n===`ulid`?t=t.check(T7.ulid()):n===`xid`?t=t.check(T7.xid()):n===`ksuid`&&(t=t.check(T7.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?T7.number().int():T7.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=T7.boolean();break;case`null`:r=T7.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=E7(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=E7(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?E7(e.additionalProperties,t):T7.any();if(Object.keys(n).length===0){r=T7.record(i,a);break}let o=T7.object(n).passthrough(),s=T7.looseRecord(i,a);r=T7.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=E7(i[e],t),r=T7.string().regex(new RegExp(e));o.push(T7.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(T7.object(n).passthrough()),s.push(...o),s.length===0)r=T7.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=T7.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=T7.intersection(e,s[t]);r=e}break}let o=T7.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(E7(e.additionalProperties,t)):o.passthrough();break}case`array`:{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let a=n.map(e=>E7(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?E7(i,t):void 0;r=o?T7.tuple(a).rest(o):T7.tuple(a),typeof e.minItems==`number`&&(r=r.check(T7.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(T7.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>E7(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?E7(e.additionalItems,t):void 0;r=a?T7.tuple(n).rest(a):T7.tuple(n),typeof e.minItems==`number`&&(r=r.check(T7.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(T7.maxLength(e.maxItems)))}else if(i!==void 0){let n=E7(i,t),a=T7.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=T7.array(T7.any());break}default:throw Error(`Unsupported type: ${n}`)}return e.description&&(r=r.describe(e.description)),e.default!==void 0&&(r=r.default(e.default)),r}function E7(e,t){if(typeof e==`boolean`)return e?T7.any():T7.never();let n=vje(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>E7(e,t)),a=T7.union(i);n=r?T7.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>E7(e,t)),a=T7.xor(i);n=r?T7.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:T7.any();else{let i=r?n:E7(e.allOf[0],t),a=+!r;for(let n=a;n<e.allOf.length;n++)i=T7.intersection(i,E7(e.allOf[n],t));n=i}e.nullable===!0&&t.version===`openapi-3.0`&&(n=T7.nullable(n)),e.readOnly===!0&&(n=T7.readonly(n));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))hje.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),n}function yje(e,t){return typeof e==`boolean`?e?T7.any():T7.never():E7(e,{version:gje(e,t?.defaultTarget),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??$2})}var bje={};TQ(bje,{string:()=>xje,number:()=>Sje,date:()=>Tje,boolean:()=>Cje,bigint:()=>wje});function xje(e){return t4(r8,e)}function Sje(e){return j4(t5,e)}function Cje(e){return R4(l5,e)}function wje(e){return B4(d5,e)}function Tje(e){return Z4(D5,e)}NQ(B2());var Eje=Q.union([Q.literal(`light`),Q.literal(`dark`)]).describe(`Color theme preference for the host environment.`),D7=Q.union([Q.literal(`inline`),Q.literal(`fullscreen`),Q.literal(`pip`)]).describe(`Display mode for UI presentation.`),Dje=Q.union([Q.literal(`--color-background-primary`),Q.literal(`--color-background-secondary`),Q.literal(`--color-background-tertiary`),Q.literal(`--color-background-inverse`),Q.literal(`--color-background-ghost`),Q.literal(`--color-background-info`),Q.literal(`--color-background-danger`),Q.literal(`--color-background-success`),Q.literal(`--color-background-warning`),Q.literal(`--color-background-disabled`),Q.literal(`--color-text-primary`),Q.literal(`--color-text-secondary`),Q.literal(`--color-text-tertiary`),Q.literal(`--color-text-inverse`),Q.literal(`--color-text-ghost`),Q.literal(`--color-text-info`),Q.literal(`--color-text-danger`),Q.literal(`--color-text-success`),Q.literal(`--color-text-warning`),Q.literal(`--color-text-disabled`),Q.literal(`--color-text-ghost`),Q.literal(`--color-border-primary`),Q.literal(`--color-border-secondary`),Q.literal(`--color-border-tertiary`),Q.literal(`--color-border-inverse`),Q.literal(`--color-border-ghost`),Q.literal(`--color-border-info`),Q.literal(`--color-border-danger`),Q.literal(`--color-border-success`),Q.literal(`--color-border-warning`),Q.literal(`--color-border-disabled`),Q.literal(`--color-ring-primary`),Q.literal(`--color-ring-secondary`),Q.literal(`--color-ring-inverse`),Q.literal(`--color-ring-info`),Q.literal(`--color-ring-danger`),Q.literal(`--color-ring-success`),Q.literal(`--color-ring-warning`),Q.literal(`--font-sans`),Q.literal(`--font-mono`),Q.literal(`--font-weight-normal`),Q.literal(`--font-weight-medium`),Q.literal(`--font-weight-semibold`),Q.literal(`--font-weight-bold`),Q.literal(`--font-text-xs-size`),Q.literal(`--font-text-sm-size`),Q.literal(`--font-text-md-size`),Q.literal(`--font-text-lg-size`),Q.literal(`--font-heading-xs-size`),Q.literal(`--font-heading-sm-size`),Q.literal(`--font-heading-md-size`),Q.literal(`--font-heading-lg-size`),Q.literal(`--font-heading-xl-size`),Q.literal(`--font-heading-2xl-size`),Q.literal(`--font-heading-3xl-size`),Q.literal(`--font-text-xs-line-height`),Q.literal(`--font-text-sm-line-height`),Q.literal(`--font-text-md-line-height`),Q.literal(`--font-text-lg-line-height`),Q.literal(`--font-heading-xs-line-height`),Q.literal(`--font-heading-sm-line-height`),Q.literal(`--font-heading-md-line-height`),Q.literal(`--font-heading-lg-line-height`),Q.literal(`--font-heading-xl-line-height`),Q.literal(`--font-heading-2xl-line-height`),Q.literal(`--font-heading-3xl-line-height`),Q.literal(`--border-radius-xs`),Q.literal(`--border-radius-sm`),Q.literal(`--border-radius-md`),Q.literal(`--border-radius-lg`),Q.literal(`--border-radius-xl`),Q.literal(`--border-radius-full`),Q.literal(`--border-width-regular`),Q.literal(`--shadow-hairline`),Q.literal(`--shadow-sm`),Q.literal(`--shadow-md`),Q.literal(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`),Oje=Q.record(Dje.describe(`Style variables for theming MCP apps.
|
|
617
617
|
|
|
618
618
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
619
619
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -634,7 +634,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
634
634
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),kje=Q.object({method:Q.literal(`ui/open-link`),params:Q.object({url:Q.string().describe(`URL to open in the host's browser`)})});Q.object({isError:Q.boolean().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),Q.object({isError:Q.boolean().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();var Aje=Q.object({method:Q.literal(`ui/notifications/sandbox-proxy-ready`),params:Q.object({})}),O7=Q.object({connectDomains:Q.array(Q.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).`),resourceDomains:Q.array(Q.string()).optional().describe(`Origins for static resources (scripts, images, styles, fonts).`),frameDomains:Q.array(Q.string()).optional().describe(`Origins for nested iframes (frame-src directive).`),baseUriDomains:Q.array(Q.string()).optional().describe(`Allowed base URIs for the document (base-uri directive).`)}),k7=Q.object({camera:Q.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:Q.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:Q.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:Q.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")}),jje=Q.object({method:Q.literal(`ui/notifications/size-changed`),params:Q.object({width:Q.number().optional().describe(`New width in pixels.`),height:Q.number().optional().describe(`New height in pixels.`)})});Q.object({method:Q.literal(`ui/notifications/tool-input`),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),Q.object({method:Q.literal(`ui/notifications/tool-input-partial`),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),Q.object({method:Q.literal(`ui/notifications/tool-cancelled`),params:Q.object({reason:Q.string().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var Mje=Q.object({fonts:Q.string().optional()}),Nje=Q.object({variables:Oje.optional().describe(`CSS variables for theming the app.`),css:Mje.optional().describe(`CSS blocks that apps can inject.`)});Q.object({method:Q.literal(`ui/resource-teardown`),params:Q.object({})});var Pje=Q.record(Q.string(),Q.unknown()),Fje=Q.object({text:Q.object({}).optional().describe(`Host supports text content blocks.`),image:Q.object({}).optional().describe(`Host supports image content blocks.`),audio:Q.object({}).optional().describe(`Host supports audio content blocks.`),resource:Q.object({}).optional().describe(`Host supports resource content blocks.`),resourceLink:Q.object({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:Q.object({}).optional().describe(`Host supports structured content.`)}),Ije=Q.object({experimental:Q.object({}).optional().describe(`Experimental features (structure TBD).`),openLinks:Q.object({}).optional().describe(`Host supports opening external URLs.`),serverTools:Q.object({listChanged:Q.boolean().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:Q.object({listChanged:Q.boolean().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:Q.object({}).optional().describe(`Host accepts log messages.`),sandbox:Q.object({permissions:k7.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:O7.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Fje.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Fje.optional().describe(`Host supports receiving content messages (ui/message) from the view.`)}),Lje=Q.object({experimental:Q.object({}).optional().describe(`Experimental features (structure TBD).`),tools:Q.object({listChanged:Q.boolean().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:Q.array(D7).optional().describe(`Display modes the app supports.`)}),Rje=Q.object({method:Q.literal(`ui/notifications/initialized`),params:Q.object({}).optional()});Q.object({csp:O7.optional().describe(`Content Security Policy configuration.`),permissions:k7.optional().describe(`Sandbox permissions requested by the UI.`),domain:Q.string().optional().describe(`Dedicated origin for view sandbox.`),prefersBorder:Q.boolean().optional().describe(`Visual boundary preference - true if UI prefers a visible border.`)});var zje=Q.object({method:Q.literal(`ui/request-display-mode`),params:Q.object({mode:D7.describe(`The display mode being requested.`)})});Q.object({mode:D7.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var Bje=Q.union([Q.literal(`model`),Q.literal(`app`)]).describe(`Tool visibility scope - who can access the tool.`);Q.object({resourceUri:Q.string().optional(),visibility:Q.array(Bje).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
635
635
|
- "model": Tool visible to and callable by the agent
|
|
636
636
|
- "app": Tool callable by the app from this server only`)}),Q.object({mimeTypes:Q.array(Q.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var Vje=Q.object({method:Q.literal(`ui/message`),params:Q.object({role:Q.literal(`user`).describe(`Message role, currently only "user" is supported.`),content:Q.array(qg).describe(`Message content blocks (text, image, etc.).`)})});Q.object({method:Q.literal(`ui/notifications/sandbox-resource-ready`),params:Q.object({html:Q.string().describe(`HTML content to load into the inner iframe.`),sandbox:Q.string().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:O7.optional().describe(`CSP configuration from resource metadata.`),permissions:k7.optional().describe(`Sandbox permissions from resource metadata.`)})}),Q.object({method:Q.literal(`ui/notifications/tool-result`),params:Qg.describe(`Standard MCP tool execution result.`)});var Hje=Q.object({toolInfo:Q.object({id:Qh.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Xg.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Eje.optional().describe(`Current color theme preference.`),styles:Nje.optional().describe(`Style configuration for theming the app.`),displayMode:D7.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:Q.array(D7).optional().describe(`Display modes the host supports.`),containerDimensions:Q.union([Q.object({height:Q.number().describe(`Fixed container height in pixels.`)}),Q.object({maxHeight:Q.union([Q.number(),Q.undefined()]).optional().describe(`Maximum container height in pixels.`)})]).and(Q.union([Q.object({width:Q.number().describe(`Fixed container width in pixels.`)}),Q.object({maxWidth:Q.union([Q.number(),Q.undefined()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
637
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Q.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:Q.string().optional().describe(`User's timezone in IANA format.`),userAgent:Q.string().optional().describe(`Host application identifier.`),platform:Q.union([Q.literal(`web`),Q.literal(`desktop`),Q.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:Q.object({touch:Q.boolean().optional().describe(`Whether the device supports touch input.`),hover:Q.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:Q.object({top:Q.number().describe(`Top safe area inset in pixels.`),right:Q.number().describe(`Right safe area inset in pixels.`),bottom:Q.number().describe(`Bottom safe area inset in pixels.`),left:Q.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();Q.object({method:Q.literal(`ui/notifications/host-context-changed`),params:Hje.describe(`Partial context update containing only changed fields.`)});var Uje=Q.object({method:Q.literal(`ui/update-model-context`),params:Q.object({content:Q.array(qg).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Q.record(Q.string(),Q.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),Wje=Q.object({method:Q.literal(`ui/initialize`),params:Q.object({appInfo:dg.describe(`App identification (name and version).`),appCapabilities:Lje.describe(`Features and capabilities this app provides.`),protocolVersion:Q.string().describe(`Protocol version this app supports.`)})});Q.object({protocolVersion:Q.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:dg.describe(`Host application identification and version.`),hostCapabilities:Ije.describe(`Features and capabilities provided by the host.`),hostContext:Hje.describe(`Rich context about the host environment.`)}).passthrough();var Gje=[TQ],Kje=class extends h_{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._capabilities=n,this._hostContext=r?.hostContext||{},this.setRequestHandler(Wje,e=>this._oninitialize(e)),this.setRequestHandler(mg,(e,t)=>(this.onping?.(e.params,t),{})),this.setRequestHandler(zje,e=>({mode:this._hostContext.displayMode??`inline`}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange(e){this.setNotificationHandler(jje,t=>e(t.params))}set onsandboxready(e){this.setNotificationHandler(Aje,t=>e(t.params))}set oninitialized(e){this.setNotificationHandler(Rje,t=>e(t.params))}set onmessage(e){this.setRequestHandler(Vje,async(t,n)=>e(t.params,n))}set onopenlink(e){this.setRequestHandler(kje,async(t,n)=>e(t.params,n))}set onrequestdisplaymode(e){this.setRequestHandler(zje,async(t,n)=>e(t.params,n))}set onloggingmessage(e){this.setNotificationHandler(n_,async t=>{e(t.params)})}set onupdatemodelcontext(e){this.setRequestHandler(Uje,async(t,n)=>e(t.params,n))}set oncalltool(e){this.setRequestHandler($g,async(t,n)=>e(t.params,n))}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}set onlistresources(e){this.setRequestHandler(Pg,async(t,n)=>e(t.params,n))}set onlistresourcetemplates(e){this.setRequestHandler(Ig,async(t,n)=>e(t.params,n))}set onreadresource(e){this.setRequestHandler(zg,async(t,n)=>e(t.params,n))}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}set onlistprompts(e){this.setRequestHandler(Hg,async(t,n)=>e(t.params,n))}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}assertTaskCapability(e){throw Error(`Tasks are not supported in MCP Apps`)}assertTaskHandlerCapability(e){throw Error(`Task handlers are not supported in MCP Apps`)}getCapabilities(){return this._capabilities}async _oninitialize(e){let t=e.params.protocolVersion;return this._appCapabilities=e.params.appCapabilities,this._appInfo=e.params.appInfo,{protocolVersion:Gje.includes(t)?t:TQ,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];qje(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},Pje,t)}sendResourceTeardown=this.teardownResource;async connect(e){if(this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},Qg,{signal:t.signal}),e.tools.listChanged&&this._client.setNotificationHandler(e_,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},Fg,{signal:t.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},Lg,{signal:t.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},Bg,{signal:t.signal}),e.resources.listChanged&&this._client.setNotificationHandler(Vg,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},Ug,{signal:t.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(Yg,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function qje(e,t){return JSON.stringify(e)===JSON.stringify(t)}var Jje=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,...t){this.listeners.get(e)?.forEach(e=>{try{e(...t)}catch(e){console.error(`Error in event listener:`,e)}})}},Yje=new class{emitter=new Jje;bufferByServer=new Map;publish(e){let t=this.bufferByServer.get(e.serverId)??[];t.push(e),t.length>1e3&&t.shift(),this.bufferByServer.set(e.serverId,t),this.emitter.emit(`event`,e)}subscribe(e,t){let n=new Set(e),r=e=>{(n.size===0||n.has(e.serverId))&&t(e)};return this.emitter.on(`event`,r),()=>this.emitter.off(`event`,r)}getBuffer(e,t){let n=new Set(e),r=[];for(let[e,t]of this.bufferByServer.entries())n.size>0&&!n.has(e)||r.push(...t);return r.sort((e,t)=>t.timestamp.localeCompare(e.timestamp)),t===0?[]:!Number.isFinite(t)||t<0?r:r.slice(0,t)}clear(e){if(e&&e.length>0){let t=new Set(e);for(let e of t)this.bufferByServer.delete(e)}else this.bufferByServer.clear()}},Xje=new class{listeners=new Set;publish(e){this.listeners.forEach(t=>{try{t(e)}catch(e){console.error(`[ConsoleLogBus] Error in listener:`,e)}})}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},A7=`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,j7={API_ENDPOINTS:{WIDGET_STORE:`/inspector/api/mcp-apps/widget/store`,WIDGET_CONTENT:e=>`/inspector/api/mcp-apps/widget-content/${e}`},VERSION:`0.16.2`,TIMEOUTS:{TOOL_CALL:6e5,ANIMATION:300},DIMENSIONS:{PIP_WIDTH:768,PIP_MAX_WIDTH:700,PIP_HEIGHT:400,DEFAULT_HEIGHT:400}},Zje=[{value:`en-US`,label:`English (US)`},{value:`en-GB`,label:`English (UK)`},{value:`en-CA`,label:`English (Canada)`},{value:`en-AU`,label:`English (Australia)`},{value:`en-IN`,label:`English (India)`},{value:`es-ES`,label:`Spanish (Spain)`},{value:`es-MX`,label:`Spanish (Mexico)`},{value:`es-AR`,label:`Spanish (Argentina)`},{value:`es-CO`,label:`Spanish (Colombia)`},{value:`fr-FR`,label:`French (France)`},{value:`fr-CA`,label:`French (Canada)`},{value:`fr-BE`,label:`French (Belgium)`},{value:`fr-CH`,label:`French (Switzerland)`},{value:`de-DE`,label:`German (Germany)`},{value:`de-AT`,label:`German (Austria)`},{value:`de-CH`,label:`German (Switzerland)`},{value:`pt-BR`,label:`Portuguese (Brazil)`},{value:`pt-PT`,label:`Portuguese (Portugal)`},{value:`zh-CN`,label:`Chinese (Simplified, China)`},{value:`zh-TW`,label:`Chinese (Traditional, Taiwan)`},{value:`zh-HK`,label:`Chinese (Traditional, Hong Kong)`},{value:`ja-JP`,label:`Japanese (Japan)`},{value:`ko-KR`,label:`Korean (Korea)`},{value:`ar-SA`,label:`Arabic (Saudi Arabia)`},{value:`ar-EG`,label:`Arabic (Egypt)`},{value:`hi-IN`,label:`Hindi (India)`},{value:`ru-RU`,label:`Russian (Russia)`},{value:`it-IT`,label:`Italian (Italy)`},{value:`nl-NL`,label:`Dutch (Netherlands)`},{value:`nl-BE`,label:`Dutch (Belgium)`},{value:`pl-PL`,label:`Polish (Poland)`},{value:`sv-SE`,label:`Swedish (Sweden)`},{value:`no-NO`,label:`Norwegian (Norway)`},{value:`da-DK`,label:`Danish (Denmark)`},{value:`fi-FI`,label:`Finnish (Finland)`},{value:`tr-TR`,label:`Turkish (Turkey)`},{value:`el-GR`,label:`Greek (Greece)`},{value:`cs-CZ`,label:`Czech (Czech Republic)`},{value:`hu-HU`,label:`Hungarian (Hungary)`},{value:`ro-RO`,label:`Romanian (Romania)`},{value:`th-TH`,label:`Thai (Thailand)`},{value:`vi-VN`,label:`Vietnamese (Vietnam)`},{value:`id-ID`,label:`Indonesian (Indonesia)`},{value:`ms-MY`,label:`Malay (Malaysia)`},{value:`tl-PH`,label:`Tagalog (Philippines)`},{value:`he-IL`,label:`Hebrew (Israel)`},{value:`uk-UA`,label:`Ukrainian (Ukraine)`},{value:`bg-BG`,label:`Bulgarian (Bulgaria)`},{value:`hr-HR`,label:`Croatian (Croatia)`},{value:`sk-SK`,label:`Slovak (Slovakia)`},{value:`sl-SI`,label:`Slovenian (Slovenia)`},{value:`sr-RS`,label:`Serbian (Serbia)`},{value:`bn-BD`,label:`Bengali (Bangladesh)`},{value:`ta-IN`,label:`Tamil (India)`},{value:`te-IN`,label:`Telugu (India)`},{value:`mr-IN`,label:`Marathi (India)`},{value:`ur-PK`,label:`Urdu (Pakistan)`},{value:`fa-IR`,label:`Persian (Iran)`},{value:`sw-KE`,label:`Swahili (Kenya)`}];function Qje(){return Intl.supportedValuesOf(`timeZone`).map(e=>({value:e,label:e.replace(/_/g,` `)}))}var $je=Qje();function eMe(e,t){return(0,w.useMemo)(()=>e===`custom`?{maxWidth:t.width,maxHeight:t.height}:{maxWidth:bQ[e].width,maxHeight:bQ[e].height},[e,t])}function tMe({theme:e,displayMode:t,maxWidth:n,maxHeight:r,playground:i,deviceType:a,toolCallId:o,toolName:s,toolInput:c,toolOutput:l,toolMetadata:u,tool:d}){return(0,w.useMemo)(()=>({theme:e,displayMode:t,availableDisplayModes:[`inline`,`pip`,`fullscreen`],containerDimensions:{maxHeight:r,maxWidth:n},locale:i.locale,timeZone:i.timeZone,platform:a===`mobile`?`mobile`:`web`,userAgent:`mcp-use-inspector/0.16.2`,deviceCapabilities:i.capabilities,safeAreaInsets:i.safeAreaInsets,styles:{variables:{}},toolInfo:d?{id:o,tool:d}:void 0}),[e,t,r,n,i.locale,i.timeZone,i.capabilities,i.safeAreaInsets,a,o,s,c,l,u,d])}function nMe({title:e,onClose:t,className:n,testId:r}){return(0,S.jsxs)(`div`,{className:H(`fixed top-0 left-0 right-0 z-50 flex items-center justify-between px-4 py-3`,`bg-background/80 backdrop-blur-md border-b border-border`,`supports-[backdrop-filter]:bg-background/60`,n),children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`text-sm font-semibold text-foreground/80`,children:`MCP Inspector`})}),(0,S.jsx)(`div`,{className:`flex-1 text-center`,children:(0,S.jsx)(`h2`,{className:`text-sm font-medium text-foreground truncate max-w-md mx-auto`,children:e})}),(0,S.jsx)(`div`,{className:`flex items-center`,children:(0,S.jsxs)(`button`,{"data-testid":r,onClick:t,className:H(`flex items-center gap-2 px-3 py-1.5 rounded-md`,`text-sm font-medium`,`bg-background/50 hover:bg-background/80`,`border border-border hover:border-border/80`,`transition-colors`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),"aria-label":`Exit Fullscreen`,children:[(0,S.jsx)(Fp,{className:`w-4 h-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Exit Fullscreen`})]})})]})}var rMe=(0,w.forwardRef)(function({html:e,sandbox:t=A7,csp:n,permissions:r,permissive:i,onProxyReady:a,onLoad:o,onMessage:s,className:c,style:l,title:u=`Sandboxed Content`},d){let f=(0,w.useRef)(null),[p,m]=(0,w.useState)(!1),[h]=(0,w.useState)(()=>{let e=window.location.hostname,t=window.location.port,n=window.location.protocol,r=window.__MCP_SANDBOX_ORIGIN__;if(r)return`${r}/inspector/api/mcp-apps/sandbox-proxy?v=${Date.now()}`;let i,a=window.__MCP_DEV_MODE__===!0;i=e===`localhost`||e===`127.0.0.1`||a?e:e.startsWith(`dev.`)?`sandbox-inspector.dev.${e.slice(4)}`:e.startsWith(`inspector.`)?`sandbox-${e}`:`sandbox-inspector.${e}`;let o=t?`:${t}`:``;return`${n}//${i}${o}/inspector/api/mcp-apps/sandbox-proxy?v=${Date.now()}`}),g=(0,w.useMemo)(()=>{try{return new URL(h).origin}catch{return`*`}},[h]);(0,w.useImperativeHandle)(d,()=>({postMessage:e=>{f.current?.contentWindow?.postMessage(e,g)},getIframeElement:()=>f.current}),[g]);let _=(0,w.useCallback)(e=>{if(!(e.origin!==g&&g!==`*`)&&e.source===f.current?.contentWindow){if(e.data?.method===`ui/notifications/sandbox-proxy-ready`||e.data?.type===`sandbox-proxy-ready`){console.log(`[SandboxedIframe] Sandbox proxy ready`),m(!0),a?.();return}s(e)}},[g,a,s]);return(0,w.useEffect)(()=>(window.addEventListener(`message`,_),()=>window.removeEventListener(`message`,_)),[_]),(0,w.useEffect)(()=>{!p||!e||!f.current?.contentWindow||f.current.contentWindow.postMessage({jsonrpc:`2.0`,method:`ui/notifications/sandbox-resource-ready`,params:{html:e,sandbox:t,csp:n,permissions:r,permissive:i}},g)},[p,e,t,n,r,i,g]),(0,S.jsx)(`iframe`,{ref:f,src:h,className:c,style:l,title:u,sandbox:t,allow:`web-share`,onLoad:o})});function M7({children:e,className:t,noWrapper:n}){return n?e:(0,S.jsx)(`div`,{className:H(`bg-zinc-100 flex flex-1 items-center justify-center dark:bg-zinc-900 bg-[radial-gradient(circle,_rgba(0,0,0,0.2)_1px,_transparent_1px)] dark:bg-[radial-gradient(circle,_rgba(255,255,255,0.2)_1px,_transparent_1px)] bg-[length:32px_32px]`,t),children:e})}function iMe(e){let t=e=>e.replace(/['"<>;]/g,``).trim(),n=(e.connectDomains||[]).map(t).filter(Boolean),r=(e.resourceDomains||[]).map(t).filter(Boolean),i=(e.frameDomains||[]).map(t).filter(Boolean),a=(e.baseUriDomains||[]).map(t).filter(Boolean),o=n.length>0?n.join(` `):`'none'`,s=r.length>0?[`data:`,`blob:`,...r].join(` `):`data: blob:`,c=i.length>0?i.join(` `):`'none'`,l=a.length>0?a.join(` `):`'none'`;return[`default-src 'none'`,`script-src 'unsafe-inline' ${s}`,`style-src 'unsafe-inline' ${s}`,`img-src ${s}`,`font-src ${s}`,`media-src ${s}`,`connect-src ${o}`,`frame-src ${c}`,`object-src 'none'`,`base-uri ${l}`].join(`; `)}function aMe({serverId:e,toolCallId:t,toolName:n,toolInput:r,toolOutput:i,toolMetadata:a,invoking:o,invoked:s,partialToolInput:c,resourceUri:l,readResource:u,onSendFollowUp:d,className:f,displayMode:p,onDisplayModeChange:m,noWrapper:h,customProps:g,cancelled:_,onRerun:v,onReady:y,chromeless:b,inlineWidthOverride:x}){let C=(0,w.useRef)(null),T=(0,w.useRef)(null),{resolvedTheme:E}=FP(),{servers:D}=uj(),O=D.find(t=>t.id===e),{playground:k,addWidget:A,removeWidget:j,addCspViolation:M,setWidgetModelContext:N,setWidgetDeclaredCsp:P}=yQ(),[F,I]=(0,w.useState)(0),[L,ee]=(0,w.useState)(null),[te,ne]=(0,w.useState)(null),[re,R]=(0,w.useState)(!1),[z,B]=(0,w.useState)(!0),ie=(0,w.useRef)(!1),ae=(0,w.useRef)(null),oe=(0,w.useRef)(null),se=(0,w.useRef)(null),ce=(0,w.useRef)(0),le=(0,w.useRef)(void 0),ue=(0,w.useRef)(r),de=(0,w.useRef)(i),fe=(0,w.useRef)(g),pe=(0,w.useRef)(u),me=(0,w.useRef)(O),he=(0,w.useRef)(null);ue.current=r,de.current=i,fe.current=g,pe.current=u,me.current=O;let[ge,_e]=(0,w.useState)(void 0),[ve,ye]=(0,w.useState)(void 0),[be,xe]=(0,w.useState)(!1),[Se,Ce]=(0,w.useState)(`inline`),we=p??Se,Te=(0,w.useRef)(we);Te.current=we;let[Ee,De]=(0,w.useState)(j7.DIMENSIONS.DEFAULT_HEIGHT),Oe=(0,w.useRef)(null),ke=k.cspMode,Ae=k.deviceType,je=k.customViewport,{maxWidth:Me,maxHeight:Ne}=eMe(Ae,je),Pe=x??(Ae===`mobile`?Me:768),Fe=tMe({theme:E,displayMode:we,maxWidth:Me,maxHeight:Ne,playground:k,deviceType:Ae,toolCallId:t,toolName:n,toolInput:r,toolOutput:i,toolMetadata:a,tool:(0,w.useMemo)(()=>{if(O?.tools)return O.tools.find(e=>e.name===n)},[O,n])});(0,w.useEffect)(()=>{(async()=>{try{let o=await u(l),s=o?.contents?.[0],c=s?.mimeType,d=s?._meta,f=(O?.resources?.find(e=>e.uri===l))?._meta?.ui,p=d?.ui,m=f||p?{...f,...p}:void 0,h=m?.csp;if(!h&&a?.[`openai/widgetCSP`]){let e=a[`openai/widgetCSP`],t={};Array.isArray(e.connect_domains)&&(t.connectDomains=e.connect_domains),Array.isArray(e.resource_domains)&&(t.resourceDomains=e.resource_domains),Array.isArray(e.frame_domains)&&(t.frameDomains=e.frame_domains),Array.isArray(e.base_uri_domains)&&(t.baseUriDomains=e.base_uri_domains),Array.isArray(e.script_directives)&&(t.scriptDirectives=e.script_directives),Object.keys(t).length>0&&(h=t)}let g=m?.permissions,_=m?.prefersBorder??!1,v=await fetch(j7.API_ENDPOINTS.WIDGET_STORE,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverId:e,uri:l,toolInput:r,toolOutput:i,toolId:t,toolName:n,theme:E,protocol:`mcp-apps`,cspMode:ke,resourceData:o,mimeType:c,mcpAppsCsp:h,mcpAppsPermissions:g})});if(!v.ok)throw Error(`Failed to store widget: ${v.statusText}`);let y=j7.API_ENDPOINTS.WIDGET_CONTENT(t),b=await fetch(`${y}?csp_mode=${ke}`);if(!b.ok){let e=await b.json().catch(()=>({}));throw Error(e.error||`Failed to fetch widget: ${b.statusText}`)}let{html:x,csp:S,permissions:C,mimeTypeWarning:w,mimeTypeValid:T}=await b.json();if(!T){ee(w||`Invalid MIME type - SEP-1865 requires "text/html;profile=mcp-app"`);return}ne(x),R(!1),ie.current||B(!0),_e(S),ye(C),xe(_),A(t,{toolName:n,protocol:`mcp-apps`,hostContext:Fe});let D=S??h,k=D&&typeof D==`object`?{connectDomains:D.connectDomains,resourceDomains:D.resourceDomains,frameDomains:D.frameDomains,baseUriDomains:D.baseUriDomains}:void 0,j;ke===`permissive`?j=[`default-src * 'unsafe-inline' 'unsafe-eval' data: blob: filesystem: about:`,`script-src * 'unsafe-inline' 'unsafe-eval' data: blob:`,`style-src * 'unsafe-inline' data: blob:`,`img-src * data: blob: https: http:`,`media-src * data: blob: https: http:`,`font-src * data: blob: https: http:`,`connect-src * data: blob: https: http: ws: wss: about:`,`frame-src * data: blob: https: http: about:`,`object-src * data: blob:`,`base-uri *`,`form-action *`].join(`; `):k&&(j=iMe(k)),P(t,k,j)}catch(e){ee(e instanceof Error?e.message:`Failed to prepare widget`)}})()},[e,l,t,n]);let Ie=(0,w.useRef)(ke);(0,w.useEffect)(()=>{Ie.current!==ke&&(Ie.current=ke,ie.current&&v&&v())},[ke,v]),(0,w.useEffect)(()=>{if(F<=1)return;let e=!1;return(async()=>{try{let t=await u(l);if(e)return;let n=t?.contents?.[0]?._meta?.ui;n&&`prefersBorder`in n&&xe(n.prefersBorder??!1)}catch{}})(),()=>{e=!0}},[F,l,u]),(0,w.useEffect)(()=>{if(!te||!C.current)return;let e=C.current.getIframeElement();if(!e?.contentWindow)return;I(0);let n={sessionId:void 0,async start(){},async send(e){C.current?.postMessage(e),Yje.publish({serverId:`widget-${t}`,direction:`send`,timestamp:new Date().toISOString(),message:e})},async close(){},onmessage:void 0,onerror:void 0,onclose:void 0},r=new Kje(null,{name:`mcp-use-inspector`,version:`0.16.2`},{openLinks:{},serverTools:{},serverResources:{},logging:{},sandbox:{csp:ke===`permissive`?void 0:ge,permissions:ve}},{hostContext:Fe});r.oninitialized=()=>{let e=Date.now();if(ce.current>0&&e-ce.current<2e3){clearTimeout(le.current),le.current=setTimeout(()=>{let e=fe.current,t={};if(e)for(let[n,r]of Object.entries(e))if(typeof r==`string`&&(r.trim().startsWith(`[`)||r.trim().startsWith(`{`)))try{t[n]=JSON.parse(r)}catch{t[n]=r}else t[n]=r;let n={...ue.current,...t};r.sendToolInput({arguments:n});let i=de.current;i&&r.sendToolResult(i)},300);return}ce.current=e,I(e=>e+1)},r.onmessage=async({content:e})=>(e.length>0&&d&&d(e),{}),r.onopenlink=async({url:e})=>(e&&window.open(e,`_blank`,`noopener,noreferrer`),{}),r.oncalltool=async({name:e,arguments:t})=>{let n=me.current;if(!n)throw Error(`Server connection not available`);try{return await n.callTool(e,t||{},{timeout:j7.TIMEOUTS.TOOL_CALL,resetTimeoutOnProgress:!0})}catch(e){throw r.sendToolCancelled({reason:e instanceof Error?e.message:String(e)}),e}},r.onreadresource=async({uri:e})=>(await pe.current(e)).contents||[],r.onlistresources=async()=>{let e=me.current;if(!e)throw Error(`Server connection not available`);return{resources:e.resources}},r.onrequestdisplaymode=async({mode:e})=>{let t=e??`inline`;return m?m(t):Ce(t),{mode:t}},r.onupdatemodelcontext=async({content:e,structuredContent:n})=>{N(t,{content:e,structuredContent:n});try{localStorage.setItem(`mcp-use:widget-state:${t}`,JSON.stringify(n))}catch{}return{}},r.onloggingmessage=async({level:e,logger:n,data:r})=>{if(Xje.publish({level:e,args:Array.isArray(r)?r:[r],timestamp:new Date().toISOString(),url:l}),e===`error`&&typeof window<`u`&&window.parent!==window){let e=typeof r==`string`?r:typeof r?.message==`string`?String(r.message):`MCP Apps runtime error`,n=typeof r?.stack==`string`?String(r.stack):void 0;window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`mcp-apps:logging`,message:e,stack:n,timestamp:Date.now(),toolId:t,url:l},`*`)}return{}},r.onsizechange=({height:t})=>{if(Te.current!==`inline`)return;let n=e;if(!n||t===void 0)return;let r=getComputedStyle(n),i=r.boxSizing===`border-box`,a=t;i&&(a+=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth));let o={height:`${n.offsetHeight}px`},s={height:`${a}px`};n.style.height=`${a}px`,De(a),n.animate([o,s],{duration:300,easing:`ease-out`})},T.current=r;let i=!0;r.connect(n).catch(e=>{i&&ee(e instanceof Error?e.message:`Failed to connect MCP App`)});let a=r=>{let i=new URL(e.src).origin;if(r.origin===i&&r.source===e.contentWindow){if(r.data?.type===`iframe-console-log`){if(r.data.level===`error`&&typeof window<`u`&&window.parent!==window){let e=(Array.isArray(r.data.args)?r.data.args:[])[0],n=typeof e==`string`?e:typeof e?.message==`string`?e.message:`MCP Apps iframe runtime error`,i=typeof e?.error?.stack==`string`?e.error.stack:typeof e?.stack==`string`?e.stack:void 0;window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`mcp-apps:iframe-console:error`,message:n,stack:i,timestamp:Date.now(),toolId:t,url:typeof r.data.url==`string`?r.data.url:l},`*`)}return}Yje.publish({serverId:`widget-${t}`,direction:`receive`,timestamp:new Date().toISOString(),message:r.data}),n.onmessage&&r.data&&n.onmessage(r.data)}};return window.addEventListener(`message`,a),()=>{ce.current=0,clearTimeout(le.current),i=!1,window.removeEventListener(`message`,a),r&&(async()=>{try{await Promise.race([r.teardownResource({}),new Promise((e,t)=>setTimeout(()=>t(Error(`teardown timeout`)),2e3))])}catch{}finally{r.close().catch(()=>{})}})(),T.current=null,he.current=null,j(t)}},[te,C,t]),(0,w.useEffect)(()=>{let e=T.current;if(!e||F===0)return;let t=JSON.stringify(Fe);he.current!==t&&(he.current=t,e.setHostContext(Fe))},[Fe,F]),(0,w.useEffect)(()=>{let e=T.current;!e||F===0||!c||e.sendToolInputPartial({arguments:c})},[F,c]),(0,w.useEffect)(()=>{let e=T.current;if(!e||F===0)return;let n={};if(g)for(let[e,t]of Object.entries(g))if(typeof t==`string`&&(t.trim().startsWith(`[`)||t.trim().startsWith(`{`)))try{n[e]=JSON.parse(t)}catch{n[e]=t}else n[e]=t;let i={...r,...n},a=JSON.stringify(i),o=`${t}:${F}`;if(!(ae.current===o&&oe.current===a))if(c){let t=requestAnimationFrame(()=>{e.sendToolInput({arguments:i}),ae.current=o,oe.current=a});return()=>cancelAnimationFrame(t)}else e.sendToolInput({arguments:i}),ae.current=o,oe.current=a},[F,r,g,t,c]),(0,w.useEffect)(()=>{let e=T.current;if(!(!e||F===0)&&i){let t=JSON.stringify({content:i?.structuredContent??i,customProps:g??null});if(se.current===t)return;se.current=t;let n=i;if(g&&Object.keys(g).length>0){let t={};for(let[e,n]of Object.entries(g))if(typeof n==`string`&&(n.trim().startsWith(`[`)||n.trim().startsWith(`{`)))try{t[e]=JSON.parse(n)}catch{t[e]=n}else t[e]=n;e.sendToolResult({...n,structuredContent:t})}else e.sendToolResult(n)}},[F,i,t,g]),(0,w.useEffect)(()=>{let e=T.current;!e||F===0||!_||e.sendToolCancelled({reason:`Cancelled by user`})},[_,F]);let Le=(0,w.useCallback)(e=>{if(e.data?.type!==`mcp-apps:csp-violation`)return;let{directive:n,blockedUri:r,sourceFile:i,lineNumber:a,columnNumber:o,effectiveDirective:s,originalPolicy:c,timestamp:l}=e.data;M(t,{directive:n,effectiveDirective:s,blockedUri:r,sourceFile:i,lineNumber:a,columnNumber:o,originalPolicy:c,timestamp:l||Date.now()}),console.warn(`[MCP Apps CSP Violation] ${n}: Blocked ${r}`,i?`at ${i}:${a}:${o}`:``)},[t,M]);(0,w.useEffect)(()=>{let e=()=>{!document.fullscreenElement&&we===`fullscreen`&&(m?m(`inline`):Ce(`inline`))};return document.addEventListener(`fullscreenchange`,e),()=>{document.removeEventListener(`fullscreenchange`,e)}},[we,m]);let Re=(0,w.useCallback)(async e=>{try{e===`fullscreen`?Oe.current&&await Oe.current.requestFullscreen():document.fullscreenElement&&await document.exitFullscreen(),m?m(e):Ce(e)}catch(t){console.error(`[MCPAppsRenderer] Display mode error:`,t),m?m(e):Ce(e)}},[m]),ze=re||F>0,Be=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{Be.current||F>0&&(Be.current=!0,y?.())},[F,y]),(0,w.useEffect)(()=>{if(!ze||!z)return;let e=setTimeout(()=>{B(!1),ie.current=!0},300);return()=>clearTimeout(e)},[ze,z]),L)return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsx)(`div`,{className:`border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4`,children:(0,S.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:[`Failed to load MCP App: `,L]})})});if(!te)return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})})});let Ve=we===`pip`,He=we===`fullscreen`,Ue=He?`fixed inset-0 z-40 w-full h-full bg-background flex flex-col`:Ve?[`fixed top-4 left-1/2 -translate-x-1/2 z-50 rounded-3xl w-full min-w-[300px] h-[400px]`,`shadow-2xl border overflow-hidden`,`bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`].join(` `):`flex group flex-1 items-center justify-center`,We={height:He||Ve?`100%`:`${Ee}px`,width:`100%`,maxWidth:we===`inline`?`${Pe}px`:`100%`,transition:He||Ve?void 0:`height 300ms ease-out`};return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsxs)(`div`,{ref:Oe,className:Ue,style:Ve?{maxWidth:j7.DIMENSIONS.PIP_MAX_WIDTH}:void 0,children:[He&&!b&&(0,S.jsx)(nMe,{title:n,onClose:()=>Re(`inline`),testId:`debugger-exit-fullscreen-button`}),Ve&&(0,S.jsx)(`button`,{"data-testid":`debugger-exit-pip-button`,onClick:()=>Re(`inline`),className:`absolute left-2 top-2 z-30 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 hover:bg-background border border-zinc-200 dark:border-zinc-700 text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors cursor-pointer`,"aria-label":`Close PiP mode`,title:`Close PiP mode`,children:(0,S.jsx)(Fp,{className:`w-4 h-4`})}),(0,S.jsxs)(`div`,{className:H(`flex-1 w-full h-full flex justify-center items-center relative`,He&&!b&&`pt-14`,!Ve&&!He&&(o||s)&&`pt-8`),children:[z&&(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full z-10`,children:(0,S.jsx)(zq,{className:`size-5`})}),(0,S.jsxs)(`div`,{className:`relative w-full h-full`,style:{maxWidth:We.maxWidth},children:[(0,S.jsx)(`div`,{className:`absolute -top-8 left-2 z-10 h-full`,children:!Ve&&!He&&(o||s)&&(0,S.jsxs)(`div`,{className:`whitespace-nowrap`,children:[o&&!i&&(0,S.jsx)(jY,{className:`text-xs `,children:o}),s&&!!i&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s})]})}),(0,S.jsx)(rMe,{ref:C,html:te,sandbox:A7,csp:ge,permissions:ve,permissive:ke===`permissive`,onLoad:()=>R(!0),onMessage:Le,title:`MCP App: ${n}`,className:H(we===`inline`&&`w-full`,we===`fullscreen`&&`w-full h-full rounded-none`,we===`pip`&&`w-full h-full`,we!==`fullscreen`&&be&&`rounded-lg`,`overflow-hidden`,be&&`border border-zinc-200 dark:border-zinc-700`),style:We}),` `]})]})]})})}function oMe(e,t){for(let n of[`serverId`,`toolCallId`,`toolName`,`resourceUri`,`displayMode`,`cancelled`,`noWrapper`])if(e[n]!==t[n])return!1;return!(e.toolInput!==t.toolInput||e.toolOutput!==t.toolOutput||e.toolMetadata!==t.toolMetadata||e.partialToolInput!==t.partialToolInput||e.customProps!==t.customProps||e.readResource!==t.readResource||e.onSendFollowUp!==t.onSendFollowUp||e.onRerun!==t.onRerun||e.onReady!==t.onReady||e.chromeless!==t.chromeless||e.inlineWidthOverride!==t.inlineWidthOverride||e.onDisplayModeChange!==t.onDisplayModeChange||e.className!==t.className||e.serverBaseUrl!==t.serverBaseUrl||e.invoking!==t.invoking||e.invoked!==t.invoked)}var N7=(0,w.memo)(aMe,oMe),sMe=`
|
|
637
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Q.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:Q.string().optional().describe(`User's timezone in IANA format.`),userAgent:Q.string().optional().describe(`Host application identifier.`),platform:Q.union([Q.literal(`web`),Q.literal(`desktop`),Q.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:Q.object({touch:Q.boolean().optional().describe(`Whether the device supports touch input.`),hover:Q.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:Q.object({top:Q.number().describe(`Top safe area inset in pixels.`),right:Q.number().describe(`Right safe area inset in pixels.`),bottom:Q.number().describe(`Bottom safe area inset in pixels.`),left:Q.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();Q.object({method:Q.literal(`ui/notifications/host-context-changed`),params:Hje.describe(`Partial context update containing only changed fields.`)});var Uje=Q.object({method:Q.literal(`ui/update-model-context`),params:Q.object({content:Q.array(qg).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Q.record(Q.string(),Q.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),Wje=Q.object({method:Q.literal(`ui/initialize`),params:Q.object({appInfo:dg.describe(`App identification (name and version).`),appCapabilities:Lje.describe(`Features and capabilities this app provides.`),protocolVersion:Q.string().describe(`Protocol version this app supports.`)})});Q.object({protocolVersion:Q.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:dg.describe(`Host application identification and version.`),hostCapabilities:Ije.describe(`Features and capabilities provided by the host.`),hostContext:Hje.describe(`Rich context about the host environment.`)}).passthrough();var Gje=[EQ],Kje=class extends h_{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._capabilities=n,this._hostContext=r?.hostContext||{},this.setRequestHandler(Wje,e=>this._oninitialize(e)),this.setRequestHandler(mg,(e,t)=>(this.onping?.(e.params,t),{})),this.setRequestHandler(zje,e=>({mode:this._hostContext.displayMode??`inline`}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange(e){this.setNotificationHandler(jje,t=>e(t.params))}set onsandboxready(e){this.setNotificationHandler(Aje,t=>e(t.params))}set oninitialized(e){this.setNotificationHandler(Rje,t=>e(t.params))}set onmessage(e){this.setRequestHandler(Vje,async(t,n)=>e(t.params,n))}set onopenlink(e){this.setRequestHandler(kje,async(t,n)=>e(t.params,n))}set onrequestdisplaymode(e){this.setRequestHandler(zje,async(t,n)=>e(t.params,n))}set onloggingmessage(e){this.setNotificationHandler(n_,async t=>{e(t.params)})}set onupdatemodelcontext(e){this.setRequestHandler(Uje,async(t,n)=>e(t.params,n))}set oncalltool(e){this.setRequestHandler($g,async(t,n)=>e(t.params,n))}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}set onlistresources(e){this.setRequestHandler(Pg,async(t,n)=>e(t.params,n))}set onlistresourcetemplates(e){this.setRequestHandler(Ig,async(t,n)=>e(t.params,n))}set onreadresource(e){this.setRequestHandler(zg,async(t,n)=>e(t.params,n))}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}set onlistprompts(e){this.setRequestHandler(Hg,async(t,n)=>e(t.params,n))}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}assertTaskCapability(e){throw Error(`Tasks are not supported in MCP Apps`)}assertTaskHandlerCapability(e){throw Error(`Task handlers are not supported in MCP Apps`)}getCapabilities(){return this._capabilities}async _oninitialize(e){let t=e.params.protocolVersion;return this._appCapabilities=e.params.appCapabilities,this._appInfo=e.params.appInfo,{protocolVersion:Gje.includes(t)?t:EQ,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];qje(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},Pje,t)}sendResourceTeardown=this.teardownResource;async connect(e){if(this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},Qg,{signal:t.signal}),e.tools.listChanged&&this._client.setNotificationHandler(e_,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},Fg,{signal:t.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},Lg,{signal:t.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},Bg,{signal:t.signal}),e.resources.listChanged&&this._client.setNotificationHandler(Vg,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},Ug,{signal:t.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(Yg,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function qje(e,t){return JSON.stringify(e)===JSON.stringify(t)}var Jje=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,...t){this.listeners.get(e)?.forEach(e=>{try{e(...t)}catch(e){console.error(`Error in event listener:`,e)}})}},Yje=new class{emitter=new Jje;bufferByServer=new Map;publish(e){let t=this.bufferByServer.get(e.serverId)??[];t.push(e),t.length>1e3&&t.shift(),this.bufferByServer.set(e.serverId,t),this.emitter.emit(`event`,e)}subscribe(e,t){let n=new Set(e),r=e=>{(n.size===0||n.has(e.serverId))&&t(e)};return this.emitter.on(`event`,r),()=>this.emitter.off(`event`,r)}getBuffer(e,t){let n=new Set(e),r=[];for(let[e,t]of this.bufferByServer.entries())n.size>0&&!n.has(e)||r.push(...t);return r.sort((e,t)=>t.timestamp.localeCompare(e.timestamp)),t===0?[]:!Number.isFinite(t)||t<0?r:r.slice(0,t)}clear(e){if(e&&e.length>0){let t=new Set(e);for(let e of t)this.bufferByServer.delete(e)}else this.bufferByServer.clear()}},Xje=new class{listeners=new Set;publish(e){this.listeners.forEach(t=>{try{t(e)}catch(e){console.error(`[ConsoleLogBus] Error in listener:`,e)}})}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},A7=`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,j7={API_ENDPOINTS:{WIDGET_STORE:`/inspector/api/mcp-apps/widget/store`,WIDGET_CONTENT:e=>`/inspector/api/mcp-apps/widget-content/${e}`},VERSION:`0.16.2`,TIMEOUTS:{TOOL_CALL:6e5,ANIMATION:300},DIMENSIONS:{PIP_WIDTH:768,PIP_MAX_WIDTH:700,PIP_HEIGHT:400,DEFAULT_HEIGHT:400}},Zje=[{value:`en-US`,label:`English (US)`},{value:`en-GB`,label:`English (UK)`},{value:`en-CA`,label:`English (Canada)`},{value:`en-AU`,label:`English (Australia)`},{value:`en-IN`,label:`English (India)`},{value:`es-ES`,label:`Spanish (Spain)`},{value:`es-MX`,label:`Spanish (Mexico)`},{value:`es-AR`,label:`Spanish (Argentina)`},{value:`es-CO`,label:`Spanish (Colombia)`},{value:`fr-FR`,label:`French (France)`},{value:`fr-CA`,label:`French (Canada)`},{value:`fr-BE`,label:`French (Belgium)`},{value:`fr-CH`,label:`French (Switzerland)`},{value:`de-DE`,label:`German (Germany)`},{value:`de-AT`,label:`German (Austria)`},{value:`de-CH`,label:`German (Switzerland)`},{value:`pt-BR`,label:`Portuguese (Brazil)`},{value:`pt-PT`,label:`Portuguese (Portugal)`},{value:`zh-CN`,label:`Chinese (Simplified, China)`},{value:`zh-TW`,label:`Chinese (Traditional, Taiwan)`},{value:`zh-HK`,label:`Chinese (Traditional, Hong Kong)`},{value:`ja-JP`,label:`Japanese (Japan)`},{value:`ko-KR`,label:`Korean (Korea)`},{value:`ar-SA`,label:`Arabic (Saudi Arabia)`},{value:`ar-EG`,label:`Arabic (Egypt)`},{value:`hi-IN`,label:`Hindi (India)`},{value:`ru-RU`,label:`Russian (Russia)`},{value:`it-IT`,label:`Italian (Italy)`},{value:`nl-NL`,label:`Dutch (Netherlands)`},{value:`nl-BE`,label:`Dutch (Belgium)`},{value:`pl-PL`,label:`Polish (Poland)`},{value:`sv-SE`,label:`Swedish (Sweden)`},{value:`no-NO`,label:`Norwegian (Norway)`},{value:`da-DK`,label:`Danish (Denmark)`},{value:`fi-FI`,label:`Finnish (Finland)`},{value:`tr-TR`,label:`Turkish (Turkey)`},{value:`el-GR`,label:`Greek (Greece)`},{value:`cs-CZ`,label:`Czech (Czech Republic)`},{value:`hu-HU`,label:`Hungarian (Hungary)`},{value:`ro-RO`,label:`Romanian (Romania)`},{value:`th-TH`,label:`Thai (Thailand)`},{value:`vi-VN`,label:`Vietnamese (Vietnam)`},{value:`id-ID`,label:`Indonesian (Indonesia)`},{value:`ms-MY`,label:`Malay (Malaysia)`},{value:`tl-PH`,label:`Tagalog (Philippines)`},{value:`he-IL`,label:`Hebrew (Israel)`},{value:`uk-UA`,label:`Ukrainian (Ukraine)`},{value:`bg-BG`,label:`Bulgarian (Bulgaria)`},{value:`hr-HR`,label:`Croatian (Croatia)`},{value:`sk-SK`,label:`Slovak (Slovakia)`},{value:`sl-SI`,label:`Slovenian (Slovenia)`},{value:`sr-RS`,label:`Serbian (Serbia)`},{value:`bn-BD`,label:`Bengali (Bangladesh)`},{value:`ta-IN`,label:`Tamil (India)`},{value:`te-IN`,label:`Telugu (India)`},{value:`mr-IN`,label:`Marathi (India)`},{value:`ur-PK`,label:`Urdu (Pakistan)`},{value:`fa-IR`,label:`Persian (Iran)`},{value:`sw-KE`,label:`Swahili (Kenya)`}];function Qje(){return Intl.supportedValuesOf(`timeZone`).map(e=>({value:e,label:e.replace(/_/g,` `)}))}var $je=Qje();function eMe(e,t){return(0,w.useMemo)(()=>e===`custom`?{maxWidth:t.width,maxHeight:t.height}:{maxWidth:xQ[e].width,maxHeight:xQ[e].height},[e,t])}function tMe({theme:e,displayMode:t,maxWidth:n,maxHeight:r,playground:i,deviceType:a,toolCallId:o,toolName:s,toolInput:c,toolOutput:l,toolMetadata:u,tool:d}){return(0,w.useMemo)(()=>({theme:e,displayMode:t,availableDisplayModes:[`inline`,`pip`,`fullscreen`],containerDimensions:{maxHeight:r,maxWidth:n},locale:i.locale,timeZone:i.timeZone,platform:a===`mobile`?`mobile`:`web`,userAgent:`mcp-use-inspector/0.16.2`,deviceCapabilities:i.capabilities,safeAreaInsets:i.safeAreaInsets,styles:{variables:{}},toolInfo:d?{id:o,tool:d}:void 0}),[e,t,r,n,i.locale,i.timeZone,i.capabilities,i.safeAreaInsets,a,o,s,c,l,u,d])}function nMe({title:e,onClose:t,className:n,testId:r}){return(0,S.jsxs)(`div`,{className:H(`fixed top-0 left-0 right-0 z-50 flex items-center justify-between px-4 py-3`,`bg-background/80 backdrop-blur-md border-b border-border`,`supports-[backdrop-filter]:bg-background/60`,n),children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`text-sm font-semibold text-foreground/80`,children:`MCP Inspector`})}),(0,S.jsx)(`div`,{className:`flex-1 text-center`,children:(0,S.jsx)(`h2`,{className:`text-sm font-medium text-foreground truncate max-w-md mx-auto`,children:e})}),(0,S.jsx)(`div`,{className:`flex items-center`,children:(0,S.jsxs)(`button`,{"data-testid":r,onClick:t,className:H(`flex items-center gap-2 px-3 py-1.5 rounded-md`,`text-sm font-medium`,`bg-background/50 hover:bg-background/80`,`border border-border hover:border-border/80`,`transition-colors`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),"aria-label":`Exit Fullscreen`,children:[(0,S.jsx)(Fp,{className:`w-4 h-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Exit Fullscreen`})]})})]})}var rMe=(0,w.forwardRef)(function({html:e,sandbox:t=A7,csp:n,permissions:r,permissive:i,onProxyReady:a,onLoad:o,onMessage:s,className:c,style:l,title:u=`Sandboxed Content`},d){let f=(0,w.useRef)(null),[p,m]=(0,w.useState)(!1),[h]=(0,w.useState)(()=>{let e=window.location.hostname,t=window.location.port,n=window.location.protocol,r=window.__MCP_SANDBOX_ORIGIN__;if(r)return`${r}/inspector/api/mcp-apps/sandbox-proxy?v=${Date.now()}`;let i,a=window.__MCP_DEV_MODE__===!0;i=e===`localhost`||e===`127.0.0.1`||a?e:e.startsWith(`dev.`)?`sandbox-inspector.dev.${e.slice(4)}`:e.startsWith(`inspector.`)?`sandbox-${e}`:`sandbox-inspector.${e}`;let o=t?`:${t}`:``;return`${n}//${i}${o}/inspector/api/mcp-apps/sandbox-proxy?v=${Date.now()}`}),g=(0,w.useMemo)(()=>{try{return new URL(h).origin}catch{return`*`}},[h]);(0,w.useImperativeHandle)(d,()=>({postMessage:e=>{f.current?.contentWindow?.postMessage(e,g)},getIframeElement:()=>f.current}),[g]);let _=(0,w.useCallback)(e=>{if(!(e.origin!==g&&g!==`*`)&&e.source===f.current?.contentWindow){if(e.data?.method===`ui/notifications/sandbox-proxy-ready`||e.data?.type===`sandbox-proxy-ready`){console.log(`[SandboxedIframe] Sandbox proxy ready`),m(!0),a?.();return}s(e)}},[g,a,s]);return(0,w.useEffect)(()=>(window.addEventListener(`message`,_),()=>window.removeEventListener(`message`,_)),[_]),(0,w.useEffect)(()=>{!p||!e||!f.current?.contentWindow||f.current.contentWindow.postMessage({jsonrpc:`2.0`,method:`ui/notifications/sandbox-resource-ready`,params:{html:e,sandbox:t,csp:n,permissions:r,permissive:i}},g)},[p,e,t,n,r,i,g]),(0,S.jsx)(`iframe`,{ref:f,src:h,className:c,style:l,title:u,sandbox:t,allow:`web-share`,onLoad:o})});function M7({children:e,className:t,noWrapper:n}){return n?e:(0,S.jsx)(`div`,{className:H(`bg-zinc-100 flex flex-1 items-center justify-center dark:bg-zinc-900 bg-[radial-gradient(circle,_rgba(0,0,0,0.2)_1px,_transparent_1px)] dark:bg-[radial-gradient(circle,_rgba(255,255,255,0.2)_1px,_transparent_1px)] bg-[length:32px_32px]`,t),children:e})}function iMe(e){let t=e=>e.replace(/['"<>;]/g,``).trim(),n=(e.connectDomains||[]).map(t).filter(Boolean),r=(e.resourceDomains||[]).map(t).filter(Boolean),i=(e.frameDomains||[]).map(t).filter(Boolean),a=(e.baseUriDomains||[]).map(t).filter(Boolean),o=n.length>0?n.join(` `):`'none'`,s=r.length>0?[`data:`,`blob:`,...r].join(` `):`data: blob:`,c=i.length>0?i.join(` `):`'none'`,l=a.length>0?a.join(` `):`'none'`;return[`default-src 'none'`,`script-src 'unsafe-inline' ${s}`,`style-src 'unsafe-inline' ${s}`,`img-src ${s}`,`font-src ${s}`,`media-src ${s}`,`connect-src ${o}`,`frame-src ${c}`,`object-src 'none'`,`base-uri ${l}`].join(`; `)}function aMe({serverId:e,toolCallId:t,toolName:n,toolInput:r,toolOutput:i,toolMetadata:a,invoking:o,invoked:s,partialToolInput:c,resourceUri:l,readResource:u,onSendFollowUp:d,className:f,displayMode:p,onDisplayModeChange:m,noWrapper:h,customProps:g,cancelled:_,onRerun:v,onReady:y,chromeless:b,inlineWidthOverride:x}){let C=(0,w.useRef)(null),T=(0,w.useRef)(null),{resolvedTheme:E}=FP(),{servers:D}=uj(),O=D.find(t=>t.id===e),{playground:k,addWidget:A,removeWidget:j,addCspViolation:M,setWidgetModelContext:N,setWidgetDeclaredCsp:P}=bQ(),[F,I]=(0,w.useState)(0),[L,ee]=(0,w.useState)(null),[te,ne]=(0,w.useState)(null),[re,R]=(0,w.useState)(!1),[z,B]=(0,w.useState)(!0),ie=(0,w.useRef)(!1),ae=(0,w.useRef)(null),oe=(0,w.useRef)(null),se=(0,w.useRef)(null),ce=(0,w.useRef)(0),le=(0,w.useRef)(void 0),ue=(0,w.useRef)(r),de=(0,w.useRef)(i),fe=(0,w.useRef)(g),pe=(0,w.useRef)(u),me=(0,w.useRef)(O),he=(0,w.useRef)(null);ue.current=r,de.current=i,fe.current=g,pe.current=u,me.current=O;let[ge,_e]=(0,w.useState)(void 0),[ve,ye]=(0,w.useState)(void 0),[be,xe]=(0,w.useState)(!1),[Se,Ce]=(0,w.useState)(`inline`),we=p??Se,Te=(0,w.useRef)(we);Te.current=we;let[Ee,De]=(0,w.useState)(j7.DIMENSIONS.DEFAULT_HEIGHT),Oe=(0,w.useRef)(null),ke=k.cspMode,Ae=k.deviceType,je=k.customViewport,{maxWidth:Me,maxHeight:Ne}=eMe(Ae,je),Pe=x??(Ae===`mobile`?Me:768),Fe=tMe({theme:E,displayMode:we,maxWidth:Me,maxHeight:Ne,playground:k,deviceType:Ae,toolCallId:t,toolName:n,toolInput:r,toolOutput:i,toolMetadata:a,tool:(0,w.useMemo)(()=>{if(O?.tools)return O.tools.find(e=>e.name===n)},[O,n])});(0,w.useEffect)(()=>{(async()=>{try{let o=await u(l),s=o?.contents?.[0],c=s?.mimeType,d=s?._meta,f=(O?.resources?.find(e=>e.uri===l))?._meta?.ui,p=d?.ui,m=f||p?{...f,...p}:void 0,h=m?.csp;if(!h&&a?.[`openai/widgetCSP`]){let e=a[`openai/widgetCSP`],t={};Array.isArray(e.connect_domains)&&(t.connectDomains=e.connect_domains),Array.isArray(e.resource_domains)&&(t.resourceDomains=e.resource_domains),Array.isArray(e.frame_domains)&&(t.frameDomains=e.frame_domains),Array.isArray(e.base_uri_domains)&&(t.baseUriDomains=e.base_uri_domains),Array.isArray(e.script_directives)&&(t.scriptDirectives=e.script_directives),Object.keys(t).length>0&&(h=t)}let g=m?.permissions,_=m?.prefersBorder??!1,v=await fetch(j7.API_ENDPOINTS.WIDGET_STORE,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverId:e,uri:l,toolInput:r,toolOutput:i,toolId:t,toolName:n,theme:E,protocol:`mcp-apps`,cspMode:ke,resourceData:o,mimeType:c,mcpAppsCsp:h,mcpAppsPermissions:g})});if(!v.ok)throw Error(`Failed to store widget: ${v.statusText}`);let y=j7.API_ENDPOINTS.WIDGET_CONTENT(t),b=await fetch(`${y}?csp_mode=${ke}`);if(!b.ok){let e=await b.json().catch(()=>({}));throw Error(e.error||`Failed to fetch widget: ${b.statusText}`)}let{html:x,csp:S,permissions:C,mimeTypeWarning:w,mimeTypeValid:T}=await b.json();if(!T){ee(w||`Invalid MIME type - SEP-1865 requires "text/html;profile=mcp-app"`);return}ne(x),R(!1),ie.current||B(!0),_e(S),ye(C),xe(_),A(t,{toolName:n,protocol:`mcp-apps`,hostContext:Fe});let D=S??h,k=D&&typeof D==`object`?{connectDomains:D.connectDomains,resourceDomains:D.resourceDomains,frameDomains:D.frameDomains,baseUriDomains:D.baseUriDomains}:void 0,j;ke===`permissive`?j=[`default-src * 'unsafe-inline' 'unsafe-eval' data: blob: filesystem: about:`,`script-src * 'unsafe-inline' 'unsafe-eval' data: blob:`,`style-src * 'unsafe-inline' data: blob:`,`img-src * data: blob: https: http:`,`media-src * data: blob: https: http:`,`font-src * data: blob: https: http:`,`connect-src * data: blob: https: http: ws: wss: about:`,`frame-src * data: blob: https: http: about:`,`object-src * data: blob:`,`base-uri *`,`form-action *`].join(`; `):k&&(j=iMe(k)),P(t,k,j)}catch(e){ee(e instanceof Error?e.message:`Failed to prepare widget`)}})()},[e,l,t,n]);let Ie=(0,w.useRef)(ke);(0,w.useEffect)(()=>{Ie.current!==ke&&(Ie.current=ke,ie.current&&v&&v())},[ke,v]),(0,w.useEffect)(()=>{if(F<=1)return;let e=!1;return(async()=>{try{let t=await u(l);if(e)return;let n=t?.contents?.[0]?._meta?.ui;n&&`prefersBorder`in n&&xe(n.prefersBorder??!1)}catch{}})(),()=>{e=!0}},[F,l,u]),(0,w.useEffect)(()=>{if(!te||!C.current)return;let e=C.current.getIframeElement();if(!e?.contentWindow)return;I(0);let n={sessionId:void 0,async start(){},async send(e){C.current?.postMessage(e),Yje.publish({serverId:`widget-${t}`,direction:`send`,timestamp:new Date().toISOString(),message:e})},async close(){},onmessage:void 0,onerror:void 0,onclose:void 0},r=new Kje(null,{name:`mcp-use-inspector`,version:`0.16.2`},{openLinks:{},serverTools:{},serverResources:{},logging:{},sandbox:{csp:ke===`permissive`?void 0:ge,permissions:ve}},{hostContext:Fe});r.oninitialized=()=>{let e=Date.now();if(ce.current>0&&e-ce.current<2e3){clearTimeout(le.current),le.current=setTimeout(()=>{let e=fe.current,t={};if(e)for(let[n,r]of Object.entries(e))if(typeof r==`string`&&(r.trim().startsWith(`[`)||r.trim().startsWith(`{`)))try{t[n]=JSON.parse(r)}catch{t[n]=r}else t[n]=r;let n={...ue.current,...t};r.sendToolInput({arguments:n});let i=de.current;i&&r.sendToolResult(i)},300);return}ce.current=e,I(e=>e+1)},r.onmessage=async({content:e})=>(e.length>0&&d&&d(e),{}),r.onopenlink=async({url:e})=>(e&&window.open(e,`_blank`,`noopener,noreferrer`),{}),r.oncalltool=async({name:e,arguments:t})=>{let n=me.current;if(!n)throw Error(`Server connection not available`);try{return await n.callTool(e,t||{},{timeout:j7.TIMEOUTS.TOOL_CALL,resetTimeoutOnProgress:!0})}catch(e){throw r.sendToolCancelled({reason:e instanceof Error?e.message:String(e)}),e}},r.onreadresource=async({uri:e})=>(await pe.current(e)).contents||[],r.onlistresources=async()=>{let e=me.current;if(!e)throw Error(`Server connection not available`);return{resources:e.resources}},r.onrequestdisplaymode=async({mode:e})=>{let t=e??`inline`;return m?m(t):Ce(t),{mode:t}},r.onupdatemodelcontext=async({content:e,structuredContent:n})=>{N(t,{content:e,structuredContent:n});try{localStorage.setItem(`mcp-use:widget-state:${t}`,JSON.stringify(n))}catch{}return{}},r.onloggingmessage=async({level:e,logger:n,data:r})=>{if(Xje.publish({level:e,args:Array.isArray(r)?r:[r],timestamp:new Date().toISOString(),url:l}),e===`error`&&typeof window<`u`&&window.parent!==window){let e=typeof r==`string`?r:typeof r?.message==`string`?String(r.message):`MCP Apps runtime error`,n=typeof r?.stack==`string`?String(r.stack):void 0;window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`mcp-apps:logging`,message:e,stack:n,timestamp:Date.now(),toolId:t,url:l},`*`)}return{}},r.onsizechange=({height:t})=>{if(Te.current!==`inline`)return;let n=e;if(!n||t===void 0)return;let r=getComputedStyle(n),i=r.boxSizing===`border-box`,a=t;i&&(a+=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth));let o={height:`${n.offsetHeight}px`},s={height:`${a}px`};n.style.height=`${a}px`,De(a),n.animate([o,s],{duration:300,easing:`ease-out`})},T.current=r;let i=!0;r.connect(n).catch(e=>{i&&ee(e instanceof Error?e.message:`Failed to connect MCP App`)});let a=r=>{let i=new URL(e.src).origin;if(r.origin===i&&r.source===e.contentWindow){if(r.data?.type===`iframe-console-log`){if(r.data.level===`error`&&typeof window<`u`&&window.parent!==window){let e=(Array.isArray(r.data.args)?r.data.args:[])[0],n=typeof e==`string`?e:typeof e?.message==`string`?e.message:`MCP Apps iframe runtime error`,i=typeof e?.error?.stack==`string`?e.error.stack:typeof e?.stack==`string`?e.stack:void 0;window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`mcp-apps:iframe-console:error`,message:n,stack:i,timestamp:Date.now(),toolId:t,url:typeof r.data.url==`string`?r.data.url:l},`*`)}return}Yje.publish({serverId:`widget-${t}`,direction:`receive`,timestamp:new Date().toISOString(),message:r.data}),n.onmessage&&r.data&&n.onmessage(r.data)}};return window.addEventListener(`message`,a),()=>{ce.current=0,clearTimeout(le.current),i=!1,window.removeEventListener(`message`,a),r&&(async()=>{try{await Promise.race([r.teardownResource({}),new Promise((e,t)=>setTimeout(()=>t(Error(`teardown timeout`)),2e3))])}catch{}finally{r.close().catch(()=>{})}})(),T.current=null,he.current=null,j(t)}},[te,C,t]),(0,w.useEffect)(()=>{let e=T.current;if(!e||F===0)return;let t=JSON.stringify(Fe);he.current!==t&&(he.current=t,e.setHostContext(Fe))},[Fe,F]),(0,w.useEffect)(()=>{let e=T.current;!e||F===0||!c||e.sendToolInputPartial({arguments:c})},[F,c]),(0,w.useEffect)(()=>{let e=T.current;if(!e||F===0)return;let n={};if(g)for(let[e,t]of Object.entries(g))if(typeof t==`string`&&(t.trim().startsWith(`[`)||t.trim().startsWith(`{`)))try{n[e]=JSON.parse(t)}catch{n[e]=t}else n[e]=t;let i={...r,...n},a=JSON.stringify(i),o=`${t}:${F}`;if(!(ae.current===o&&oe.current===a))if(c){let t=requestAnimationFrame(()=>{e.sendToolInput({arguments:i}),ae.current=o,oe.current=a});return()=>cancelAnimationFrame(t)}else e.sendToolInput({arguments:i}),ae.current=o,oe.current=a},[F,r,g,t,c]),(0,w.useEffect)(()=>{let e=T.current;if(!(!e||F===0)&&i){let t=JSON.stringify({content:i?.structuredContent??i,customProps:g??null});if(se.current===t)return;se.current=t;let n=i;if(g&&Object.keys(g).length>0){let t={};for(let[e,n]of Object.entries(g))if(typeof n==`string`&&(n.trim().startsWith(`[`)||n.trim().startsWith(`{`)))try{t[e]=JSON.parse(n)}catch{t[e]=n}else t[e]=n;e.sendToolResult({...n,structuredContent:t})}else e.sendToolResult(n)}},[F,i,t,g]),(0,w.useEffect)(()=>{let e=T.current;!e||F===0||!_||e.sendToolCancelled({reason:`Cancelled by user`})},[_,F]);let Le=(0,w.useCallback)(e=>{if(e.data?.type!==`mcp-apps:csp-violation`)return;let{directive:n,blockedUri:r,sourceFile:i,lineNumber:a,columnNumber:o,effectiveDirective:s,originalPolicy:c,timestamp:l}=e.data;M(t,{directive:n,effectiveDirective:s,blockedUri:r,sourceFile:i,lineNumber:a,columnNumber:o,originalPolicy:c,timestamp:l||Date.now()}),console.warn(`[MCP Apps CSP Violation] ${n}: Blocked ${r}`,i?`at ${i}:${a}:${o}`:``)},[t,M]);(0,w.useEffect)(()=>{let e=()=>{!document.fullscreenElement&&we===`fullscreen`&&(m?m(`inline`):Ce(`inline`))};return document.addEventListener(`fullscreenchange`,e),()=>{document.removeEventListener(`fullscreenchange`,e)}},[we,m]);let Re=(0,w.useCallback)(async e=>{try{e===`fullscreen`?Oe.current&&await Oe.current.requestFullscreen():document.fullscreenElement&&await document.exitFullscreen(),m?m(e):Ce(e)}catch(t){console.error(`[MCPAppsRenderer] Display mode error:`,t),m?m(e):Ce(e)}},[m]),ze=re||F>0,Be=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{Be.current||F>0&&(Be.current=!0,y?.())},[F,y]),(0,w.useEffect)(()=>{if(!ze||!z)return;let e=setTimeout(()=>{B(!1),ie.current=!0},300);return()=>clearTimeout(e)},[ze,z]),L)return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsx)(`div`,{className:`border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4`,children:(0,S.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:[`Failed to load MCP App: `,L]})})});if(!te)return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})})});let Ve=we===`pip`,He=we===`fullscreen`,Ue=He?`fixed inset-0 z-40 w-full h-full bg-background flex flex-col`:Ve?[`fixed top-4 left-1/2 -translate-x-1/2 z-50 rounded-3xl w-full min-w-[300px] h-[400px]`,`shadow-2xl border overflow-hidden`,`bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`].join(` `):`flex group flex-1 items-center justify-center`,We={height:He||Ve?`100%`:`${Ee}px`,width:`100%`,maxWidth:we===`inline`?`${Pe}px`:`100%`,transition:He||Ve?void 0:`height 300ms ease-out`};return(0,S.jsx)(M7,{className:f,noWrapper:h,children:(0,S.jsxs)(`div`,{ref:Oe,className:Ue,style:Ve?{maxWidth:j7.DIMENSIONS.PIP_MAX_WIDTH}:void 0,children:[He&&!b&&(0,S.jsx)(nMe,{title:n,onClose:()=>Re(`inline`),testId:`debugger-exit-fullscreen-button`}),Ve&&(0,S.jsx)(`button`,{"data-testid":`debugger-exit-pip-button`,onClick:()=>Re(`inline`),className:`absolute left-2 top-2 z-30 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 hover:bg-background border border-zinc-200 dark:border-zinc-700 text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors cursor-pointer`,"aria-label":`Close PiP mode`,title:`Close PiP mode`,children:(0,S.jsx)(Fp,{className:`w-4 h-4`})}),(0,S.jsxs)(`div`,{className:H(`flex-1 w-full h-full flex justify-center items-center relative`,He&&!b&&`pt-14`,!Ve&&!He&&(o||s)&&`pt-8`),children:[z&&(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full z-10`,children:(0,S.jsx)(zq,{className:`size-5`})}),(0,S.jsxs)(`div`,{className:`relative w-full h-full`,style:{maxWidth:We.maxWidth},children:[(0,S.jsx)(`div`,{className:`absolute -top-8 left-2 z-10 h-full`,children:!Ve&&!He&&(o||s)&&(0,S.jsxs)(`div`,{className:`whitespace-nowrap`,children:[o&&!i&&(0,S.jsx)(jY,{className:`text-xs `,children:o}),s&&!!i&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s})]})}),(0,S.jsx)(rMe,{ref:C,html:te,sandbox:A7,csp:ge,permissions:ve,permissive:ke===`permissive`,onLoad:()=>R(!0),onMessage:Le,title:`MCP App: ${n}`,className:H(we===`inline`&&`w-full`,we===`fullscreen`&&`w-full h-full rounded-none`,we===`pip`&&`w-full h-full`,we!==`fullscreen`&&be&&`rounded-lg`,`overflow-hidden`,be&&`border border-zinc-200 dark:border-zinc-700`),style:We}),` `]})]})]})})}function oMe(e,t){for(let n of[`serverId`,`toolCallId`,`toolName`,`resourceUri`,`displayMode`,`cancelled`,`noWrapper`])if(e[n]!==t[n])return!1;return!(e.toolInput!==t.toolInput||e.toolOutput!==t.toolOutput||e.toolMetadata!==t.toolMetadata||e.partialToolInput!==t.partialToolInput||e.customProps!==t.customProps||e.readResource!==t.readResource||e.onSendFollowUp!==t.onSendFollowUp||e.onRerun!==t.onRerun||e.onReady!==t.onReady||e.chromeless!==t.chromeless||e.inlineWidthOverride!==t.inlineWidthOverride||e.onDisplayModeChange!==t.onDisplayModeChange||e.className!==t.className||e.serverBaseUrl!==t.serverBaseUrl||e.invoking!==t.invoking||e.invoked!==t.invoked)}var N7=(0,w.memo)(aMe,oMe),sMe=`
|
|
638
638
|
(function() {
|
|
639
639
|
'use strict';
|
|
640
640
|
|
|
@@ -756,7 +756,7 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
756
756
|
});
|
|
757
757
|
})();
|
|
758
758
|
`;function cMe(e){if(!e.contentWindow)return;let t=()=>{try{let t=e.contentWindow?.document;if(!t||t.querySelector(`script[data-console-interceptor]`))return;let n=t.createElement(`script`);n.setAttribute(`data-console-interceptor`,`true`),n.textContent=sMe;let r=t.head||t.body||t.documentElement;r&&r.insertBefore(n,r.firstChild)}catch(e){e instanceof Error&&e.name!==`SecurityError`&&console.warn(`[IframeConsole] Failed to inject console interceptor:`,e)}};try{let n=e.contentDocument;if(n?.readyState===`complete`||n?.readyState===`interactive`)t();else{let n=()=>{t(),e.removeEventListener(`load`,n)};e.addEventListener(`load`,n,{once:!0}),setTimeout(()=>{try{(e.contentDocument?.readyState===`complete`||e.contentDocument?.readyState===`interactive`)&&t()}catch{}},100)}}catch{}}var lMe=e=>`mcp-inspector-resource-props-${e}`;function uMe(e){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(null);return(0,w.useEffect)(()=>{(()=>{try{let t=lMe(e),r=localStorage.getItem(t);if(r){let e=JSON.parse(r);n(e.presets||[]),i(e.activePresetId||null)}else n([]),i(null)}catch(e){console.error(`[useResourceProps] Failed to load presets:`,e),n([]),i(null)}})()},[e]),(0,w.useEffect)(()=>{let n=lMe(e),i={presets:t,activePresetId:r};localStorage.setItem(n,JSON.stringify(i))},[e,t,r]),{presets:t,activePresetId:r,savePreset:(0,w.useCallback)(e=>{n(t=>{let n=t.findIndex(t=>t.id===e.id),r;return n>=0?(r=[...t],r[n]=e):r=[...t,e],r})},[]),deletePreset:(0,w.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e)),i(t=>t===e?null:t)},[]),setActivePreset:(0,w.useCallback)(e=>{i(e)},[]),getActiveProps:(0,w.useCallback)(()=>r&&t.find(e=>e.id===r)?.props||null,[r,t])}}function dMe(e={}){let{enabled:t=!0,maxLogs:n=1e3,proxyToPageConsole:r=!1}=e,[i,a]=(0,w.useState)([]),[o,s]=(0,w.useState)(!1),c=(0,w.useRef)(0),l=(0,w.useCallback)(e=>{if(!t)return;let i={...e,id:`log-${++c.current}-${Date.now()}`};if(a(e=>[...e,i].slice(-n)),r){let t=`[WIDGET CONSOLE]`,n=e.args.map(e=>{if(typeof e==`object`&&e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return e});switch(e.level){case`error`:console.error(t,...n);break;case`warn`:console.warn(t,...n);break;case`info`:console.info(t,...n);break;case`debug`:console.debug(t,...n);break;case`trace`:console.trace(t,...n);break;default:console.log(t,...n)}}},[t,n,r]),u=(0,w.useCallback)(()=>{a([]),c.current=0},[]);return(0,w.useEffect)(()=>{if(!t)return;let e=e=>{e.data&&e.data.type===`iframe-console-log`&&e.data.level&&Array.isArray(e.data.args)&&l({level:e.data.level,args:e.data.args,timestamp:e.data.timestamp||new Date().toISOString(),url:e.data.url})};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[t,l]),(0,w.useEffect)(()=>{if(t)return Xje.subscribe(l)},[t,l]),{logs:i,addLog:l,clearLogs:u,isOpen:o,setIsOpen:s}}var fMe=200,pMe=.9;function P7(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function mMe({level:e}){return(0,S.jsx)(`span`,{className:H(`px-1.5 py-0.5 text-[11px] font-mono font-semibold rounded-full text-white shrink-0`,{log:`bg-zinc-500`,info:`bg-blue-500`,warn:`bg-yellow-500`,error:`bg-red-500`,debug:`bg-purple-500`,trace:`bg-gray-500`}[e]),children:e.toUpperCase()})}function hMe({log:e}){let[t,n]=(0,w.useState)(!1),r=(0,w.useMemo)(()=>{try{return new Date(e.timestamp).toLocaleTimeString()}catch{return``}},[e.timestamp]),i=(0,w.useMemo)(()=>{if(e.args.length===0)return``;let t=P7(e.args[0]).replace(/\s*\n\s*/g,` `).trim();return(t.length>120?t.slice(0,120)+`…`:t)+(e.args.length>1?` +${e.args.length-1}`:``)},[e.args]),a=async t=>{t.stopPropagation();try{await dj(e.args.map(P7).join(`
|
|
759
|
-
`)),PM.success(`Copied to clipboard`)}catch{PM.error(`Failed to copy`)}},o=H(`font-mono text-xs border-b border-zinc-200 dark:border-zinc-800`,e.level===`error`&&`bg-red-50/30 dark:bg-red-950/10`,e.level===`warn`&&`bg-yellow-50/30 dark:bg-yellow-950/10`),s=H(`cursor-pointer select-none`,e.level===`error`&&`hover:bg-red-50/50 dark:hover:bg-red-950/20`,e.level===`warn`&&`hover:bg-yellow-50/50 dark:hover:bg-yellow-950/20`,e.level!==`error`&&e.level!==`warn`&&`hover:bg-zinc-100/70 dark:hover:bg-zinc-800/40`);return(0,S.jsxs)(`div`,{className:H(o,`group`),children:[(0,S.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 py-1.5`,s),onClick:()=>n(e=>!e),children:[(0,S.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-500 shrink-0`,children:t?(0,S.jsx)(yf,{className:`size-3`}):(0,S.jsx)(xf,{className:`size-3`})}),(0,S.jsx)(mMe,{level:e.level}),(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400 text-[10px] shrink-0`,children:r}),!t&&(0,S.jsx)(`span`,{className:H(`truncate text-[11px]`,e.level===`error`&&`text-red-700 dark:text-red-400`,e.level===`warn`&&`text-yellow-700 dark:text-yellow-400`,e.level!==`error`&&e.level!==`warn`&&`text-zinc-700 dark:text-zinc-300`),children:i}),t&&e.url&&(0,S.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-500 text-[10px] truncate flex-1`,children:(()=>{try{return new URL(e.url).pathname}catch{return e.url}})()}),t&&(0,S.jsx)(`button`,{onClick:a,"aria-label":`Copy log`,className:`ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200`,children:(0,S.jsx)(jf,{className:`size-3`})})]}),t&&(0,S.jsx)(`div`,{className:`pl-8 pr-2 pb-2 select-text`,children:e.args.map((t,n)=>(0,S.jsx)(`pre`,{className:H(`whitespace-pre-wrap wrap-break-word text-[11px]`,e.level===`error`&&`text-red-700 dark:text-red-400`,e.level===`warn`&&`text-yellow-700 dark:text-yellow-400`,e.level!==`error`&&e.level!==`warn`&&`text-zinc-700 dark:text-zinc-300`),children:P7(t)},n))})]})}var gMe=`mcp-inspector-console-proxy-enabled`,_Me=`mcp-inspector-console-height`,vMe=[`log`,`info`,`warn`,`error`,`debug`,`trace`],yMe={log:`text-zinc-500`,info:`text-blue-500`,warn:`text-yellow-500`,error:`text-red-500`,debug:`text-purple-500`,trace:`text-gray-500`};function bMe({iframeId:e,enabled:t=!0}){let[n,r]=(0,w.useState)(()=>{if(typeof window>`u`)return!0;try{return localStorage.getItem(gMe)===`true`}catch{return!0}}),[i,a]=(0,w.useState)(()=>{if(typeof window>`u`)return 400;try{let e=localStorage.getItem(_Me);return e?Math.max(fMe,parseInt(e,10)):400}catch{return 400}}),o=(0,w.useRef)(!1),s=(0,w.useCallback)(e=>{e.preventDefault(),o.current=!0;let t=e=>{if(!o.current)return;let t=Math.floor(window.innerHeight*pMe);a(Math.min(t,Math.max(fMe,window.innerHeight-e.clientY)))},n=()=>{o.current=!1,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[]);(0,w.useEffect)(()=>{try{localStorage.setItem(_Me,String(i))}catch{}},[i]);let[c,l]=(0,w.useState)(`all`),[u,d]=(0,w.useState)(``),{logs:f,clearLogs:p,isOpen:m,setIsOpen:h}=dMe({enabled:t,proxyToPageConsole:n}),g=(0,w.useRef)(null);(0,w.useEffect)(()=>{try{localStorage.setItem(gMe,String(n))}catch{}},[n]);let _=(0,w.useMemo)(()=>{let e={log:0,info:0,warn:0,error:0,debug:0,trace:0};for(let t of f)e[t.level]++;return e},[f]),v=_.error,y=_.warn,b=_.log+_.info+_.debug+_.trace,x=f.length,C=(0,w.useMemo)(()=>v>0?`bg-red-500`:y>0?`bg-yellow-500`:`bg-zinc-500`,[v,y,b]),T=(0,w.useMemo)(()=>{let e=c===`all`?f:f.filter(e=>e.level===c),t=u.trim().toLowerCase();return t&&(e=e.filter(e=>{let n=e.args.map(P7).join(` `).toLowerCase(),r=(e.url??``).toLowerCase();return n.includes(t)||r.includes(t)})),e},[f,c,u]);return(0,w.useEffect)(()=>{m&&!u&&g.current&&(g.current.scrollTop=g.current.scrollHeight)},[T,m,u]),(0,S.jsxs)(
|
|
759
|
+
`)),PM.success(`Copied to clipboard`)}catch{PM.error(`Failed to copy`)}},o=H(`font-mono text-xs border-b border-zinc-200 dark:border-zinc-800`,e.level===`error`&&`bg-red-50/30 dark:bg-red-950/10`,e.level===`warn`&&`bg-yellow-50/30 dark:bg-yellow-950/10`),s=H(`cursor-pointer select-none`,e.level===`error`&&`hover:bg-red-50/50 dark:hover:bg-red-950/20`,e.level===`warn`&&`hover:bg-yellow-50/50 dark:hover:bg-yellow-950/20`,e.level!==`error`&&e.level!==`warn`&&`hover:bg-zinc-100/70 dark:hover:bg-zinc-800/40`);return(0,S.jsxs)(`div`,{className:H(o,`group`),children:[(0,S.jsxs)(`div`,{className:H(`flex items-center gap-2 px-2 py-1.5`,s),onClick:()=>n(e=>!e),children:[(0,S.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-500 shrink-0`,children:t?(0,S.jsx)(yf,{className:`size-3`}):(0,S.jsx)(xf,{className:`size-3`})}),(0,S.jsx)(mMe,{level:e.level}),(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400 text-[10px] shrink-0`,children:r}),!t&&(0,S.jsx)(`span`,{className:H(`truncate text-[11px]`,e.level===`error`&&`text-red-700 dark:text-red-400`,e.level===`warn`&&`text-yellow-700 dark:text-yellow-400`,e.level!==`error`&&e.level!==`warn`&&`text-zinc-700 dark:text-zinc-300`),children:i}),t&&e.url&&(0,S.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-500 text-[10px] truncate flex-1`,children:(()=>{try{return new URL(e.url).pathname}catch{return e.url}})()}),t&&(0,S.jsx)(`button`,{onClick:a,"aria-label":`Copy log`,className:`ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200`,children:(0,S.jsx)(jf,{className:`size-3`})})]}),t&&(0,S.jsx)(`div`,{className:`pl-8 pr-2 pb-2 select-text`,children:e.args.map((t,n)=>(0,S.jsx)(`pre`,{className:H(`whitespace-pre-wrap wrap-break-word text-[11px]`,e.level===`error`&&`text-red-700 dark:text-red-400`,e.level===`warn`&&`text-yellow-700 dark:text-yellow-400`,e.level!==`error`&&e.level!==`warn`&&`text-zinc-700 dark:text-zinc-300`),children:P7(t)},n))})]})}var gMe=`mcp-inspector-console-proxy-enabled`,_Me=`mcp-inspector-console-height`,vMe=[`log`,`info`,`warn`,`error`,`debug`,`trace`],yMe={log:`text-zinc-500`,info:`text-blue-500`,warn:`text-yellow-500`,error:`text-red-500`,debug:`text-purple-500`,trace:`text-gray-500`};function bMe({iframeId:e,enabled:t=!0}){let[n,r]=(0,w.useState)(()=>{if(typeof window>`u`)return!0;try{return localStorage.getItem(gMe)===`true`}catch{return!0}}),[i,a]=(0,w.useState)(()=>{if(typeof window>`u`)return 400;try{let e=localStorage.getItem(_Me);return e?Math.max(fMe,parseInt(e,10)):400}catch{return 400}}),o=(0,w.useRef)(!1),s=(0,w.useCallback)(e=>{e.preventDefault(),o.current=!0;let t=e=>{if(!o.current)return;let t=Math.floor(window.innerHeight*pMe);a(Math.min(t,Math.max(fMe,window.innerHeight-e.clientY)))},n=()=>{o.current=!1,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[]);(0,w.useEffect)(()=>{try{localStorage.setItem(_Me,String(i))}catch{}},[i]);let[c,l]=(0,w.useState)(`all`),[u,d]=(0,w.useState)(``),{logs:f,clearLogs:p,isOpen:m,setIsOpen:h}=dMe({enabled:t,proxyToPageConsole:n}),g=(0,w.useRef)(null);(0,w.useEffect)(()=>{try{localStorage.setItem(gMe,String(n))}catch{}},[n]);let _=(0,w.useMemo)(()=>{let e={log:0,info:0,warn:0,error:0,debug:0,trace:0};for(let t of f)e[t.level]++;return e},[f]),v=_.error,y=_.warn,b=_.log+_.info+_.debug+_.trace,x=f.length,C=(0,w.useMemo)(()=>v>0?`bg-red-500`:y>0?`bg-yellow-500`:`bg-zinc-500`,[v,y,b]),T=(0,w.useMemo)(()=>{let e=c===`all`?f:f.filter(e=>e.level===c),t=u.trim().toLowerCase();return t&&(e=e.filter(e=>{let n=e.args.map(P7).join(` `).toLowerCase(),r=(e.url??``).toLowerCase();return n.includes(t)||r.includes(t)})),e},[f,c,u]);return(0,w.useEffect)(()=>{m&&!u&&g.current&&(g.current.scrollTop=g.current.scrollHeight)},[T,m,u]),(0,S.jsxs)(pQ,{open:m,onOpenChange:h,children:[(0,S.jsx)(mQ,{asChild:!0,children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(U,{variant:`outline`,size:`sm`,className:`relative bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>h(!0),children:[(0,S.jsx)(jp,{className:`size-4`}),x>0&&(0,S.jsx)(`span`,{className:H(`ml-2 px-1.5 py-0.5 text-xs rounded-full text-white font-semibold`,C),children:x})]})}),(0,S.jsx)(jd,{children:(0,S.jsxs)(`div`,{className:`text-xs space-y-1`,children:[(0,S.jsxs)(`p`,{className:`font-semibold`,children:[x,` console `,x===1?`log`:`logs`]}),v>0&&(0,S.jsxs)(`p`,{className:`text-red-400`,children:[v,` error`,v===1?``:`s`]}),y>0&&(0,S.jsxs)(`p`,{className:`text-yellow-400`,children:[y,` warning`,y===1?``:`s`]}),b>0&&(0,S.jsxs)(`p`,{className:`text-zinc-400`,children:[b,` info`]})]})})]})}),(0,S.jsxs)(hQ,{side:`bottom`,className:`flex flex-col p-0 transition-none m-0 gap-0`,style:{height:i},children:[(0,S.jsx)(`div`,{className:`h-1.5 w-full shrink-0 cursor-ns-resize bg-zinc-200 dark:bg-zinc-700 hover:bg-zinc-300 dark:hover:bg-zinc-600 transition-colors`,onMouseDown:s}),(0,S.jsxs)(gQ,{className:`px-4 py-4 m-0 border-b border-zinc-200 dark:border-zinc-800 shrink-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(_Q,{className:`flex items-center gap-2`,children:[(0,S.jsx)(jp,{className:`size-4`}),`Widget Console Logs`,f.length>0&&(0,S.jsxs)(`span`,{className:`text-sm font-normal text-zinc-500 dark:text-zinc-400`,children:[`(`,f.length,` `,f.length===1?`log`:`logs`,`)`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-4 pr-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(MP,{id:`proxy-console-toggle`,checked:n,onCheckedChange:r}),(0,S.jsx)(ON,{htmlFor:`proxy-console-toggle`,className:`text-sm font-normal cursor-pointer`,children:`Proxy logs to page console`})]}),f.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:async()=>{try{await dj(T.map(e=>{let t=new Date(e.timestamp).toLocaleTimeString();return`[${e.level.toUpperCase()}] ${t}${e.url?` ${e.url}`:``}\n${e.args.map(P7).join(`
|
|
760
760
|
`)}`}).join(`
|
|
761
761
|
|
|
762
762
|
`)),PM.success(`Copied ${T.length} logs to clipboard`)}catch{PM.error(`Failed to copy logs to clipboard`)}},className:`-my-2`,children:[(0,S.jsx)(jf,{className:`size-4 mr-1`}),`Copy All`]}),(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:p,className:`-my-2`,children:[(0,S.jsx)(Np,{className:`size-4 mr-1`}),`Clear`]})]})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1 pt-1`,children:[(0,S.jsxs)(`button`,{onClick:()=>l(`all`),className:H(`px-2 py-0.5 text-xs rounded font-medium transition-colors`,c===`all`?`bg-zinc-200 dark:bg-zinc-700 text-zinc-900 dark:text-zinc-100`:`text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800`),children:[`All`,x>0&&(0,S.jsx)(`span`,{className:`ml-1 text-[10px] opacity-70`,children:x})]}),vMe.map(e=>{let t=_[e];return(0,S.jsxs)(`button`,{onClick:()=>l(c===e?`all`:e),className:H(`px-2 py-0.5 text-xs rounded font-medium transition-colors`,c===e?`bg-zinc-200 dark:bg-zinc-700 text-zinc-900 dark:text-zinc-100`:`text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800`),children:[(0,S.jsx)(`span`,{className:H(t>0&&yMe[e]),children:e.charAt(0).toUpperCase()+e.slice(1)}),t>0&&(0,S.jsx)(`span`,{className:H(`ml-1 text-[10px]`,yMe[e]),children:t})]},e)}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 relative`,children:[(0,S.jsx)(hp,{className:`absolute left-2 size-3 text-zinc-400 dark:text-zinc-500 pointer-events-none`}),(0,S.jsx)(`input`,{type:`text`,placeholder:`Filter logs…`,value:u,onChange:e=>d(e.target.value),className:`pl-6 pr-6 py-0.5 text-xs rounded border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-400 dark:focus:ring-zinc-500 w-44`}),u&&(0,S.jsx)(`button`,{onClick:()=>d(``),"aria-label":`Clear search`,className:`absolute right-1.5 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300`,children:(0,S.jsx)(Fp,{className:`size-3`})})]})]})]}),(0,S.jsx)(`div`,{ref:g,className:`flex-1 overflow-auto bg-zinc-50 dark:bg-zinc-950`,children:T.length===0?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-zinc-500 dark:text-zinc-400`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(jp,{className:`size-8 mx-auto mb-2 opacity-50`}),(0,S.jsx)(`p`,{className:`text-sm`,children:f.length===0?`No console logs yet`:u?`No logs match "${u}"`:`No logs match the current filter`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:f.length===0?`Logs from iframes will appear here`:`${f.length} log${f.length===1?``:`s`} hidden by filter`})]})}):(0,S.jsx)(`div`,{children:T.map(e=>(0,S.jsx)(hMe,{log:e},e.id))})})]})]})}function F7(e){return{type:`text`,text:e}}function xMe(e,t){return{type:`image`,url:`data:${t};base64,${e}`,mimeType:t,data:e}}function SMe(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.content)?!0:`structuredContent`in t}function CMe(e){return typeof e==`object`&&!!e&&e.isError===!0}function wMe(e){if(!e||typeof e!=`object`)return null;switch(e.type){case`text`:{let t=e.text;return typeof t==`string`&&t.length>0?F7(t):null}case`image`:{let t=e;if(typeof t.data!=`string`||!t.data)return null;let n=typeof t.mimeType==`string`&&t.mimeType?t.mimeType:`image/png`;return xMe(t.data,n)}case`audio`:{let t=e;return F7(`[audio: ${typeof t.mimeType==`string`&&t.mimeType?t.mimeType:`audio/*`}, base64 omitted (${typeof t.data==`string`?t.data.length:0} chars)]`)}case`resource`:{let t=e.resource??{};return typeof t.text==`string`&&t.text.length>0?F7(t.text):typeof t.blob==`string`&&typeof t.mimeType==`string`&&t.mimeType.startsWith(`image/`)?xMe(t.blob,t.mimeType):F7(`[resource: ${typeof t.uri==`string`?t.uri:`<unknown>`} (${typeof t.mimeType==`string`?t.mimeType:`unknown`})]`)}case`resource_link`:{let t=e,n=typeof t.uri==`string`?t.uri:`<unknown>`;return F7(`[resource_link${typeof t.name==`string`?` "${t.name}"`:``}: ${n}]`)}default:return F7(`[unsupported tool content block: ${String(e.type)}]`)}}function TMe(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let{_meta:t,...n}=e;return n}return e}function EMe(e){let t=TMe(e);if(typeof t==`string`)return t.length>0?[F7(t)]:[];if(SMe(t)){let e=t,n=[];if(Array.isArray(e.content))for(let t of e.content){let e=wMe(t);e&&n.push(e)}if(e.structuredContent!==void 0)try{n.push(F7(`structuredContent: ${JSON.stringify(e.structuredContent)}`))}catch{}return e.isError&&n.unshift(F7(`[tool reported isError=true]`)),n}try{return[F7(JSON.stringify(t))]}catch{return[F7(String(t))]}}function DMe(e){return e.length===0?``:e.every(e=>e.type===`text`)?e.map(e=>e.text).join(`
|
|
@@ -791,14 +791,14 @@ Example format: {"theme": "dark", "width": "400", "title": "My Widget"}`},{role:
|
|
|
791
791
|
|
|
792
792
|
Based on this information, suggest 3-5 common customizable properties like theme, dimensions, colors, titles, or configuration options that would be useful for this type of resource. Keep it simple and practical.`}],{text:l}=await B7({config:{provider:e.provider,model:e.model,apiKey:e.apiKey,temperature:e.temperature,baseUrl:e.baseUrl},messages:c});try{let e=bNe(l);if(e)return Object.entries(e).map(([e,t])=>({key:e,value:typeof t==`object`&&t?JSON.stringify(t):String(t)}));let t=l.split(`
|
|
793
793
|
`),n=[];for(let e of t){let t=e.match(/^\s*["']?(\w+)["']?\s*[:=]\s*["']?(.+?)["']?\s*,?\s*$/);t&&n.push({key:t[1].trim(),value:t[2].trim().replace(/^["']|["']$/g,``)})}if(n.length>0)return n;throw Error(`Could not parse props from LLM response`)}catch(e){throw console.error(`[usePropsLLM] Failed to parse LLM response:`,e),Error(`Failed to parse props from LLM response: ${l.slice(0,100)}...`)}},[e]),isAvailable:e!==null}}function SNe(e,t){if(!e?.$ref)return e;let n=e.$ref;if(n.startsWith(`#/`)){let r=n.substring(2).split(`/`),i=t;for(let t of r)if(i&&typeof i==`object`&&t in i)i=i[t];else return console.warn(`Could not resolve $ref: ${n}`),e;return i}return e}function CNe(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){let n=e.anyOf.find(e=>e.type!==`null`);if(n)return{...SNe(n,t),nullable:!0}}return e}function wNe(e){return Array.isArray(e.enum)?e.enum:null}function TNe({name:e,schema:t,value:n,onChange:r,required:i=!1,disabled:a=!1,rootSchema:o}){let s=o||t,c=CNe(t,s);c=SNe(c,s);let l=wNe(c),u=c.type===`string`&&l!==null,d=c;return d.type===`object`||d.type===`array`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(ON,{htmlFor:e,className:`text-sm font-medium`,children:[e,i&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(fY,{id:e,value:n,onChange:e=>r(e.target.value),placeholder:d?.description||d?.default?JSON.stringify(d.default,null,2):`Enter ${e}`,className:`min-h-[100px]`,disabled:a}),d?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:d.description})]}):u&&l?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(ON,{htmlFor:e,className:`text-sm font-medium`,children:[e,i&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsxs)(bP,{value:n||``,onValueChange:r,disabled:a,children:[(0,S.jsx)(SP,{id:e,className:`w-full`,children:(0,S.jsx)(xP,{placeholder:d.description||`Select an option`})}),(0,S.jsx)(CP,{children:l.map((e,t)=>(0,S.jsx)(wP,{value:e,children:d.enumNames?.[t]||e},e))})]}),d.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:d.description})]}):(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(ON,{htmlFor:e,className:`text-sm font-medium`,children:[e,i&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(TN,{id:e,value:n,onChange:e=>r(e.target.value),placeholder:d?.description||(d?.default===void 0?`Enter ${e}`:String(d.default)),type:d.type===`number`?`number`:`text`,disabled:a}),d?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:d.description})]})}function ENe({open:e,onOpenChange:t,onSave:n,existingPresets:r,resource:i,resourceAnnotations:a,llmConfig:o,editingPreset:s}){let c=(0,w.useMemo)(()=>{let e=e=>{if(!e)return null;if(e.type===`object`&&e.properties)return e;let t=e?.def?.shape??e?._def?.shape;if(t&&typeof t==`object`){let e={},n=[],r=e=>({ZodString:`string`,string:`string`,ZodNumber:`number`,number:`number`,ZodBoolean:`boolean`,boolean:`boolean`,ZodArray:`array`,array:`array`,ZodObject:`object`,object:`object`})[e]||`string`,i=e=>e?.typeName??e?.type??``,a=e=>{let t=e?._def??e?.def??{},n=e,a=i(t);for(;a===`ZodOptional`||a===`ZodDefault`||a===`ZodNullable`;)n=t.innerType??n,a=i(n?._def??n?.def??{});let o=r(a);if(o===`array`){let e=n?._def?.type??n?.def?.element??n?.element;if(e){let t=e._def??e.def??{};if(r(i(t))===`object`){let n=t.shape??e._def?.shape??e.def?.shape??{};return{type:`array`,items:{type:`object`,properties:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,{type:r(i(t?._def??t?.def??{}))}]))}}}}return{type:`array`}}return{type:o}};for(let[r,o]of Object.entries(t)){let t=o,s=t?._def??t?.def??{},c=i(s),l=c===`ZodOptional`||c===`ZodDefault`||c===`ZodNullable`,u=a(t);e[r]={type:u.type,...u.items&&{items:u.items},description:t?.description??s.description},l||n.push(r)}if(Object.keys(e).length>0)return{type:`object`,properties:e,required:n.length>0?n:void 0}}return null},t=a;if(t?.[`mcp-use/propsSchema`])return e(t[`mcp-use/propsSchema`]);let n=i.annotations;return n?.[`mcp-use/propsSchema`]?e(n[`mcp-use/propsSchema`]):null},[a,i.annotations,i.uri,i.name]),l=!!c,[u,d]=(0,w.useState)(``),[f,p]=(0,w.useState)({}),[m,h]=(0,w.useState)([{id:crypto.randomUUID(),key:``,value:``}]),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(null),{generateProps:b,isAvailable:x}=xNe({llmConfig:o});(0,w.useEffect)(()=>{if(e){if(s)if(d(s.name),l)p(s.props);else{let e=Object.entries(s.props).map(([e,t])=>({id:crypto.randomUUID(),key:e,value:t}));h(e.length>0?e:[{id:crypto.randomUUID(),key:``,value:``}])}else d(``),l?p({}):h([{id:crypto.randomUUID(),key:``,value:``}]);y(null)}},[e,s,l]);let C=()=>{h([...m,{id:crypto.randomUUID(),key:``,value:``}])},T=e=>{m.length>1&&h(m.filter(t=>t.id!==e))},E=(e,t,n)=>{h(m.map(r=>r.id===e?{...r,[t]:n}:r))};return(0,S.jsx)(yN,{open:e,onOpenChange:t,children:(0,S.jsxs)(xN,{className:`sm:max-w-[600px] max-h-[80vh] flex flex-col`,"data-testid":`props-config-dialog`,children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:s?`Edit Preset`:`Create Props Preset`}),(0,S.jsxs)(wN,{children:[`Configure props for `,i.name||i.uri,`. You can manually add key-value pairs or generate them with AI.`]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto space-y-4 py-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`preset-name`,children:`Preset Name`}),(0,S.jsx)(TN,{id:`preset-name`,"data-testid":`props-config-preset-name`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g., Dark Theme, Production Config`,disabled:g})]}),(0,S.jsxs)(`div`,{className:`space-y-2 p-3 bg-muted rounded-lg`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(ON,{className:`text-sm font-medium`,children:`Generate with AI`}),x&&(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Using `,o?.provider,` (`,o?.model,`)`]})]}),x?(0,S.jsx)(U,{onClick:async()=>{if(!x){PM.error(`LLM not configured`,{description:`Please configure LLM in the Chat tab first.`});return}_(!0),y(null);try{let e=await b({resource:i,resourceAnnotations:a,propsSchema:l?c:void 0});if(l){let t={};for(let n of e)c.properties?.[n.key]&&(t[n.key]=n.value);p(t)}else h(e.map(e=>({id:crypto.randomUUID(),key:e.key,value:e.value})));PM.success(`Props generated successfully`,{description:`Generated ${e.length} prop(s) using ${o?.provider}`})}catch(e){let t=e instanceof Error?e.message:`Failed to generate props`;y(t),PM.error(`LLM Generation Failed`,{description:t})}finally{_(!1)}},disabled:g,size:`sm`,variant:`outline`,className:`w-full`,"data-testid":`props-config-generate-llm-button`,children:g?(0,S.jsxs)(`span`,{"data-testid":`props-config-generating`,className:`flex items-center gap-2`,children:[(0,S.jsx)(Zf,{className:`h-4 w-4 mr-2 animate-spin`}),`Generating...`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Cp,{className:`h-4 w-4 mr-2`}),`Generate Props with LLM`]})}):(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`LLM not configured. Please configure LLM in the Chat tab to use this feature.`}),v&&(0,S.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`props-config-error`,children:v})]}),(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(ON,{className:`text-sm font-medium`,children:`Props`}),l?(0,S.jsx)(`div`,{className:`space-y-4`,children:Object.entries(c.properties||{}).map(([e,t])=>(0,S.jsx)(TNe,{name:e,schema:t,value:f[e]||``,onChange:t=>p(n=>({...n,[e]:t})),required:c.required?.includes(e),disabled:g,rootSchema:c},e))}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,S.jsxs)(U,{onClick:C,size:`sm`,variant:`ghost`,disabled:g,"data-testid":`props-config-add-prop`,children:[(0,S.jsx)(lp,{className:`h-4 w-4 mr-1`}),`Add Prop`]})}),m.map((e,t)=>(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 gap-2`,children:[(0,S.jsx)(TN,{placeholder:`Key`,value:e.key,onChange:t=>E(e.id,`key`,t.target.value),disabled:g,"data-testid":`props-config-key-${t}`}),(0,S.jsx)(TN,{placeholder:`Value`,value:e.value,onChange:t=>E(e.id,`value`,t.target.value),disabled:g,"data-testid":`props-config-value-${t}`})]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>T(e.id),disabled:m.length===1||g,className:`h-9 w-9 p-0`,"data-testid":`props-config-remove-${t}`,children:(0,S.jsx)(Mp,{className:`h-4 w-4 text-muted-foreground`})})]},e.id))]})]})]}),(0,S.jsxs)(Ohe,{children:[(0,S.jsx)(U,{variant:`outline`,onClick:()=>t(!1),disabled:g,"data-testid":`props-config-cancel-button`,children:`Cancel`}),(0,S.jsxs)(U,{onClick:()=>{if(!u.trim()){PM.error(`Preset name required`,{description:`Please enter a name for this preset.`});return}if(r.find(e=>e.name.toLowerCase()===u.toLowerCase()&&e.id!==s?.id)){PM.error(`Duplicate preset name`,{description:`A preset with this name already exists.`});return}let e;if(l)e={...f};else{e={};for(let t of m)t.key.trim()&&(e[t.key.trim()]=t.value)}if(Object.keys(e).length===0){PM.error(`No props defined`,{description:`Please add at least one prop with a key.`});return}let i={id:s?.id||crypto.randomUUID(),name:u.trim(),props:e};n(i),t(!1),PM.success(s?`Preset updated`:`Preset created`,{description:`Preset "${i.name}" saved successfully.`})},disabled:g,"data-testid":`props-config-save-button`,children:[s?`Update`:`Create`,` Preset`]})]})]})})}function DNe({value:e,onChange:t}){let n=(n,r)=>{let i=parseInt(r,10);isNaN(i)||t({...e,[n]:i})};return(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Top`}),(0,S.jsx)(TN,{type:`number`,min:`0`,value:e.top,onChange:e=>n(`top`,e.target.value),className:`h-8`,"data-testid":`debugger-safe-area-top`})]}),(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Right`}),(0,S.jsx)(TN,{type:`number`,min:`0`,value:e.right,onChange:e=>n(`right`,e.target.value),className:`h-8`,"data-testid":`debugger-safe-area-right`})]}),(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Bottom`}),(0,S.jsx)(TN,{type:`number`,min:`0`,value:e.bottom,onChange:e=>n(`bottom`,e.target.value),className:`h-8`,"data-testid":`debugger-safe-area-bottom`})]}),(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Left`}),(0,S.jsx)(TN,{type:`number`,min:`0`,value:e.left,onChange:e=>n(`left`,e.target.value),className:`h-8`,"data-testid":`debugger-safe-area-left`})]})]})}var V7=`__no_props__`,H7=`__tool_props__`,ONe=`__create_preset__`;function kNe(e,t){let n=new Set(t?.connectDomains??[]),r=new Set(t?.resourceDomains??[]),i=new Set(t?.frameDomains??[]),a=new Set([`script-src`,`style-src`,`img-src`,`font-src`,`media-src`]);for(let t of e){let e=(t.blockedUri||``).trim();if(!e||e===`(inline)`||e.startsWith(`blob:`)||e.startsWith(`data:`))continue;let o=null;try{o=new URL(e).origin}catch{continue}if(!o)continue;let s=(t.effectiveDirective||t.directive||``).toLowerCase();s===`connect-src`?(n.add(o),o.startsWith(`http://`)?n.add(o.replace(`http://`,`ws://`)):o.startsWith(`https://`)&&n.add(o.replace(`https://`,`wss://`))):a.has(s)?r.add(o):s===`frame-src`&&i.add(o)}let o={connectDomains:Array.from(n).sort(),resourceDomains:Array.from(r).sort()};return i.size>0&&(o.frameDomains=Array.from(i).sort()),o}var ANe=`https://raw.githubusercontent.com/modelcontextprotocol/ext-apps/bcfffb6585ea4fb1e3a9da39fb8911b83399fa71/specification/2026-01-26/apps.mdx`,jNe=`https://mcp-use.com/docs/typescript/server/csp`;function MNe(e,t,n,r){let i=[`Fix the Content Security Policy (CSP) for this MCP Apps widget. The widget has CSP violations that block network requests and resources.`,``,`**References:**`,`- MCP Apps CSP spec: ${ANe}`,`- mcp-use CSP docs: ${jNe}`,``];if(i.push(`**Current declared CSP:**`),e?(i.push(`connectDomains: ${JSON.stringify(e.connectDomains??[])}`),i.push(`resourceDomains: ${JSON.stringify(e.resourceDomains??[])}`),i.push(`frameDomains: ${JSON.stringify(e.frameDomains??[])}`),i.push(`baseUriDomains: ${JSON.stringify(e.baseUriDomains??[])}`)):i.push(`No CSP declared.`),i.push(``),t&&(i.push(`**Effective policy (originalPolicy):**`),i.push("```"),i.push(t),i.push("```"),i.push(``)),n.length>0){i.push(`**Blocked requests (${n.length}):**`);for(let e of n){let t=e.effectiveDirective||e.directive,n=e.blockedUri||`(inline)`;i.push(`- ${t}: ${n}`)}i.push(``)}return r?(i.push(`**Apply this CSP config to fix the violations:**`),i.push(`Add these domains to the widget's CSP metadata (appsSdkMetadata["openai/widgetCSP"] or resource _meta.ui.csp). Use camelCase for MCP Apps (connectDomains, resourceDomains) or snake_case for OpenAI format (connect_domains, resource_domains).`),i.push(``),i.push("```json"),i.push(JSON.stringify({connectDomains:r.connectDomains,resourceDomains:r.resourceDomains,...r.frameDomains?.length?{frameDomains:r.frameDomains}:{}},null,2)),i.push("```")):i.push(`No blocked requests - no fix needed.`),i.join(`
|
|
794
|
-
`)}function U7({displayMode:e,onDisplayModeChange:t,toolCallId:n,propsContext:r,resourceUri:i,toolInput:a,resourceAnnotations:o,llmConfig:s,resource:c,onPropsChange:l,requiredProps:u,protocol:d=`mcp-apps`,onUpdateGlobals:f}){let{resolvedTheme:p,setTheme:m}=FP(),{playground:h,updatePlaygroundSettings:g,widgets:_,clearCspViolations:v}=yQ(),y=_.get(n),b=y?.cspViolations??[],x=y?.declaredCsp,C=y?.effectivePolicy,T=b.length>0?kNe(b,x):null,E=b.length>0?MNe(x,C,b,T):``,D=e===`fullscreen`,O=e===`pip`,k=d===`apps-sdk`,{presets:A,activePresetId:j,savePreset:M,deletePreset:N,setActivePreset:P,getActiveProps:F}=uMe(i),[I,L]=(0,w.useState)(!1),ee=!!u?.length&&!j,[te,ne]=(0,w.useState)(()=>ee);(0,w.useEffect)(()=>{ee&&ne(!0)},[ee]);let[re,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(!1),[ie,ae]=(0,w.useState)(!1),[oe,se]=(0,w.useState)(!1),[ce,le]=(0,w.useState)(!1),[ue,de]=(0,w.useState)(!0),[fe,pe]=(0,w.useState)(!0),[me,he]=(0,w.useState)(!0),ge=(0,w.useCallback)(()=>r===`tool`&&a?H7:V7,[r,a]),[_e,ve]=(0,w.useState)(ge());(0,w.useEffect)(()=>{j&&r!==`tool`?ve(j):_e!==V7&&_e!==H7&&ve(ge())},[j,_e,ge,r]),(0,w.useEffect)(()=>{l&&(_e===V7||_e===H7?l(null):j&&l(F()))},[_e,j,a,F,l]);let ye=e=>{if(e===ONe){R(null),L(!0);return}e===V7||e===H7?(P(null),ve(e)):(P(e),ve(e))},be=e=>{M(e),P(e.id),ve(e.id)},xe=(e,t)=>{t.stopPropagation();let n=A.find(t=>t.id===e);n&&(N(e),PM.success(`Preset deleted`,{description:`Preset "${n.name}" has been deleted.`}))},Se=(e,t)=>{t.stopPropagation(),R(e),L(!0)};return(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!D&&!O&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-fullscreen-button`,variant:`outline`,size:`sm`,className:`bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>t(`fullscreen`),children:(0,S.jsx)(Qf,{className:`size-4`})})}),(0,S.jsx)(jd,{children:`Enter fullscreen mode`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-pip-button`,variant:`outline`,size:`sm`,className:`bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>t(`pip`),children:(0,S.jsx)(sp,{className:`size-4`})})}),(0,S.jsx)(jd,{children:`Picture-in-picture`})]})]}),(0,S.jsxs)(yN,{open:z,onOpenChange:B,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-device-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(()=>{switch(h.deviceType){case`mobile`:return(0,S.jsx)(Sp,{className:`size-3`});case`tablet`:return(0,S.jsx)(Ap,{className:`size-3`});default:return(0,S.jsx)(rp,{className:`size-3`})}})()})})}),(0,S.jsxs)(jd,{children:[`Device: `,h.deviceType]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[300px]`,"data-testid":`debugger-device-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Device Type`})}),(0,S.jsx)(`div`,{className:`space-y-2`,children:[{value:`desktop`,label:`Desktop`,icon:rp},{value:`mobile`,label:`Mobile`,icon:Sp},{value:`tablet`,label:`Tablet`,icon:Ap}].map(e=>{let t=e.icon;return(0,S.jsxs)(U,{"data-testid":`debugger-device-option-${e.value}`,variant:h.deviceType===e.value?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({deviceType:e.value}),k&&f&&f({userAgent:{device:{type:e.value},capabilities:h.capabilities}}),B(!1)},children:[(0,S.jsx)(t,{className:`size-4 mr-2`}),e.label]},e.value)})})]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-theme-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>{let e=p===`dark`?`light`:`dark`;m(e),f&&f({theme:e})},children:p===`dark`?(0,S.jsx)(ip,{className:`size-3.5`}):(0,S.jsx)(kp,{className:`size-3.5`})})}),(0,S.jsxs)(jd,{children:[`Theme: `,p===`dark`?`Dark`:`Light`]})]}),(0,S.jsxs)(yN,{open:ie,onOpenChange:ae,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-locale-button`,variant:`outline`,size:`sm`,className:`h-8 min-w-[50px] px-2 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(`span`,{className:`text-xs font-mono`,children:h.locale})})})}),(0,S.jsx)(jd,{children:`Locale`})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[400px]`,"data-testid":`debugger-locale-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Select Locale`})}),(0,S.jsxs)(AJ,{children:[(0,S.jsx)(jJ,{placeholder:`Search locales...`,"data-testid":`debugger-locale-search`}),(0,S.jsxs)(MJ,{children:[(0,S.jsx)(NJ,{children:`No locale found.`}),(0,S.jsx)(PJ,{children:Zje.map(e=>(0,S.jsx)(FJ,{value:e.value,"data-testid":`debugger-locale-option-${e.value}`,onSelect:()=>{g({locale:e.value}),k&&f&&f({locale:e.value}),ae(!1)},children:e.label},e.value))})]})]})]})]}),!k&&(0,S.jsxs)(yN,{open:oe,onOpenChange:se,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-timezone-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(Df,{className:`size-3.5`})})})}),(0,S.jsxs)(jd,{children:[`Timezone: `,h.timeZone]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[400px]`,"data-testid":`debugger-timezone-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Select Timezone`})}),(0,S.jsxs)(AJ,{children:[(0,S.jsx)(jJ,{placeholder:`Search timezones...`,"data-testid":`debugger-timezone-search`}),(0,S.jsxs)(MJ,{children:[(0,S.jsx)(NJ,{children:`No timezone found.`}),(0,S.jsx)(PJ,{children:$je.map(e=>(0,S.jsx)(FJ,{value:e.value,"data-testid":`debugger-timezone-option-${e.value.replace(/\//g,`-`)}`,onSelect:()=>{g({timeZone:e.value}),se(!1)},children:e.label},e.value))})]})]})]})]}),(0,S.jsxs)(yN,{open:ce,onOpenChange:le,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`debugger-csp-button`,variant:`outline`,size:`sm`,className:`relative h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:[h.cspMode===`permissive`?(0,S.jsx)(bp,{className:`size-3.5`}):(0,S.jsx)(yp,{className:`size-3.5`}),b.length>0&&(0,S.jsx)(`span`,{className:`absolute -top-1.5 -right-1.5 flex h-4 min-w-4 items-center justify-center rounded-full px-0.5 text-[9px] font-bold text-white leading-none ${h.cspMode===`permissive`?`bg-yellow-500`:`bg-red-500`}`,children:b.length>99?`99+`:b.length})]})})}),(0,S.jsxs)(jd,{children:[`CSP:`,` `,h.cspMode===`permissive`?`Permissive`:`Declared`,b.length>0&&` · ${b.length} ${h.cspMode===`permissive`?`would be blocked`:`blocked`}`]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[520px] max-h-[85vh] overflow-y-auto`,"data-testid":`debugger-csp-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`CSP Mode`})}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(U,{"data-testid":`debugger-csp-option-permissive`,variant:h.cspMode===`permissive`?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({cspMode:`permissive`}),le(!1)},children:[(0,S.jsx)(bp,{className:`size-4 mr-2`}),(0,S.jsx)(`div`,{className:`flex flex-col items-start`,children:(0,S.jsx)(`span`,{children:`Permissive`})})]}),(0,S.jsxs)(U,{"data-testid":`debugger-csp-option-widget-declared`,variant:h.cspMode===`widget-declared`?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({cspMode:`widget-declared`}),le(!1)},children:[(0,S.jsx)(yp,{className:`size-4 mr-2`}),(0,S.jsx)(`div`,{className:`flex flex-col items-start`,children:(0,S.jsx)(`span`,{children:`Widget-Declared`})})]})]}),(0,S.jsxs)(`div`,{className:`mt-3 border border-zinc-200 dark:border-zinc-700 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm font-medium bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors`,onClick:()=>de(e=>!e),children:[ue?(0,S.jsx)(yf,{className:`size-3.5 shrink-0`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0`}),`Current declared CSP`]}),ue&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0 space-y-1.5 text-xs`,children:x?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`connectDomains:`}),` `,x.connectDomains?.length?JSON.stringify(x.connectDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`resourceDomains:`}),` `,x.resourceDomains?.length?JSON.stringify(x.resourceDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`frameDomains:`}),` `,x.frameDomains?.length?JSON.stringify(x.frameDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`baseUriDomains:`}),` `,x.baseUriDomains?.length?JSON.stringify(x.baseUriDomains):`Not declared`]})]}):(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400`,children:h.cspMode===`permissive`?`Widget-declared (would apply in Widget-Declared mode)`:`No CSP declared`})})]}),(0,S.jsxs)(`div`,{className:`mt-3 border border-zinc-200 dark:border-zinc-700 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex-1 flex items-center gap-2 text-left text-sm font-medium min-w-0`,onClick:()=>pe(e=>!e),children:[fe?(0,S.jsx)(yf,{className:`size-3.5 shrink-0`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0`}),`originalPolicy`]}),C&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0`,onClick:async e=>{e.stopPropagation();try{await dj(C),PM.success(`Policy copied to clipboard`)}catch{PM.error(`Failed to copy`)}},"aria-label":`Copy policy`,children:(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(jd,{children:`Copy policy`})]})]}),fe&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:C?(0,S.jsx)(`pre`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 whitespace-pre-wrap break-all bg-zinc-50 dark:bg-zinc-900 p-2 rounded border border-zinc-100 dark:border-zinc-800`,children:C}):(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400 text-xs`,children:`No policy data yet (load widget in Widget-Declared mode)`})})]}),b.length>-1&&(0,S.jsxs)(`div`,{className:`mt-3 border border-amber-200 dark:border-amber-800 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 bg-amber-50 dark:bg-amber-950/30 hover:bg-amber-100 dark:hover:bg-amber-900/30 transition-colors`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex-1 flex items-center gap-2 text-left text-sm font-medium min-w-0 text-amber-800 dark:text-amber-200`,onClick:()=>he(e=>!e),children:[me?(0,S.jsx)(yf,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}),`Prompt for Agents`]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0 text-amber-600 dark:text-amber-400 hover:bg-amber-200/50 dark:hover:bg-amber-800/30`,onClick:async e=>{e.stopPropagation();try{await dj(E),PM.success(`Prompt copied to clipboard`)}catch{PM.error(`Failed to copy`)}},"aria-label":`Copy prompt for agents`,children:(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(jd,{children:`Copy prompt for agents`})]})]}),me&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:(0,S.jsx)(`pre`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 whitespace-pre-wrap bg-zinc-50 dark:bg-zinc-900 p-2 rounded border border-zinc-100 dark:border-zinc-800 overflow-x-auto max-h-48 overflow-y-auto`,"data-testid":`debugger-csp-prompt-for-agents`,children:E})})]}),b.length>0&&(0,S.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`span`,{className:`text-xs font-semibold uppercase tracking-wide ${h.cspMode===`permissive`?`text-yellow-600 dark:text-yellow-400`:`text-red-600 dark:text-red-400`}`,children:[b.length,` `,h.cspMode===`permissive`?`would-be-blocked`:`blocked`,` `,`request`,b.length===1?``:`s`]}),(0,S.jsx)(`button`,{className:`text-xs text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 underline`,onClick:()=>v(n),children:`Clear`})]}),(0,S.jsx)(`div`,{className:`max-h-56 overflow-y-auto space-y-1 rounded border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 p-2`,children:b.map((e,t)=>(0,S.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1 border-b border-zinc-100 dark:border-zinc-800 last:border-0`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,S.jsx)(`span`,{className:`shrink-0 rounded bg-red-100 dark:bg-red-900/40 px-1 py-0.5 text-[10px] font-mono font-semibold text-red-700 dark:text-red-300`,children:e.effectiveDirective||e.directive})}),(0,S.jsx)(`span`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 break-all leading-snug`,children:e.blockedUri||`(inline)`})]},t))})]})]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-touch-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.touch?`border-blue-500 dark:border-blue-400`:``}`,onClick:()=>{let e={...h.capabilities,touch:!h.capabilities.touch};g({capabilities:e}),k&&f&&f({userAgent:{device:{type:h.deviceType},capabilities:e}})},children:(0,S.jsx)(up,{className:`size-3.5 ${h.capabilities.touch?`text-blue-600 dark:text-blue-400`:``}`})})}),(0,S.jsxs)(jd,{children:[`Touch: `,h.capabilities.touch?`Enabled`:`Disabled`]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-hover-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.hover?`border-blue-500 dark:border-blue-400`:``}`,onClick:()=>{let e={...h.capabilities,hover:!h.capabilities.hover};g({capabilities:e}),k&&f&&f({userAgent:{device:{type:h.deviceType},capabilities:e}})},children:(0,S.jsx)(ap,{className:`size-3.5 ${h.capabilities.hover?`text-blue-600 dark:text-blue-400`:``}`})})}),(0,S.jsxs)(jd,{children:[`Hover: `,h.capabilities.hover?`Enabled`:`Disabled`]})]}),(0,S.jsxs)(QJ,{children:[(0,S.jsx)($J,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-safe-area-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(Tp,{className:`size-3.5`})})}),(0,S.jsx)(eY,{className:`w-64 p-3`,"data-testid":`debugger-safe-area-dialog`,children:(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-xs font-medium`,children:`Safe Area Insets`}),(0,S.jsx)(DNe,{value:h.safeAreaInsets,onChange:e=>{g({safeAreaInsets:e}),k&&f&&f({safeArea:{insets:e}})}})]})})]}),r===`tool`?(0,S.jsxs)(yN,{children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,"data-testid":`debugger-props-button`,children:(0,S.jsx)(mf,{className:`size-3.5`})})})}),(0,S.jsx)(jd,{children:`View Tool Props`})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[600px]`,"data-testid":`debugger-props-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Tool Props`})}),(0,S.jsx)(`div`,{className:`overflow-auto max-h-[60vh] rounded-md bg-gray-50 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-700 p-3`,children:(0,S.jsx)(RV,{data:a??{},filename:`tool-props.json`})})]})]}):(0,S.jsxs)(QJ,{open:te,onOpenChange:ne,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)($J,{asChild:!0,children:(0,S.jsx)(U,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 backdrop-blur-sm shadow-sm ${ee?`bg-amber-50 dark:bg-amber-950/40 border-amber-300 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/50 animate-pulse`:`bg-white/90 dark:bg-zinc-900/90 hover:bg-white dark:hover:bg-zinc-900`}`,"data-testid":`debugger-props-button`,children:(0,S.jsx)(mf,{className:`size-3.5 ${ee?`text-amber-500`:``}`})})})}),(0,S.jsxs)(jd,{children:[`Props:`,` `,_e===V7?`No Props`:_e===H7?`Tool Props`:A.find(e=>e.id===_e)?.name||`Custom`]})]}),(0,S.jsxs)(eY,{className:`w-64 p-2`,"data-testid":`debugger-props-popover`,children:[ee&&(0,S.jsxs)(`div`,{className:`mb-2 rounded-md border border-amber-200 dark:border-amber-800/50 bg-amber-50 dark:bg-amber-950/30 px-3 py-2`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-amber-700 dark:text-amber-300 mb-0.5`,children:`Props required to render this widget:`}),(0,S.jsx)(`p`,{className:`text-xs font-mono text-amber-600 dark:text-amber-400`,children:u.join(`, `)}),(0,S.jsx)(`p`,{className:`text-xs text-amber-500 dark:text-amber-400 mt-1`,children:`Create a preset below to set them.`})]}),(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(U,{variant:_e===V7?`secondary`:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>ye(V7),"data-testid":`debugger-props-no-props`,children:`No Props`}),A.map(e=>(0,S.jsxs)(`div`,{className:`relative group flex items-center`,children:[(0,S.jsx)(U,{variant:_e===e.id?`secondary`:`ghost`,size:`sm`,className:`w-full justify-start pr-14`,onClick:()=>ye(e.id),"data-testid":`debugger-props-preset-${e.id}`,children:e.name}),(0,S.jsxs)(`div`,{className:`absolute right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:t=>Se(e,t),"data-testid":`debugger-props-edit-${e.id}`,children:(0,S.jsx)(vp,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:t=>xe(e.id,t),"data-testid":`debugger-props-delete-${e.id}`,children:(0,S.jsx)(Mp,{className:`h-3 w-3 text-destructive`})})]})]},e.id)),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`w-full justify-start text-primary`,onClick:()=>ye(ONe),"data-testid":`debugger-props-create-preset`,children:`+ Create Preset...`})]})]})]}),(0,S.jsx)(bMe,{iframeId:n,enabled:!0}),c&&(0,S.jsx)(ENe,{open:I,onOpenChange:L,onSave:be,existingPresets:A,resource:c,resourceAnnotations:o,llmConfig:s||null,editingPreset:re})]})}function NNe({children:e,className:t,noWrapper:n}){return n?e:(0,S.jsx)(`div`,{className:H(`bg-zinc-100 dark:bg-zinc-900 bg-[radial-gradient(circle,_rgba(0,0,0,0.2)_1px,_transparent_1px)] dark:bg-[radial-gradient(circle,_rgba(255,255,255,0.2)_1px,_transparent_1px)] bg-[length:32px_32px]`,t),children:e})}function PNe({componentUrl:e,toolName:t,toolArgs:n,toolResult:r,serverId:i,readResource:a,className:o,noWrapper:s=!1,showConsole:c=!0,customProps:l,serverBaseUrl:u,invoking:d,invoked:f,onUpdateGlobals:p}){let m=(0,w.useRef)(null),h=(0,w.useRef)(null),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!0),b=(0,w.useRef)(!1),[x,C]=(0,w.useState)(null),[T,E]=(0,w.useState)(null),[D,O]=(0,w.useState)(400),k=(0,w.useRef)(0),A=(0,w.useRef)(0),j=(0,w.useRef)(!1),[M,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(`inline`),[I,L]=(0,w.useState)(!1),[ee,te]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(!1),[R,z]=(0,w.useState)(null),[B,ie]=(0,w.useState)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(null),se=(0,w.useRef)(null),ce=(0,w.useRef)(!1),le=(0,w.useRef)(null),ue=(0,w.useRef)(`tool-${Date.now()}-${Math.random().toString(36).substring(7)}`).current,de=(0,w.useRef)(!1),{servers:fe}=uj(),pe=fe.find(e=>e.id===i),me=u??pe?.url,{resolvedTheme:he}=FP(),{playground:ge,addWidget:_e,addCspViolation:ve}=yQ(),ye=(0,w.useRef)(n),be=(0,w.useRef)(r),xe=(0,w.useRef)(a),Se=(0,w.useRef)(me),Ce=(0,w.useRef)(he),we=(0,w.useRef)(l);(0,w.useEffect)(()=>{ye.current=n,be.current=r,xe.current=a,Se.current=me,Ce.current=he,we.current=l}),(0,w.useEffect)(()=>{let n=!1;return(async()=>{let r=be.current,a=xe.current,o=Ce.current,s=ge;console.log(`[OpenAIComponentRenderer] Storing widget data with playground:`,{locale:s.locale,deviceType:s.deviceType});try{let c=r?r.structuredContent??{}:null,l=await a(e);if(n)return;let u=null;r?._meta?.[`openai/widgetCSP`]?u=r._meta[`openai/widgetCSP`]:l?.contents?.[0]?._meta?.[`openai/widgetCSP`]&&(u=l.contents[0]._meta[`openai/widgetCSP`]);let d=ye.current,f=we.current,p={...d||{},...f||{}},m={serverId:i,uri:e,toolInput:p,toolOutput:c,toolResponseMetadata:null,resourceData:l,toolId:ue,widgetCSP:u,theme:o,playground:{locale:s.locale,deviceType:s.deviceType,capabilities:s.capabilities,safeAreaInsets:s.safeAreaInsets}},h=await fetch(`/inspector/api/resources/widget/store`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(m)});if(!h.ok){let e=await h.json().catch(()=>({error:`Unknown error`}));throw Error(`Failed to store widget data: ${e.error||h.statusText}`)}if(n)return;z(p),ie(c),re(!1),de.current||(de.current=!0,E(`/inspector/api/resources/widget-content/${ue}?t=${Date.now()}`),_e(ue,{toolName:t,protocol:`chatgpt-app`})),L(!0)}catch(e){if(n)return;console.error(`Error storing widget data:`,e),C(e instanceof Error?e.message:`Failed to prepare widget`)}})(),()=>{n=!0}},[e,i,ue,l,JSON.stringify(n),r]);let Te=(0,w.useCallback)(e=>{if(se.current={...se.current||{},...e},!m.current?.contentWindow){p&&p(e);return}ce.current||(ce.current=!0,queueMicrotask(()=>{ce.current=!1;let e=se.current;if(se.current=null,!e)return;let t=()=>{if(oe.current!==null)return;let e=0,t=()=>{let n=m.current?.contentWindow,r=ae.current;if(!n||!r){oe.current=null;return}if(n.openai){ae.current=null,oe.current=null,Te(r);return}if(e+=1,e>=60){oe.current=null;return}oe.current=window.requestAnimationFrame(t)};oe.current=window.requestAnimationFrame(t)};try{let n=m.current?.contentWindow,r=m.current?.contentDocument;if(!n)return;if(e.theme!==void 0&&r){let t=r.documentElement;t.setAttribute(`data-theme`,e.theme),t.style.colorScheme=e.theme,t.classList.remove(`light`,`dark`),t.classList.add(e.theme)}if(n.openai){if(!(e.locale!==void 0||e.safeArea!==void 0||e.userAgent!==void 0||e.maxHeight!==void 0||e.toolOutput!==void 0||e.toolResponseMetadata!==void 0)){let t=e.theme===void 0||n.openai.theme===e.theme,r=e.displayMode===void 0||n.openai.displayMode===e.displayMode;if(t&&r)return}e.displayMode!==void 0&&(n.openai.displayMode=e.displayMode),e.theme!==void 0&&(n.openai.theme=e.theme),e.maxHeight!==void 0&&(n.openai.maxHeight=e.maxHeight),e.locale!==void 0&&(n.openai.locale=e.locale),e.safeArea!==void 0&&(n.openai.safeArea=e.safeArea),e.userAgent!==void 0&&(n.openai.userAgent=e.userAgent),e.toolOutput!==void 0&&(n.openai.toolOutput=e.toolOutput),e.toolResponseMetadata!==void 0&&(n.openai.toolResponseMetadata=e.toolResponseMetadata);try{let e=new n.CustomEvent(`openai:set_globals`,{detail:{globals:{...n.openai}}});n.dispatchEvent(e)}catch{n.postMessage({type:`openai:globalsChanged`,updates:e},`*`)}}else ae.current={...ae.current||{},...e},t();p&&p(e)}catch{let t=m.current?.contentWindow;t&&t.postMessage({type:`openai:globalsChanged`,updates:e},`*`),p&&p(e)}}))},[p]);(0,w.useEffect)(()=>()=>{oe.current!==null&&(window.cancelAnimationFrame(oe.current),oe.current=null)},[]),(0,w.useEffect)(()=>{if(!r||!g||!m.current?.contentWindow)return;let e=r?.structuredContent||r,t=r?._meta||null,n=JSON.stringify(e);le.current!==n&&(le.current=n,Te({toolOutput:e,toolResponseMetadata:t}))},[r,g,Te]);let Ee=(0,w.useCallback)(async e=>{try{if(e===`fullscreen`){if(document.fullscreenElement){F(e),Te({displayMode:e});return}h.current&&(await h.current.requestFullscreen(),F(e),Te({displayMode:e}),console.log(`[OpenAIComponentRenderer] Entered fullscreen`))}else document.fullscreenElement&&await document.exitFullscreen(),F(e),Te({displayMode:e}),console.log(`[OpenAIComponentRenderer] Exited fullscreen`)}catch(t){console.error(`[OpenAIComponentRenderer] Fullscreen error:`,t),F(e),Te({displayMode:e})}},[Te]);return(0,w.useEffect)(()=>{if(!T)return;_(!1),b.current||y(!0),C(null);let e=!1,t=async e=>{if(!(!m.current||e.source!==m.current.contentWindow)){if(e.data?.type===`iframe-console-log`){if(e.data.level===`error`){let t=(Array.isArray(e.data.args)?e.data.args:[])[0],n=typeof t==`string`?t:typeof t?.message==`string`?t.message:`Widget runtime error`,r=typeof t?.error?.stack==`string`?t.error.stack:typeof t?.stack==`string`?t.stack:void 0;typeof window<`u`&&window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`iframe-console:error`,message:n,stack:r,timestamp:Date.now(),url:typeof e.data.url==`string`?e.data.url:void 0,toolId:ue},`*`)}return}if(e.data?.type===`mcp-inspector:getWidgetState`){try{let t=m.current?.contentWindow;t?.openai?.widgetState!==void 0&&m.current?.contentWindow?.postMessage({type:`mcp-inspector:widgetStateResponse`,toolId:e.data.toolId,state:t.openai.widgetState},`*`)}catch{}return}switch(e.data.type){case`openai:csp-violation`:ve(ue,{directive:e.data.directive,effectiveDirective:e.data.effectiveDirective,blockedUri:e.data.blockedUri,sourceFile:e.data.sourceFile,lineNumber:e.data.lineNumber,columnNumber:e.data.columnNumber,timestamp:e.data.timestamp||Date.now()});break;case`openai:setWidgetState`:break;case`openai:callTool`:try{if(!pe)throw Error(`Server connection not available`);let{toolName:t,params:n,requestId:r}=e.data,i=await pe.callTool(t,n||{},{timeout:6e5,resetTimeoutOnProgress:!0}),a;a=i&&typeof i==`object`?Array.isArray(i.contents)?{content:i.contents.map(e=>typeof e==`string`?{type:`text`,text:e}:e.type===`text`&&e.text?{type:`text`,text:e.text}:e.type===`image`&&e.data?{type:`image`,image_url:{url:e.data}}:{type:`text`,text:JSON.stringify(e)})}:{content:[{type:`text`,text:typeof i==`string`?i:JSON.stringify(i)}]}:{content:[{type:`text`,text:String(i)}]},m.current?.contentWindow?.postMessage({type:`openai:callTool:response`,requestId:r,result:a},`*`)}catch(t){console.error(`[OpenAIComponentRenderer] Tool call error:`,t),m.current?.contentWindow?.postMessage({type:`openai:callTool:response`,requestId:e.data.requestId,error:t instanceof Error?t.message:String(t)},`*`)}break;case`openai:sendFollowup`:try{let{message:t}=e.data,n=typeof t==`string`?t:t?.prompt||t;if(!n){console.warn(`[OpenAIComponentRenderer] No prompt in followup message`);return}let r=new window.CustomEvent(`mcp-inspector:widget-followup`,{detail:{prompt:n,serverId:i}});window.dispatchEvent(r);try{let e=JSON.parse(localStorage.getItem(`mcp-inspector-pending-followups`)||`[]`);e.push({prompt:n,serverId:i,timestamp:Date.now()}),localStorage.setItem(`mcp-inspector-pending-followups`,JSON.stringify(e.slice(-10)))}catch{}}catch(e){console.error(`[OpenAIComponentRenderer] Failed to send followup:`,e)}break;case`openai:requestDisplayMode`:try{let{mode:t}=e.data;t&&[`inline`,`pip`,`fullscreen`].includes(t)&&await Ee(t)}catch(e){console.error(`[OpenAIComponentRenderer] Failed to change display mode:`,e)}break;case`openai:notifyIntrinsicHeight`:try{let{height:t}=e.data;if(typeof t==`number`&&t>0){let e=t;if(P===`fullscreen`||P===`pip`){let n=typeof window<`u`?window.innerHeight:t;e=Math.min(t,n)}(t!==A.current||e!==D)&&(A.current=t,k.current=e,j.current=!0,O(e))}}catch(e){console.error(`[OpenAIComponentRenderer] Failed to handle intrinsic height notification:`,e)}break;default:break}}};window.addEventListener(`message`,t);let n=()=>{if(!e){if(e=!0,_(!0),C(null),m.current)try{let e=!!m.current.contentDocument;e&&I?cMe(m.current):e||L(!1)}catch{L(!1)}he&&setTimeout(()=>{Te({theme:he})},50)}},r=()=>{C(`Failed to load component`)},a=m.current;return a?.addEventListener(`load`,n),a?.addEventListener(`error`,r),a&&(a.contentDocument?.readyState===`complete`||a.contentDocument?.readyState===`interactive`)&&(a.contentDocument?.querySelectorAll(`script`).length??0)>0&&n(),()=>{window.removeEventListener(`message`,t),a?.removeEventListener(`load`,n),a?.removeEventListener(`error`,r)}},[T,I,Ee,pe,i,he,Te,ne]),(0,w.useEffect)(()=>{if(g){if(!I){Te({theme:he});return}try{if(!m.current?.contentDocument)return;let e=m.current.contentDocument.documentElement;e.setAttribute(`data-theme`,he),e.style.colorScheme=he,e.classList.remove(`light`,`dark`),e.classList.add(he)}catch{}Te({theme:he})}},[he,g,I,Te]),(0,w.useEffect)(()=>{!g||!v||(y(!1),b.current=!0)},[g,v]),(0,w.useEffect)(()=>{if(!T||!I)return;let e=()=>{if(j.current)return;let e=m.current;try{let t=e?.contentWindow?.document?.body;if(!e||!t)return;let n=t.scrollHeight||0,r=typeof window<`u`?window.innerHeight:n,i=Math.min(n,r);i>0&&i!==k.current&&(k.current=i,O(i))}catch{}},t,n=()=>{e(),t=window.requestAnimationFrame(n)};return n(),window.addEventListener(`resize`,e),()=>{window.cancelAnimationFrame(t),window.removeEventListener(`resize`,e)}},[T,I]),(0,w.useEffect)(()=>{let e=()=>{let e=h.current;if(!e)return;let t=e.clientHeight;N(t>D)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[D]),(0,w.useEffect)(()=>{let e=()=>{!document.fullscreenElement&&P===`fullscreen`?(F(`inline`),Te({displayMode:`inline`}),console.log(`[OpenAIComponentRenderer] Fullscreen exited by user`)):document.fullscreenElement&&P!==`fullscreen`&&(F(`fullscreen`),Te({displayMode:`fullscreen`}))};return document.addEventListener(`fullscreenchange`,e),document.addEventListener(`fullscreenerror`,e=>{console.error(`[OpenAIComponentRenderer] Fullscreen error:`,e)}),()=>{document.removeEventListener(`fullscreenchange`,e)}},[P,Te]),(0,w.useEffect)(()=>{if(T&&he&&g){let e=setTimeout(()=>{Te({theme:he})},0);return()=>clearTimeout(e)}},[he,T,g,Te]),x?(0,S.jsx)(`div`,{className:o,children:(0,S.jsx)(`div`,{className:`bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg p-4`,children:(0,S.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:[`Failed to load component: `,x]})})}):T?(0,S.jsxs)(NNe,{className:o,noWrapper:s,children:[v&&(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full z-0`,children:(0,S.jsx)(zq,{className:`size-5`})}),c&&I&&P!==`fullscreen`&&P!==`pip`&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-30 flex items-center gap-2`,children:(0,S.jsx)(U7,{displayMode:P,onDisplayModeChange:Ee,toolCallId:ue,propsContext:`tool`,resourceUri:e,toolInput:R,resourceAnnotations:void 0,llmConfig:null,resource:null,onPropsChange:void 0,protocol:`apps-sdk`,onUpdateGlobals:Te})}),(0,S.jsxs)(`div`,{ref:h,className:H(`w-full h-full flex flex-col justify-center items-center`,M&&`items-center`,P===`fullscreen`&&`bg-background`,P===`pip`&&`fixed top-4 left-1/2 -translate-x-1/2 z-50 rounded-3xl w-full min-w-[300px] h-[400px] shadow-2xl border overflow-hidden`),style:P===`pip`?{maxWidth:j7.DIMENSIONS.PIP_MAX_WIDTH}:void 0,onMouseEnter:()=>P===`pip`&&te(!0),onMouseLeave:()=>P===`pip`&&te(!1),children:[P===`fullscreen`&&document.fullscreenElement&&(0,S.jsx)(nMe,{title:t,onClose:()=>Ee(`inline`)}),P===`pip`&&(0,S.jsx)(`button`,{onClick:()=>Ee(`inline`),className:H(`absolute top-2 right-2 z-50`,`flex items-center justify-center`,`w-8 h-8 rounded-full`,`bg-background/90 hover:bg-background`,`border border-border`,`shadow-lg`,`transition-opacity duration-200`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,ee?`opacity-100`:`opacity-0`),"aria-label":`Exit Picture in Picture`,children:(0,S.jsx)(Fp,{className:`w-4 h-4 text-foreground`})}),(0,S.jsx)(`div`,{className:H(`flex-1 w-full flex justify-center items-center relative`,P===`fullscreen`&&`pt-14`,M&&`items-center`,P===`inline`&&(d||f)&&`pt-8`),children:(0,S.jsxs)(`div`,{className:`relative w-full max-w-[768px]`,children:[P===`inline`&&(d||f)&&(0,S.jsxs)(`div`,{className:`absolute -top-8 left-2 z-10 whitespace-nowrap`,children:[d&&!r&&(0,S.jsx)(jY,{className:`text-xs`,children:d}),f&&r&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f})]}),(0,S.jsx)(`iframe`,{ref:m,src:T,className:H(P===`inline`&&`w-full`,P===`fullscreen`&&`w-full h-full rounded-none`,P===`pip`&&`w-full h-full rounded-lg`),style:{height:P===`fullscreen`||P===`pip`?`100%`:`${D}px`},sandbox:A7,title:`OpenAI Component: ${t}`,allow:`web-share`})]})})]})]}):(0,S.jsx)(NNe,{className:o,noWrapper:s,children:(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})})})}function FNe(e,t){for(let n of[`componentUrl`,`toolName`,`serverId`,`toolArgs`,`toolResult`,`readResource`,`className`])if(e[n]!==t[n])return!1;return!(e.invoking!==t.invoking||e.invoked!==t.invoked)}var W7=(0,w.memo)(PNe,FNe),INe=(0,w.memo)(({resource:e})=>{if(!e.uri?.startsWith(`ui://`))return null;let t=(0,w.useMemo)(()=>{if(e.text)return e.text;if(e.blob)try{return atob(e.blob)}catch{return null}return null},[e.text,e.blob]);return t?(0,S.jsx)(`div`,{className:`my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card`,children:(0,S.jsx)(`iframe`,{srcDoc:t,sandbox:`allow-scripts allow-forms allow-popups`,title:e.uri??`MCP UI Resource`,style:{width:`100%`,height:`100%`,border:`none`,overflow:`auto`}})}):null});function LNe({widgetId:e}){let{getWidget:t}=yQ(),n=t(e)?.modelContext;if(!n?.content?.length&&!n?.structuredContent)return null;let r=n.content?.map(e=>e.text).join(` `)??JSON.stringify(n.structuredContent).slice(0,80);return(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] text-muted-foreground bg-muted/30 border border-border/40 rounded-md mt-1`,children:[(0,S.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-blue-400 shrink-0`}),(0,S.jsx)(`span`,{className:`font-medium`,children:`State synced to model`}),(0,S.jsx)(`span`,{className:`truncate opacity-60 max-w-[300px]`,children:r})]})}function RNe({toolName:e,toolArgs:t,result:n,serverId:r,readResource:i,toolMeta:a,onSendFollowUp:o,serverBaseUrl:s,partialToolArgs:c,cancelled:l}){let{playground:u}=yQ(),[d,f]=(0,w.useState)(null),p=(0,w.useRef)(null),m=(0,w.useMemo)(()=>`chat-tool-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,[e]),h=(0,w.useMemo)(()=>{if(!n)return null;if(typeof n==`string`)try{return JSON.parse(n)}catch(e){return console.error(`[ToolResultRenderer] Failed to parse result:`,e),n}return n},[n]),g=(0,w.useMemo)(()=>JSON.stringify(a),[a]),_=(0,w.useMemo)(()=>SQ(a,h),[g,h]),v=(0,w.useMemo)(()=>xQ(a),[g]),y=(0,w.useMemo)(()=>_?_===`both`?u.selectedProtocol?u.selectedProtocol:`mcp-apps`:_:null,[_,u.selectedProtocol]),b=(0,w.useMemo)(()=>y===`mcp-apps`,[y]),x=(0,w.useMemo)(()=>y===`chatgpt-app`,[y]),C=(0,w.useMemo)(()=>!!(h?.content&&Array.isArray(h.content)&&h.content.some(e=>e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType===`text/html+skybridge`)),[h]),T=(0,w.useMemo)(()=>C&&h.content.find(e=>e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType===`text/html+skybridge`)?.resource||null,[C,h]),E=(0,w.useMemo)(()=>t,[e,h]),D=(0,w.useMemo)(()=>h,[e,h]),O=(0,w.useMemo)(()=>v&&y?CQ(y,a):b?a?.ui?.resourceUri||null:x&&a?.[`openai/outputTemplate`]||null,[v,y,b,x,g]);(0,w.useEffect)(()=>{if(T){f(T),p.current=T.uri||null;return}O&&p.current===O||(O!==p.current&&f(null),O&&i&&(p.current=O,i(O).then(e=>{e?.contents&&Array.isArray(e.contents)&&e.contents.length>0&&f(e.contents[0])}).catch(e=>{console.error(`[ToolResultRenderer] Failed to fetch resource:`,e),p.current=null})))},[T,O,y,i]);let k=a?.[`openai/toolInvocation/invoking`],A=a?.[`openai/toolInvocation/invoked`];if(v&&d&&r&&i)return(0,S.jsxs)(`div`,{className:`my-4`,children:[y===`mcp-apps`&&(0,S.jsx)(N7,{serverId:r,toolCallId:m,toolName:e,toolInput:E,toolOutput:D,toolMetadata:a,invoking:k,invoked:A,partialToolInput:c,resourceUri:d.uri,readResource:i,noWrapper:!0,onSendFollowUp:o,serverBaseUrl:s,cancelled:l}),y===`chatgpt-app`&&(0,S.jsx)(W7,{componentUrl:d.uri,toolName:e,toolArgs:E,toolResult:D,serverId:r,readResource:i,noWrapper:!0,showConsole:!1,invoking:k,invoked:A,serverBaseUrl:s})]});if(b&&O&&r&&i)return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(N7,{serverId:r,toolCallId:m,toolName:e,toolInput:E,toolOutput:D,toolMetadata:a,invoking:k,invoked:A,partialToolInput:c,resourceUri:d?.uri||O,readResource:i,className:`my-4`,noWrapper:!0,onSendFollowUp:o,serverBaseUrl:s}),(0,S.jsx)(LNe,{widgetId:m})]});if((x||C)&&O&&r&&i)return(0,S.jsx)(W7,{componentUrl:d?.uri||O,toolName:e,toolArgs:E,toolResult:D,serverId:r,readResource:i,noWrapper:!0,className:`my-4`,showConsole:!1,invoking:k,invoked:A,serverBaseUrl:s});if((b||x||C)&&!O)return(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px] rounded border`,children:(0,S.jsx)(zq,{className:`size-5`})});if((b||x)&&(!r||!i))return console.error(`[ToolResultRenderer] Apps SDK tool but missing serverId or readResource:`,{toolName:e,hasServerId:!!r,hasReadResource:!!i}),(0,S.jsx)(`div`,{className:`my-4 p-4 bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`Cannot render widget: Missing required props (serverId or readResource)`})});let j=[];if(h?.content&&Array.isArray(h.content))for(let e of h.content)e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType!==`text/html+skybridge`&&j.push(e.resource);return j.length>0?(0,S.jsx)(S.Fragment,{children:j.map(t=>(0,S.jsx)(INe,{resource:t},`${e}-mcp-ui-${t.uri}`))}):(console.log(`[ToolResultRenderer] Not rendering (no UI resources found):`,{toolName:e,isAppsSdkTool:x,hasAppsSdkComponent:C,hasResourceData:!!d,contentLength:h?.content?.length}),null)}function zNe({content:e,timestamp:t,attachments:n}){return(!e||e.length===0)&&(!n||n.length===0)?null:(0,S.jsx)(`div`,{className:`flex items-start gap-3 justify-end group/user-message`,"data-testid":`chat-message-user`,children:(0,S.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col items-end`,children:[(0,S.jsxs)(`div`,{className:`bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words`,"data-testid":`chat-message-content`,children:[n&&n.length>0&&(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-2`,children:n.map((e,t)=>(0,S.jsx)(`div`,{className:`rounded-lg overflow-hidden border border-zinc-300 dark:border-zinc-700`,children:(0,S.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:e.name||`Attachment ${t+1}`,className:`max-w-[200px] max-h-[200px] object-contain`})},t))}),e&&e.length>0&&(0,S.jsx)(`p`,{className:`text-base leading-7 font-sans text-start break-words`,children:e})]}),t&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground mt-1`,children:new Date(t).toLocaleTimeString()})]})})}function G7(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.const==`string`&&(t.title===void 0||typeof t.title==`string`)}function BNe(e){let t=Array.isArray(e.oneOf)?e.oneOf.filter(G7):[],n=Array.isArray(e.anyOf)?e.anyOf.filter(G7):[];return t.length>0?t:n}function VNe(e){let t=e.items&&typeof e.items==`object`?e.items:{},n=Array.isArray(t.anyOf)?t.anyOf.filter(G7):[],r=Array.isArray(t.oneOf)?t.oneOf.filter(G7):[];return n.length>0?n:r}function HNe({request:e,formData:t,onFieldChange:n,idPrefix:r,testIdPrefix:i,fieldContainerClassName:a=`space-y-2`,textareaRows:o=4,showOuterLabelForBoolean:s=!0,emptyFallback:c}){return(0,S.jsx)(S.Fragment,{children:(0,w.useMemo)(()=>{if(!(`requestedSchema`in e.request))return null;let l=e.request.requestedSchema;if(!l||l.type!==`object`||!l.properties)return c??(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No form schema available`});let u=l.properties,d=l.required||[];return(0,S.jsx)(`div`,{className:`space-y-4`,children:Object.entries(u).map(([e,c])=>{let l=c,u=d.includes(e),f=l.type||`string`,p=l.title||e,m=l.description,h=BNe(l),g=h.length>0,_=Array.isArray(l.enum),v=f===`array`&&Array.isArray(l.items?.enum),y=VNe(l),b=f===`array`&&y.length>0,x=Array.isArray(t[e])?t[e]:[],C=`${r}-${e}`,w=`${i}-${e}`;return(0,S.jsxs)(`div`,{className:a,children:[(f!==`boolean`||s)&&(0,S.jsxs)(ON,{htmlFor:C,children:[p,u&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),m&&(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m}),f===`boolean`?(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:C,"data-testid":w,checked:t[e]||!1,onCheckedChange:t=>n(e,t)}),(0,S.jsxs)(ON,{htmlFor:C,className:`text-sm font-normal cursor-pointer`,children:[p,!s&&u&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]})]}):f===`number`||f===`integer`?(0,S.jsx)(TN,{id:C,"data-testid":w,type:`number`,value:t[e]??``,onChange:t=>{let r=f===`integer`?parseInt(t.target.value,10):parseFloat(t.target.value);n(e,isNaN(r)?``:r)},placeholder:l.default?.toString()||``}):g?(0,S.jsxs)(`select`,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,S.jsx)(`option`,{value:``,children:`Select...`}),h.map(e=>(0,S.jsx)(`option`,{value:e.const,children:e.title||e.const},e.const))]}):_?(0,S.jsxs)(`select`,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,S.jsx)(`option`,{value:``,children:`Select...`}),l.enum.map((e,t)=>(0,S.jsx)(`option`,{value:e,children:l.enumNames?.[t]||e},e))]}):v?(0,S.jsx)(`div`,{className:`space-y-2`,"data-testid":w,children:l.items.enum.map(t=>{let r=`${C}-${t}`;return(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:r,checked:x.includes(t),onCheckedChange:r=>{n(e,r?[...x,t]:x.filter(e=>e!==t))}}),(0,S.jsx)(ON,{htmlFor:r,className:`text-sm font-normal cursor-pointer`,children:t})]},t)})}):b?(0,S.jsx)(`div`,{className:`space-y-2`,"data-testid":w,children:y.map(t=>{let r=`${C}-${t.const}`;return(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:r,checked:x.includes(t.const),onCheckedChange:r=>{n(e,r?[...x,t.const]:x.filter(e=>e!==t.const))}}),(0,S.jsx)(ON,{htmlFor:r,className:`text-sm font-normal cursor-pointer`,children:t.title||t.const})]},t.const)})}):f===`string`&&(l.format===`textarea`||l.maxLength>100)?(0,S.jsx)(fY,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),placeholder:l.default||``,rows:o}):(0,S.jsx)(TN,{id:C,"data-testid":w,type:`text`,value:t[e]||``,onChange:t=>n(e,t.target.value),placeholder:l.default||``})]},e)})})},[e,t,n,r,i,a,o,s,c])})}function UNe(e){let[t,n]=(0,w.useState)({}),[r,i]=(0,w.useState)(!1),a=e?.request.mode||`form`,o=a===`form`,s=a===`url`;return(0,w.useEffect)(()=>{if(e&&o&&`requestedSchema`in e.request){let t=e.request.requestedSchema,r={};if(t?.type===`object`&&t.properties)for(let[e,n]of Object.entries(t.properties)){let t=n;t.default===void 0?t.type===`array`?r[e]=[]:t.type===`boolean`?r[e]=!1:t.type===`number`||t.type===`integer`?r[e]=0:r[e]=``:r[e]=t.default}n(r)}i(!1)},[e?.id,o]),{formData:t,setFieldValue:(0,w.useCallback)((e,t)=>{n(n=>({...n,[e]:t}))},[]),getMissingRequiredFields:(0,w.useCallback)(()=>!e||!o||!(`requestedSchema`in e.request)?[]:(e.request.requestedSchema?.required??[]).filter(e=>t[e]===void 0||t[e]===``||t[e]===null),[e,t,o]),urlCompleted:r,setUrlCompleted:i,mode:a,isFormMode:o,isUrlMode:s}}function WNe({request:e,onApprove:t,onReject:n}){let{formData:r,setFieldValue:i,getMissingRequiredFields:a,urlCompleted:o,setUrlCompleted:s,mode:c,isFormMode:l,isUrlMode:u}=UNe(e),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(``),h=()=>{if(!d)if(l){let n=a();if(n.length>0){PM.error(`Missing required fields`,{description:`Please fill in: ${n.join(`, `)}`});return}f(!0),m(`accepted`),t(e.id,{action:`accept`,content:r})}else u&&(f(!0),m(`accepted`),t(e.id,{action:`accept`}))},g=()=>{d||(f(!0),m(`declined`),t(e.id,{action:`decline`}))},_=()=>{d||(f(!0),m(`cancelled`),n(e.id,`User cancelled elicitation request`))},v=u&&`url`in e.request?e.request.url:null;return d?(0,S.jsxs)(`div`,{className:`rounded-lg border border-dashed bg-muted/30 p-3 text-sm text-muted-foreground max-w-2xl`,children:[`Elicitation `,p,` — the tool will continue executing.`]}):(0,S.jsxs)(`div`,{className:`rounded-lg border bg-card shadow-sm p-4 space-y-4 max-w-2xl`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,S.jsx)(`span`,{className:`font-medium text-sm text-card-foreground`,children:`Elicitation Request`}),(0,S.jsx)(kt,{variant:`outline`,className:u?`bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30`:`bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30`,children:c}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.serverName})]}),(0,S.jsx)(`p`,{className:`text-sm text-card-foreground`,children:e.request.message}),u&&`url`in e.request&&(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-muted rounded border`,children:[(0,S.jsx)(`code`,{className:`flex-1 text-xs font-mono break-all`,children:v}),(0,S.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>{window.open(v??``,`_blank`),s(!0)},children:[(0,S.jsx)(Ff,{className:`h-3 w-3 mr-1`}),`Open`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:`inline-url-done-${e.id}`,checked:o,onCheckedChange:e=>s(!!e)}),(0,S.jsx)(ON,{htmlFor:`inline-url-done-${e.id}`,className:`text-sm font-normal cursor-pointer`,children:`I have completed the required action`})]})]}),l&&(0,S.jsx)(HNe,{request:e,formData:r,onFieldChange:i,idPrefix:`inline-field-${e.id}`,testIdPrefix:`inline-elicitation-field`,fieldContainerClassName:`space-y-1.5`,textareaRows:3,showOuterLabelForBoolean:!1,emptyFallback:(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No form schema provided.`})}),(0,S.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,S.jsx)(U,{size:`sm`,onClick:h,disabled:u&&!o,"data-testid":`inline-elicitation-accept`,children:`Accept`}),(0,S.jsx)(U,{size:`sm`,variant:`outline`,onClick:g,"data-testid":`inline-elicitation-decline`,children:`Decline`}),(0,S.jsx)(U,{size:`sm`,variant:`outline`,onClick:_,"data-testid":`inline-elicitation-cancel`,children:`Cancel`})]})]})}var GNe=(0,w.memo)(({messages:e,isLoading:t,serverId:n,readResource:r,tools:i,sendMessage:a,serverBaseUrl:o,pendingElicitationRequests:s,onApproveElicitation:c,onRejectElicitation:l})=>{let u=(0,w.useRef)(null),d=e=>{let t=e=>e.replace(/-/g,`_`),n=t(e);return i?.find(e=>t(e.name)===n)?._meta},f=e=>{let t=SQ(d(e),void 0);return t!==null&&t!==`mcp-ui`},p=(0,w.useCallback)(e=>{let t=e.filter(e=>e.type===`text`&&`text`in e).map(e=>e.text).join(`
|
|
795
|
-
`),n=e.filter(e=>e.type===`image`&&`data`in e&&`mimeType`in e).map(e=>({type:`image`,data:e.data,mimeType:e.mimeType}));a?.(t,n.length>0?n:void 0)},[a]);(0,w.useEffect)(()=>{e.length>0&&u.current&&u.current.scrollIntoView({behavior:t?`auto`:`smooth`,block:`start`})},[e.length,t]);let m=t&&(()=>{if(e.length===0)return!0;let t=e[e.length-1];if(t.role===`user`)return!0;if(t.role===`assistant`){if(t.parts&&t.parts.length>0)return!1;let e=typeof t.content==`string`?t.content:Array.isArray(t.content)?t.content.map(e=>typeof e==`string`?e:e.text||JSON.stringify(e)).join(``):JSON.stringify(t.content);return!(e&&e.trim().length>0)}return!1})(),h=n=>{if(!t)return!1;let r=e[e.length-1];return n.id===r.id&&r.role===`assistant`};return(0,S.jsxs)(`div`,{className:`space-y-6 max-w-3xl mx-auto px-2`,children:[e.map(e=>{let t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:e.text||JSON.stringify(e)).join(``):JSON.stringify(e.content);return e.role===`user`?(0,S.jsx)(zNe,{content:t,timestamp:e.timestamp,attachments:e.attachments},e.id):e.role===`assistant`?(0,S.jsx)(`div`,{className:`space-y-4`,children:e.parts&&e.parts.length>0?e.parts.map((t,i)=>{let a=t.type===`text`?`${e.id}-text-${i}-${t.text?.slice(0,20)}`:`${e.id}-tool-${t.toolInvocation?.toolName}-${i}`;return t.type===`text`?(0,S.jsx)(
|
|
794
|
+
`)}function U7({displayMode:e,onDisplayModeChange:t,toolCallId:n,propsContext:r,resourceUri:i,toolInput:a,resourceAnnotations:o,llmConfig:s,resource:c,onPropsChange:l,requiredProps:u,protocol:d=`mcp-apps`,onUpdateGlobals:f}){let{resolvedTheme:p,setTheme:m}=FP(),{playground:h,updatePlaygroundSettings:g,widgets:_,clearCspViolations:v}=bQ(),y=_.get(n),b=y?.cspViolations??[],x=y?.declaredCsp,C=y?.effectivePolicy,T=b.length>0?kNe(b,x):null,E=b.length>0?MNe(x,C,b,T):``,D=e===`fullscreen`,O=e===`pip`,k=d===`apps-sdk`,{presets:A,activePresetId:j,savePreset:M,deletePreset:N,setActivePreset:P,getActiveProps:F}=uMe(i),[I,L]=(0,w.useState)(!1),ee=!!u?.length&&!j,[te,ne]=(0,w.useState)(()=>ee);(0,w.useEffect)(()=>{ee&&ne(!0)},[ee]);let[re,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(!1),[ie,ae]=(0,w.useState)(!1),[oe,se]=(0,w.useState)(!1),[ce,le]=(0,w.useState)(!1),[ue,de]=(0,w.useState)(!0),[fe,pe]=(0,w.useState)(!0),[me,he]=(0,w.useState)(!0),ge=(0,w.useCallback)(()=>r===`tool`&&a?H7:V7,[r,a]),[_e,ve]=(0,w.useState)(ge());(0,w.useEffect)(()=>{j&&r!==`tool`?ve(j):_e!==V7&&_e!==H7&&ve(ge())},[j,_e,ge,r]),(0,w.useEffect)(()=>{l&&(_e===V7||_e===H7?l(null):j&&l(F()))},[_e,j,a,F,l]);let ye=e=>{if(e===ONe){R(null),L(!0);return}e===V7||e===H7?(P(null),ve(e)):(P(e),ve(e))},be=e=>{M(e),P(e.id),ve(e.id)},xe=(e,t)=>{t.stopPropagation();let n=A.find(t=>t.id===e);n&&(N(e),PM.success(`Preset deleted`,{description:`Preset "${n.name}" has been deleted.`}))},Se=(e,t)=>{t.stopPropagation(),R(e),L(!0)};return(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!D&&!O&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-fullscreen-button`,variant:`outline`,size:`sm`,className:`bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>t(`fullscreen`),children:(0,S.jsx)(Qf,{className:`size-4`})})}),(0,S.jsx)(jd,{children:`Enter fullscreen mode`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-pip-button`,variant:`outline`,size:`sm`,className:`bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>t(`pip`),children:(0,S.jsx)(sp,{className:`size-4`})})}),(0,S.jsx)(jd,{children:`Picture-in-picture`})]})]}),(0,S.jsxs)(yN,{open:z,onOpenChange:B,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-device-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(()=>{switch(h.deviceType){case`mobile`:return(0,S.jsx)(Sp,{className:`size-3`});case`tablet`:return(0,S.jsx)(Ap,{className:`size-3`});default:return(0,S.jsx)(rp,{className:`size-3`})}})()})})}),(0,S.jsxs)(jd,{children:[`Device: `,h.deviceType]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[300px]`,"data-testid":`debugger-device-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Device Type`})}),(0,S.jsx)(`div`,{className:`space-y-2`,children:[{value:`desktop`,label:`Desktop`,icon:rp},{value:`mobile`,label:`Mobile`,icon:Sp},{value:`tablet`,label:`Tablet`,icon:Ap}].map(e=>{let t=e.icon;return(0,S.jsxs)(U,{"data-testid":`debugger-device-option-${e.value}`,variant:h.deviceType===e.value?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({deviceType:e.value}),k&&f&&f({userAgent:{device:{type:e.value},capabilities:h.capabilities}}),B(!1)},children:[(0,S.jsx)(t,{className:`size-4 mr-2`}),e.label]},e.value)})})]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-theme-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,onClick:()=>{let e=p===`dark`?`light`:`dark`;m(e),f&&f({theme:e})},children:p===`dark`?(0,S.jsx)(ip,{className:`size-3.5`}):(0,S.jsx)(kp,{className:`size-3.5`})})}),(0,S.jsxs)(jd,{children:[`Theme: `,p===`dark`?`Dark`:`Light`]})]}),(0,S.jsxs)(yN,{open:ie,onOpenChange:ae,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-locale-button`,variant:`outline`,size:`sm`,className:`h-8 min-w-[50px] px-2 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(`span`,{className:`text-xs font-mono`,children:h.locale})})})}),(0,S.jsx)(jd,{children:`Locale`})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[400px]`,"data-testid":`debugger-locale-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Select Locale`})}),(0,S.jsxs)(AJ,{children:[(0,S.jsx)(jJ,{placeholder:`Search locales...`,"data-testid":`debugger-locale-search`}),(0,S.jsxs)(MJ,{children:[(0,S.jsx)(NJ,{children:`No locale found.`}),(0,S.jsx)(PJ,{children:Zje.map(e=>(0,S.jsx)(FJ,{value:e.value,"data-testid":`debugger-locale-option-${e.value}`,onSelect:()=>{g({locale:e.value}),k&&f&&f({locale:e.value}),ae(!1)},children:e.label},e.value))})]})]})]})]}),!k&&(0,S.jsxs)(yN,{open:oe,onOpenChange:se,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-timezone-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(Df,{className:`size-3.5`})})})}),(0,S.jsxs)(jd,{children:[`Timezone: `,h.timeZone]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[400px]`,"data-testid":`debugger-timezone-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Select Timezone`})}),(0,S.jsxs)(AJ,{children:[(0,S.jsx)(jJ,{placeholder:`Search timezones...`,"data-testid":`debugger-timezone-search`}),(0,S.jsxs)(MJ,{children:[(0,S.jsx)(NJ,{children:`No timezone found.`}),(0,S.jsx)(PJ,{children:$je.map(e=>(0,S.jsx)(FJ,{value:e.value,"data-testid":`debugger-timezone-option-${e.value.replace(/\//g,`-`)}`,onSelect:()=>{g({timeZone:e.value}),se(!1)},children:e.label},e.value))})]})]})]})]}),(0,S.jsxs)(yN,{open:ce,onOpenChange:le,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`debugger-csp-button`,variant:`outline`,size:`sm`,className:`relative h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:[h.cspMode===`permissive`?(0,S.jsx)(bp,{className:`size-3.5`}):(0,S.jsx)(yp,{className:`size-3.5`}),b.length>0&&(0,S.jsx)(`span`,{className:`absolute -top-1.5 -right-1.5 flex h-4 min-w-4 items-center justify-center rounded-full px-0.5 text-[9px] font-bold text-white leading-none ${h.cspMode===`permissive`?`bg-yellow-500`:`bg-red-500`}`,children:b.length>99?`99+`:b.length})]})})}),(0,S.jsxs)(jd,{children:[`CSP:`,` `,h.cspMode===`permissive`?`Permissive`:`Declared`,b.length>0&&` · ${b.length} ${h.cspMode===`permissive`?`would be blocked`:`blocked`}`]})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[520px] max-h-[85vh] overflow-y-auto`,"data-testid":`debugger-csp-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`CSP Mode`})}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(U,{"data-testid":`debugger-csp-option-permissive`,variant:h.cspMode===`permissive`?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({cspMode:`permissive`}),le(!1)},children:[(0,S.jsx)(bp,{className:`size-4 mr-2`}),(0,S.jsx)(`div`,{className:`flex flex-col items-start`,children:(0,S.jsx)(`span`,{children:`Permissive`})})]}),(0,S.jsxs)(U,{"data-testid":`debugger-csp-option-widget-declared`,variant:h.cspMode===`widget-declared`?`default`:`outline`,className:`w-full justify-start`,onClick:()=>{g({cspMode:`widget-declared`}),le(!1)},children:[(0,S.jsx)(yp,{className:`size-4 mr-2`}),(0,S.jsx)(`div`,{className:`flex flex-col items-start`,children:(0,S.jsx)(`span`,{children:`Widget-Declared`})})]})]}),(0,S.jsxs)(`div`,{className:`mt-3 border border-zinc-200 dark:border-zinc-700 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm font-medium bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors`,onClick:()=>de(e=>!e),children:[ue?(0,S.jsx)(yf,{className:`size-3.5 shrink-0`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0`}),`Current declared CSP`]}),ue&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0 space-y-1.5 text-xs`,children:x?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`connectDomains:`}),` `,x.connectDomains?.length?JSON.stringify(x.connectDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`resourceDomains:`}),` `,x.resourceDomains?.length?JSON.stringify(x.resourceDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`frameDomains:`}),` `,x.frameDomains?.length?JSON.stringify(x.frameDomains):`Not declared`]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`span`,{className:`font-mono text-zinc-500 dark:text-zinc-400`,children:`baseUriDomains:`}),` `,x.baseUriDomains?.length?JSON.stringify(x.baseUriDomains):`Not declared`]})]}):(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400`,children:h.cspMode===`permissive`?`Widget-declared (would apply in Widget-Declared mode)`:`No CSP declared`})})]}),(0,S.jsxs)(`div`,{className:`mt-3 border border-zinc-200 dark:border-zinc-700 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex-1 flex items-center gap-2 text-left text-sm font-medium min-w-0`,onClick:()=>pe(e=>!e),children:[fe?(0,S.jsx)(yf,{className:`size-3.5 shrink-0`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0`}),`originalPolicy`]}),C&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0`,onClick:async e=>{e.stopPropagation();try{await dj(C),PM.success(`Policy copied to clipboard`)}catch{PM.error(`Failed to copy`)}},"aria-label":`Copy policy`,children:(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(jd,{children:`Copy policy`})]})]}),fe&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:C?(0,S.jsx)(`pre`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 whitespace-pre-wrap break-all bg-zinc-50 dark:bg-zinc-900 p-2 rounded border border-zinc-100 dark:border-zinc-800`,children:C}):(0,S.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400 text-xs`,children:`No policy data yet (load widget in Widget-Declared mode)`})})]}),b.length>-1&&(0,S.jsxs)(`div`,{className:`mt-3 border border-amber-200 dark:border-amber-800 rounded-md overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 bg-amber-50 dark:bg-amber-950/30 hover:bg-amber-100 dark:hover:bg-amber-900/30 transition-colors`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex-1 flex items-center gap-2 text-left text-sm font-medium min-w-0 text-amber-800 dark:text-amber-200`,onClick:()=>he(e=>!e),children:[me?(0,S.jsx)(yf,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):(0,S.jsx)(xf,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}),`Prompt for Agents`]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0 text-amber-600 dark:text-amber-400 hover:bg-amber-200/50 dark:hover:bg-amber-800/30`,onClick:async e=>{e.stopPropagation();try{await dj(E),PM.success(`Prompt copied to clipboard`)}catch{PM.error(`Failed to copy`)}},"aria-label":`Copy prompt for agents`,children:(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(jd,{children:`Copy prompt for agents`})]})]}),me&&(0,S.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:(0,S.jsx)(`pre`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 whitespace-pre-wrap bg-zinc-50 dark:bg-zinc-900 p-2 rounded border border-zinc-100 dark:border-zinc-800 overflow-x-auto max-h-48 overflow-y-auto`,"data-testid":`debugger-csp-prompt-for-agents`,children:E})})]}),b.length>0&&(0,S.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`span`,{className:`text-xs font-semibold uppercase tracking-wide ${h.cspMode===`permissive`?`text-yellow-600 dark:text-yellow-400`:`text-red-600 dark:text-red-400`}`,children:[b.length,` `,h.cspMode===`permissive`?`would-be-blocked`:`blocked`,` `,`request`,b.length===1?``:`s`]}),(0,S.jsx)(`button`,{className:`text-xs text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 underline`,onClick:()=>v(n),children:`Clear`})]}),(0,S.jsx)(`div`,{className:`max-h-56 overflow-y-auto space-y-1 rounded border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 p-2`,children:b.map((e,t)=>(0,S.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1 border-b border-zinc-100 dark:border-zinc-800 last:border-0`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,S.jsx)(`span`,{className:`shrink-0 rounded bg-red-100 dark:bg-red-900/40 px-1 py-0.5 text-[10px] font-mono font-semibold text-red-700 dark:text-red-300`,children:e.effectiveDirective||e.directive})}),(0,S.jsx)(`span`,{className:`text-[11px] font-mono text-zinc-600 dark:text-zinc-400 break-all leading-snug`,children:e.blockedUri||`(inline)`})]},t))})]})]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-touch-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.touch?`border-blue-500 dark:border-blue-400`:``}`,onClick:()=>{let e={...h.capabilities,touch:!h.capabilities.touch};g({capabilities:e}),k&&f&&f({userAgent:{device:{type:h.deviceType},capabilities:e}})},children:(0,S.jsx)(up,{className:`size-3.5 ${h.capabilities.touch?`text-blue-600 dark:text-blue-400`:``}`})})}),(0,S.jsxs)(jd,{children:[`Touch: `,h.capabilities.touch?`Enabled`:`Disabled`]})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-hover-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.hover?`border-blue-500 dark:border-blue-400`:``}`,onClick:()=>{let e={...h.capabilities,hover:!h.capabilities.hover};g({capabilities:e}),k&&f&&f({userAgent:{device:{type:h.deviceType},capabilities:e}})},children:(0,S.jsx)(ap,{className:`size-3.5 ${h.capabilities.hover?`text-blue-600 dark:text-blue-400`:``}`})})}),(0,S.jsxs)(jd,{children:[`Hover: `,h.capabilities.hover?`Enabled`:`Disabled`]})]}),(0,S.jsxs)(QJ,{children:[(0,S.jsx)($J,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`debugger-safe-area-button`,variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,children:(0,S.jsx)(Tp,{className:`size-3.5`})})}),(0,S.jsx)(eY,{className:`w-64 p-3`,"data-testid":`debugger-safe-area-dialog`,children:(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-xs font-medium`,children:`Safe Area Insets`}),(0,S.jsx)(DNe,{value:h.safeAreaInsets,onChange:e=>{g({safeAreaInsets:e}),k&&f&&f({safeArea:{insets:e}})}})]})})]}),r===`tool`?(0,S.jsxs)(yN,{children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(bN,{asChild:!0,children:(0,S.jsx)(U,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900`,"data-testid":`debugger-props-button`,children:(0,S.jsx)(mf,{className:`size-3.5`})})})}),(0,S.jsx)(jd,{children:`View Tool Props`})]}),(0,S.jsxs)(xN,{className:`sm:max-w-[600px]`,"data-testid":`debugger-props-dialog`,children:[(0,S.jsx)(SN,{children:(0,S.jsx)(CN,{children:`Tool Props`})}),(0,S.jsx)(`div`,{className:`overflow-auto max-h-[60vh] rounded-md bg-gray-50 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-700 p-3`,children:(0,S.jsx)(RV,{data:a??{},filename:`tool-props.json`})})]})]}):(0,S.jsxs)(QJ,{open:te,onOpenChange:ne,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)($J,{asChild:!0,children:(0,S.jsx)(U,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0 backdrop-blur-sm shadow-sm ${ee?`bg-amber-50 dark:bg-amber-950/40 border-amber-300 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/50 animate-pulse`:`bg-white/90 dark:bg-zinc-900/90 hover:bg-white dark:hover:bg-zinc-900`}`,"data-testid":`debugger-props-button`,children:(0,S.jsx)(mf,{className:`size-3.5 ${ee?`text-amber-500`:``}`})})})}),(0,S.jsxs)(jd,{children:[`Props:`,` `,_e===V7?`No Props`:_e===H7?`Tool Props`:A.find(e=>e.id===_e)?.name||`Custom`]})]}),(0,S.jsxs)(eY,{className:`w-64 p-2`,"data-testid":`debugger-props-popover`,children:[ee&&(0,S.jsxs)(`div`,{className:`mb-2 rounded-md border border-amber-200 dark:border-amber-800/50 bg-amber-50 dark:bg-amber-950/30 px-3 py-2`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-amber-700 dark:text-amber-300 mb-0.5`,children:`Props required to render this widget:`}),(0,S.jsx)(`p`,{className:`text-xs font-mono text-amber-600 dark:text-amber-400`,children:u.join(`, `)}),(0,S.jsx)(`p`,{className:`text-xs text-amber-500 dark:text-amber-400 mt-1`,children:`Create a preset below to set them.`})]}),(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(U,{variant:_e===V7?`secondary`:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>ye(V7),"data-testid":`debugger-props-no-props`,children:`No Props`}),A.map(e=>(0,S.jsxs)(`div`,{className:`relative group flex items-center`,children:[(0,S.jsx)(U,{variant:_e===e.id?`secondary`:`ghost`,size:`sm`,className:`w-full justify-start pr-14`,onClick:()=>ye(e.id),"data-testid":`debugger-props-preset-${e.id}`,children:e.name}),(0,S.jsxs)(`div`,{className:`absolute right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:t=>Se(e,t),"data-testid":`debugger-props-edit-${e.id}`,children:(0,S.jsx)(vp,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:t=>xe(e.id,t),"data-testid":`debugger-props-delete-${e.id}`,children:(0,S.jsx)(Mp,{className:`h-3 w-3 text-destructive`})})]})]},e.id)),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`w-full justify-start text-primary`,onClick:()=>ye(ONe),"data-testid":`debugger-props-create-preset`,children:`+ Create Preset...`})]})]})]}),(0,S.jsx)(bMe,{iframeId:n,enabled:!0}),c&&(0,S.jsx)(ENe,{open:I,onOpenChange:L,onSave:be,existingPresets:A,resource:c,resourceAnnotations:o,llmConfig:s||null,editingPreset:re})]})}function NNe({children:e,className:t,noWrapper:n}){return n?e:(0,S.jsx)(`div`,{className:H(`bg-zinc-100 dark:bg-zinc-900 bg-[radial-gradient(circle,_rgba(0,0,0,0.2)_1px,_transparent_1px)] dark:bg-[radial-gradient(circle,_rgba(255,255,255,0.2)_1px,_transparent_1px)] bg-[length:32px_32px]`,t),children:e})}function PNe({componentUrl:e,toolName:t,toolArgs:n,toolResult:r,serverId:i,readResource:a,className:o,noWrapper:s=!1,showConsole:c=!0,customProps:l,serverBaseUrl:u,invoking:d,invoked:f,onUpdateGlobals:p}){let m=(0,w.useRef)(null),h=(0,w.useRef)(null),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!0),b=(0,w.useRef)(!1),[x,C]=(0,w.useState)(null),[T,E]=(0,w.useState)(null),[D,O]=(0,w.useState)(400),k=(0,w.useRef)(0),A=(0,w.useRef)(0),j=(0,w.useRef)(!1),[M,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(`inline`),[I,L]=(0,w.useState)(!1),[ee,te]=(0,w.useState)(!1),[ne,re]=(0,w.useState)(!1),[R,z]=(0,w.useState)(null),[B,ie]=(0,w.useState)(null),ae=(0,w.useRef)(null),oe=(0,w.useRef)(null),se=(0,w.useRef)(null),ce=(0,w.useRef)(!1),le=(0,w.useRef)(null),ue=(0,w.useRef)(`tool-${Date.now()}-${Math.random().toString(36).substring(7)}`).current,de=(0,w.useRef)(!1),{servers:fe}=uj(),pe=fe.find(e=>e.id===i),me=u??pe?.url,{resolvedTheme:he}=FP(),{playground:ge,addWidget:_e,addCspViolation:ve}=bQ(),ye=(0,w.useRef)(n),be=(0,w.useRef)(r),xe=(0,w.useRef)(a),Se=(0,w.useRef)(me),Ce=(0,w.useRef)(he),we=(0,w.useRef)(l);(0,w.useEffect)(()=>{ye.current=n,be.current=r,xe.current=a,Se.current=me,Ce.current=he,we.current=l}),(0,w.useEffect)(()=>{let n=!1;return(async()=>{let r=be.current,a=xe.current,o=Ce.current,s=ge;console.log(`[OpenAIComponentRenderer] Storing widget data with playground:`,{locale:s.locale,deviceType:s.deviceType});try{let c=r?r.structuredContent??{}:null,l=await a(e);if(n)return;let u=null;r?._meta?.[`openai/widgetCSP`]?u=r._meta[`openai/widgetCSP`]:l?.contents?.[0]?._meta?.[`openai/widgetCSP`]&&(u=l.contents[0]._meta[`openai/widgetCSP`]);let d=ye.current,f=we.current,p={...d||{},...f||{}},m={serverId:i,uri:e,toolInput:p,toolOutput:c,toolResponseMetadata:null,resourceData:l,toolId:ue,widgetCSP:u,theme:o,playground:{locale:s.locale,deviceType:s.deviceType,capabilities:s.capabilities,safeAreaInsets:s.safeAreaInsets}},h=await fetch(`/inspector/api/resources/widget/store`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(m)});if(!h.ok){let e=await h.json().catch(()=>({error:`Unknown error`}));throw Error(`Failed to store widget data: ${e.error||h.statusText}`)}if(n)return;z(p),ie(c),re(!1),de.current||(de.current=!0,E(`/inspector/api/resources/widget-content/${ue}?t=${Date.now()}`),_e(ue,{toolName:t,protocol:`chatgpt-app`})),L(!0)}catch(e){if(n)return;console.error(`Error storing widget data:`,e),C(e instanceof Error?e.message:`Failed to prepare widget`)}})(),()=>{n=!0}},[e,i,ue,l,JSON.stringify(n),r]);let Te=(0,w.useCallback)(e=>{if(se.current={...se.current||{},...e},!m.current?.contentWindow){p&&p(e);return}ce.current||(ce.current=!0,queueMicrotask(()=>{ce.current=!1;let e=se.current;if(se.current=null,!e)return;let t=()=>{if(oe.current!==null)return;let e=0,t=()=>{let n=m.current?.contentWindow,r=ae.current;if(!n||!r){oe.current=null;return}if(n.openai){ae.current=null,oe.current=null,Te(r);return}if(e+=1,e>=60){oe.current=null;return}oe.current=window.requestAnimationFrame(t)};oe.current=window.requestAnimationFrame(t)};try{let n=m.current?.contentWindow,r=m.current?.contentDocument;if(!n)return;if(e.theme!==void 0&&r){let t=r.documentElement;t.setAttribute(`data-theme`,e.theme),t.style.colorScheme=e.theme,t.classList.remove(`light`,`dark`),t.classList.add(e.theme)}if(n.openai){if(!(e.locale!==void 0||e.safeArea!==void 0||e.userAgent!==void 0||e.maxHeight!==void 0||e.toolOutput!==void 0||e.toolResponseMetadata!==void 0)){let t=e.theme===void 0||n.openai.theme===e.theme,r=e.displayMode===void 0||n.openai.displayMode===e.displayMode;if(t&&r)return}e.displayMode!==void 0&&(n.openai.displayMode=e.displayMode),e.theme!==void 0&&(n.openai.theme=e.theme),e.maxHeight!==void 0&&(n.openai.maxHeight=e.maxHeight),e.locale!==void 0&&(n.openai.locale=e.locale),e.safeArea!==void 0&&(n.openai.safeArea=e.safeArea),e.userAgent!==void 0&&(n.openai.userAgent=e.userAgent),e.toolOutput!==void 0&&(n.openai.toolOutput=e.toolOutput),e.toolResponseMetadata!==void 0&&(n.openai.toolResponseMetadata=e.toolResponseMetadata);try{let e=new n.CustomEvent(`openai:set_globals`,{detail:{globals:{...n.openai}}});n.dispatchEvent(e)}catch{n.postMessage({type:`openai:globalsChanged`,updates:e},`*`)}}else ae.current={...ae.current||{},...e},t();p&&p(e)}catch{let t=m.current?.contentWindow;t&&t.postMessage({type:`openai:globalsChanged`,updates:e},`*`),p&&p(e)}}))},[p]);(0,w.useEffect)(()=>()=>{oe.current!==null&&(window.cancelAnimationFrame(oe.current),oe.current=null)},[]),(0,w.useEffect)(()=>{if(!r||!g||!m.current?.contentWindow)return;let e=r?.structuredContent||r,t=r?._meta||null,n=JSON.stringify(e);le.current!==n&&(le.current=n,Te({toolOutput:e,toolResponseMetadata:t}))},[r,g,Te]);let Ee=(0,w.useCallback)(async e=>{try{if(e===`fullscreen`){if(document.fullscreenElement){F(e),Te({displayMode:e});return}h.current&&(await h.current.requestFullscreen(),F(e),Te({displayMode:e}),console.log(`[OpenAIComponentRenderer] Entered fullscreen`))}else document.fullscreenElement&&await document.exitFullscreen(),F(e),Te({displayMode:e}),console.log(`[OpenAIComponentRenderer] Exited fullscreen`)}catch(t){console.error(`[OpenAIComponentRenderer] Fullscreen error:`,t),F(e),Te({displayMode:e})}},[Te]);return(0,w.useEffect)(()=>{if(!T)return;_(!1),b.current||y(!0),C(null);let e=!1,t=async e=>{if(!(!m.current||e.source!==m.current.contentWindow)){if(e.data?.type===`iframe-console-log`){if(e.data.level===`error`){let t=(Array.isArray(e.data.args)?e.data.args:[])[0],n=typeof t==`string`?t:typeof t?.message==`string`?t.message:`Widget runtime error`,r=typeof t?.error?.stack==`string`?t.error.stack:typeof t?.stack==`string`?t.stack:void 0;typeof window<`u`&&window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:widget:error`,source:`iframe-console:error`,message:n,stack:r,timestamp:Date.now(),url:typeof e.data.url==`string`?e.data.url:void 0,toolId:ue},`*`)}return}if(e.data?.type===`mcp-inspector:getWidgetState`){try{let t=m.current?.contentWindow;t?.openai?.widgetState!==void 0&&m.current?.contentWindow?.postMessage({type:`mcp-inspector:widgetStateResponse`,toolId:e.data.toolId,state:t.openai.widgetState},`*`)}catch{}return}switch(e.data.type){case`openai:csp-violation`:ve(ue,{directive:e.data.directive,effectiveDirective:e.data.effectiveDirective,blockedUri:e.data.blockedUri,sourceFile:e.data.sourceFile,lineNumber:e.data.lineNumber,columnNumber:e.data.columnNumber,timestamp:e.data.timestamp||Date.now()});break;case`openai:setWidgetState`:break;case`openai:callTool`:try{if(!pe)throw Error(`Server connection not available`);let{toolName:t,params:n,requestId:r}=e.data,i=await pe.callTool(t,n||{},{timeout:6e5,resetTimeoutOnProgress:!0}),a;a=i&&typeof i==`object`?Array.isArray(i.contents)?{content:i.contents.map(e=>typeof e==`string`?{type:`text`,text:e}:e.type===`text`&&e.text?{type:`text`,text:e.text}:e.type===`image`&&e.data?{type:`image`,image_url:{url:e.data}}:{type:`text`,text:JSON.stringify(e)})}:{content:[{type:`text`,text:typeof i==`string`?i:JSON.stringify(i)}]}:{content:[{type:`text`,text:String(i)}]},m.current?.contentWindow?.postMessage({type:`openai:callTool:response`,requestId:r,result:a},`*`)}catch(t){console.error(`[OpenAIComponentRenderer] Tool call error:`,t),m.current?.contentWindow?.postMessage({type:`openai:callTool:response`,requestId:e.data.requestId,error:t instanceof Error?t.message:String(t)},`*`)}break;case`openai:sendFollowup`:try{let{message:t}=e.data,n=typeof t==`string`?t:t?.prompt||t;if(!n){console.warn(`[OpenAIComponentRenderer] No prompt in followup message`);return}let r=new window.CustomEvent(`mcp-inspector:widget-followup`,{detail:{prompt:n,serverId:i}});window.dispatchEvent(r);try{let e=JSON.parse(localStorage.getItem(`mcp-inspector-pending-followups`)||`[]`);e.push({prompt:n,serverId:i,timestamp:Date.now()}),localStorage.setItem(`mcp-inspector-pending-followups`,JSON.stringify(e.slice(-10)))}catch{}}catch(e){console.error(`[OpenAIComponentRenderer] Failed to send followup:`,e)}break;case`openai:requestDisplayMode`:try{let{mode:t}=e.data;t&&[`inline`,`pip`,`fullscreen`].includes(t)&&await Ee(t)}catch(e){console.error(`[OpenAIComponentRenderer] Failed to change display mode:`,e)}break;case`openai:notifyIntrinsicHeight`:try{let{height:t}=e.data;if(typeof t==`number`&&t>0){let e=t;if(P===`fullscreen`||P===`pip`){let n=typeof window<`u`?window.innerHeight:t;e=Math.min(t,n)}(t!==A.current||e!==D)&&(A.current=t,k.current=e,j.current=!0,O(e))}}catch(e){console.error(`[OpenAIComponentRenderer] Failed to handle intrinsic height notification:`,e)}break;default:break}}};window.addEventListener(`message`,t);let n=()=>{if(!e){if(e=!0,_(!0),C(null),m.current)try{let e=!!m.current.contentDocument;e&&I?cMe(m.current):e||L(!1)}catch{L(!1)}he&&setTimeout(()=>{Te({theme:he})},50)}},r=()=>{C(`Failed to load component`)},a=m.current;return a?.addEventListener(`load`,n),a?.addEventListener(`error`,r),a&&(a.contentDocument?.readyState===`complete`||a.contentDocument?.readyState===`interactive`)&&(a.contentDocument?.querySelectorAll(`script`).length??0)>0&&n(),()=>{window.removeEventListener(`message`,t),a?.removeEventListener(`load`,n),a?.removeEventListener(`error`,r)}},[T,I,Ee,pe,i,he,Te,ne]),(0,w.useEffect)(()=>{if(g){if(!I){Te({theme:he});return}try{if(!m.current?.contentDocument)return;let e=m.current.contentDocument.documentElement;e.setAttribute(`data-theme`,he),e.style.colorScheme=he,e.classList.remove(`light`,`dark`),e.classList.add(he)}catch{}Te({theme:he})}},[he,g,I,Te]),(0,w.useEffect)(()=>{!g||!v||(y(!1),b.current=!0)},[g,v]),(0,w.useEffect)(()=>{if(!T||!I)return;let e=()=>{if(j.current)return;let e=m.current;try{let t=e?.contentWindow?.document?.body;if(!e||!t)return;let n=t.scrollHeight||0,r=typeof window<`u`?window.innerHeight:n,i=Math.min(n,r);i>0&&i!==k.current&&(k.current=i,O(i))}catch{}},t,n=()=>{e(),t=window.requestAnimationFrame(n)};return n(),window.addEventListener(`resize`,e),()=>{window.cancelAnimationFrame(t),window.removeEventListener(`resize`,e)}},[T,I]),(0,w.useEffect)(()=>{let e=()=>{let e=h.current;if(!e)return;let t=e.clientHeight;N(t>D)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[D]),(0,w.useEffect)(()=>{let e=()=>{!document.fullscreenElement&&P===`fullscreen`?(F(`inline`),Te({displayMode:`inline`}),console.log(`[OpenAIComponentRenderer] Fullscreen exited by user`)):document.fullscreenElement&&P!==`fullscreen`&&(F(`fullscreen`),Te({displayMode:`fullscreen`}))};return document.addEventListener(`fullscreenchange`,e),document.addEventListener(`fullscreenerror`,e=>{console.error(`[OpenAIComponentRenderer] Fullscreen error:`,e)}),()=>{document.removeEventListener(`fullscreenchange`,e)}},[P,Te]),(0,w.useEffect)(()=>{if(T&&he&&g){let e=setTimeout(()=>{Te({theme:he})},0);return()=>clearTimeout(e)}},[he,T,g,Te]),x?(0,S.jsx)(`div`,{className:o,children:(0,S.jsx)(`div`,{className:`bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg p-4`,children:(0,S.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:[`Failed to load component: `,x]})})}):T?(0,S.jsxs)(NNe,{className:o,noWrapper:s,children:[v&&(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full z-0`,children:(0,S.jsx)(zq,{className:`size-5`})}),c&&I&&P!==`fullscreen`&&P!==`pip`&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-30 flex items-center gap-2`,children:(0,S.jsx)(U7,{displayMode:P,onDisplayModeChange:Ee,toolCallId:ue,propsContext:`tool`,resourceUri:e,toolInput:R,resourceAnnotations:void 0,llmConfig:null,resource:null,onPropsChange:void 0,protocol:`apps-sdk`,onUpdateGlobals:Te})}),(0,S.jsxs)(`div`,{ref:h,className:H(`w-full h-full flex flex-col justify-center items-center`,M&&`items-center`,P===`fullscreen`&&`bg-background`,P===`pip`&&`fixed top-4 left-1/2 -translate-x-1/2 z-50 rounded-3xl w-full min-w-[300px] h-[400px] shadow-2xl border overflow-hidden`),style:P===`pip`?{maxWidth:j7.DIMENSIONS.PIP_MAX_WIDTH}:void 0,onMouseEnter:()=>P===`pip`&&te(!0),onMouseLeave:()=>P===`pip`&&te(!1),children:[P===`fullscreen`&&document.fullscreenElement&&(0,S.jsx)(nMe,{title:t,onClose:()=>Ee(`inline`)}),P===`pip`&&(0,S.jsx)(`button`,{onClick:()=>Ee(`inline`),className:H(`absolute top-2 right-2 z-50`,`flex items-center justify-center`,`w-8 h-8 rounded-full`,`bg-background/90 hover:bg-background`,`border border-border`,`shadow-lg`,`transition-opacity duration-200`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,ee?`opacity-100`:`opacity-0`),"aria-label":`Exit Picture in Picture`,children:(0,S.jsx)(Fp,{className:`w-4 h-4 text-foreground`})}),(0,S.jsx)(`div`,{className:H(`flex-1 w-full flex justify-center items-center relative`,P===`fullscreen`&&`pt-14`,M&&`items-center`,P===`inline`&&(d||f)&&`pt-8`),children:(0,S.jsxs)(`div`,{className:`relative w-full max-w-[768px]`,children:[P===`inline`&&(d||f)&&(0,S.jsxs)(`div`,{className:`absolute -top-8 left-2 z-10 whitespace-nowrap`,children:[d&&!r&&(0,S.jsx)(jY,{className:`text-xs`,children:d}),f&&r&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f})]}),(0,S.jsx)(`iframe`,{ref:m,src:T,className:H(P===`inline`&&`w-full`,P===`fullscreen`&&`w-full h-full rounded-none`,P===`pip`&&`w-full h-full rounded-lg`),style:{height:P===`fullscreen`||P===`pip`?`100%`:`${D}px`},sandbox:A7,title:`OpenAI Component: ${t}`,allow:`web-share`})]})})]})]}):(0,S.jsx)(NNe,{className:o,noWrapper:s,children:(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})})})}function FNe(e,t){for(let n of[`componentUrl`,`toolName`,`serverId`,`toolArgs`,`toolResult`,`readResource`,`className`])if(e[n]!==t[n])return!1;return!(e.invoking!==t.invoking||e.invoked!==t.invoked)}var W7=(0,w.memo)(PNe,FNe),INe=(0,w.memo)(({resource:e})=>{if(!e.uri?.startsWith(`ui://`))return null;let t=(0,w.useMemo)(()=>{if(e.text)return e.text;if(e.blob)try{return atob(e.blob)}catch{return null}return null},[e.text,e.blob]);return t?(0,S.jsx)(`div`,{className:`my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card`,children:(0,S.jsx)(`iframe`,{srcDoc:t,sandbox:`allow-scripts allow-forms allow-popups`,title:e.uri??`MCP UI Resource`,style:{width:`100%`,height:`100%`,border:`none`,overflow:`auto`}})}):null});function LNe({widgetId:e}){let{getWidget:t}=bQ(),n=t(e)?.modelContext;if(!n?.content?.length&&!n?.structuredContent)return null;let r=n.content?.map(e=>e.text).join(` `)??JSON.stringify(n.structuredContent).slice(0,80);return(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] text-muted-foreground bg-muted/30 border border-border/40 rounded-md mt-1`,children:[(0,S.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-blue-400 shrink-0`}),(0,S.jsx)(`span`,{className:`font-medium`,children:`State synced to model`}),(0,S.jsx)(`span`,{className:`truncate opacity-60 max-w-[300px]`,children:r})]})}function RNe({toolName:e,toolArgs:t,result:n,serverId:r,readResource:i,toolMeta:a,onSendFollowUp:o,serverBaseUrl:s,partialToolArgs:c,cancelled:l}){let{playground:u}=bQ(),[d,f]=(0,w.useState)(null),p=(0,w.useRef)(null),m=(0,w.useMemo)(()=>`chat-tool-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,[e]),h=(0,w.useMemo)(()=>{if(!n)return null;if(typeof n==`string`)try{return JSON.parse(n)}catch(e){return console.error(`[ToolResultRenderer] Failed to parse result:`,e),n}return n},[n]),g=(0,w.useMemo)(()=>JSON.stringify(a),[a]),_=(0,w.useMemo)(()=>CQ(a,h),[g,h]),v=(0,w.useMemo)(()=>SQ(a),[g]),y=(0,w.useMemo)(()=>_?_===`both`?u.selectedProtocol?u.selectedProtocol:`mcp-apps`:_:null,[_,u.selectedProtocol]),b=(0,w.useMemo)(()=>y===`mcp-apps`,[y]),x=(0,w.useMemo)(()=>y===`chatgpt-app`,[y]),C=(0,w.useMemo)(()=>!!(h?.content&&Array.isArray(h.content)&&h.content.some(e=>e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType===`text/html+skybridge`)),[h]),T=(0,w.useMemo)(()=>C&&h.content.find(e=>e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType===`text/html+skybridge`)?.resource||null,[C,h]),E=(0,w.useMemo)(()=>t,[e,h]),D=(0,w.useMemo)(()=>h,[e,h]),O=(0,w.useMemo)(()=>v&&y?wQ(y,a):b?a?.ui?.resourceUri||null:x&&a?.[`openai/outputTemplate`]||null,[v,y,b,x,g]);(0,w.useEffect)(()=>{if(T){f(T),p.current=T.uri||null;return}O&&p.current===O||(O!==p.current&&f(null),O&&i&&(p.current=O,i(O).then(e=>{e?.contents&&Array.isArray(e.contents)&&e.contents.length>0&&f(e.contents[0])}).catch(e=>{console.error(`[ToolResultRenderer] Failed to fetch resource:`,e),p.current=null})))},[T,O,y,i]);let k=a?.[`openai/toolInvocation/invoking`],A=a?.[`openai/toolInvocation/invoked`];if(v&&d&&r&&i)return(0,S.jsxs)(`div`,{className:`my-4`,children:[y===`mcp-apps`&&(0,S.jsx)(N7,{serverId:r,toolCallId:m,toolName:e,toolInput:E,toolOutput:D,toolMetadata:a,invoking:k,invoked:A,partialToolInput:c,resourceUri:d.uri,readResource:i,noWrapper:!0,onSendFollowUp:o,serverBaseUrl:s,cancelled:l}),y===`chatgpt-app`&&(0,S.jsx)(W7,{componentUrl:d.uri,toolName:e,toolArgs:E,toolResult:D,serverId:r,readResource:i,noWrapper:!0,showConsole:!1,invoking:k,invoked:A,serverBaseUrl:s})]});if(b&&O&&r&&i)return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(N7,{serverId:r,toolCallId:m,toolName:e,toolInput:E,toolOutput:D,toolMetadata:a,invoking:k,invoked:A,partialToolInput:c,resourceUri:d?.uri||O,readResource:i,className:`my-4`,noWrapper:!0,onSendFollowUp:o,serverBaseUrl:s}),(0,S.jsx)(LNe,{widgetId:m})]});if((x||C)&&O&&r&&i)return(0,S.jsx)(W7,{componentUrl:d?.uri||O,toolName:e,toolArgs:E,toolResult:D,serverId:r,readResource:i,noWrapper:!0,className:`my-4`,showConsole:!1,invoking:k,invoked:A,serverBaseUrl:s});if((b||x||C)&&!O)return(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px] rounded border`,children:(0,S.jsx)(zq,{className:`size-5`})});if((b||x)&&(!r||!i))return console.error(`[ToolResultRenderer] Apps SDK tool but missing serverId or readResource:`,{toolName:e,hasServerId:!!r,hasReadResource:!!i}),(0,S.jsx)(`div`,{className:`my-4 p-4 bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`Cannot render widget: Missing required props (serverId or readResource)`})});let j=[];if(h?.content&&Array.isArray(h.content))for(let e of h.content)e.type===`resource`&&e.resource?.uri?.startsWith(`ui://`)&&e.resource?.mimeType!==`text/html+skybridge`&&j.push(e.resource);return j.length>0?(0,S.jsx)(S.Fragment,{children:j.map(t=>(0,S.jsx)(INe,{resource:t},`${e}-mcp-ui-${t.uri}`))}):(console.log(`[ToolResultRenderer] Not rendering (no UI resources found):`,{toolName:e,isAppsSdkTool:x,hasAppsSdkComponent:C,hasResourceData:!!d,contentLength:h?.content?.length}),null)}function zNe({content:e,timestamp:t,attachments:n}){return(!e||e.length===0)&&(!n||n.length===0)?null:(0,S.jsx)(`div`,{className:`flex items-start gap-3 justify-end group/user-message`,"data-testid":`chat-message-user`,children:(0,S.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col items-end`,children:[(0,S.jsxs)(`div`,{className:`bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words`,"data-testid":`chat-message-content`,children:[n&&n.length>0&&(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-2`,children:n.map((e,t)=>(0,S.jsx)(`div`,{className:`rounded-lg overflow-hidden border border-zinc-300 dark:border-zinc-700`,children:(0,S.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:e.name||`Attachment ${t+1}`,className:`max-w-[200px] max-h-[200px] object-contain`})},t))}),e&&e.length>0&&(0,S.jsx)(`p`,{className:`text-base leading-7 font-sans text-start break-words`,children:e})]}),t&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,S.jsx)(dQ,{text:e}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(t).toLocaleTimeString()})]})]})})}function G7(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.const==`string`&&(t.title===void 0||typeof t.title==`string`)}function BNe(e){let t=Array.isArray(e.oneOf)?e.oneOf.filter(G7):[],n=Array.isArray(e.anyOf)?e.anyOf.filter(G7):[];return t.length>0?t:n}function VNe(e){let t=e.items&&typeof e.items==`object`?e.items:{},n=Array.isArray(t.anyOf)?t.anyOf.filter(G7):[],r=Array.isArray(t.oneOf)?t.oneOf.filter(G7):[];return n.length>0?n:r}function HNe({request:e,formData:t,onFieldChange:n,idPrefix:r,testIdPrefix:i,fieldContainerClassName:a=`space-y-2`,textareaRows:o=4,showOuterLabelForBoolean:s=!0,emptyFallback:c}){return(0,S.jsx)(S.Fragment,{children:(0,w.useMemo)(()=>{if(!(`requestedSchema`in e.request))return null;let l=e.request.requestedSchema;if(!l||l.type!==`object`||!l.properties)return c??(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No form schema available`});let u=l.properties,d=l.required||[];return(0,S.jsx)(`div`,{className:`space-y-4`,children:Object.entries(u).map(([e,c])=>{let l=c,u=d.includes(e),f=l.type||`string`,p=l.title||e,m=l.description,h=BNe(l),g=h.length>0,_=Array.isArray(l.enum),v=f===`array`&&Array.isArray(l.items?.enum),y=VNe(l),b=f===`array`&&y.length>0,x=Array.isArray(t[e])?t[e]:[],C=`${r}-${e}`,w=`${i}-${e}`;return(0,S.jsxs)(`div`,{className:a,children:[(f!==`boolean`||s)&&(0,S.jsxs)(ON,{htmlFor:C,children:[p,u&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),m&&(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m}),f===`boolean`?(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:C,"data-testid":w,checked:t[e]||!1,onCheckedChange:t=>n(e,t)}),(0,S.jsxs)(ON,{htmlFor:C,className:`text-sm font-normal cursor-pointer`,children:[p,!s&&u&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]})]}):f===`number`||f===`integer`?(0,S.jsx)(TN,{id:C,"data-testid":w,type:`number`,value:t[e]??``,onChange:t=>{let r=f===`integer`?parseInt(t.target.value,10):parseFloat(t.target.value);n(e,isNaN(r)?``:r)},placeholder:l.default?.toString()||``}):g?(0,S.jsxs)(`select`,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,S.jsx)(`option`,{value:``,children:`Select...`}),h.map(e=>(0,S.jsx)(`option`,{value:e.const,children:e.title||e.const},e.const))]}):_?(0,S.jsxs)(`select`,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),className:`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,S.jsx)(`option`,{value:``,children:`Select...`}),l.enum.map((e,t)=>(0,S.jsx)(`option`,{value:e,children:l.enumNames?.[t]||e},e))]}):v?(0,S.jsx)(`div`,{className:`space-y-2`,"data-testid":w,children:l.items.enum.map(t=>{let r=`${C}-${t}`;return(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:r,checked:x.includes(t),onCheckedChange:r=>{n(e,r?[...x,t]:x.filter(e=>e!==t))}}),(0,S.jsx)(ON,{htmlFor:r,className:`text-sm font-normal cursor-pointer`,children:t})]},t)})}):b?(0,S.jsx)(`div`,{className:`space-y-2`,"data-testid":w,children:y.map(t=>{let r=`${C}-${t.const}`;return(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:r,checked:x.includes(t.const),onCheckedChange:r=>{n(e,r?[...x,t.const]:x.filter(e=>e!==t.const))}}),(0,S.jsx)(ON,{htmlFor:r,className:`text-sm font-normal cursor-pointer`,children:t.title||t.const})]},t.const)})}):f===`string`&&(l.format===`textarea`||l.maxLength>100)?(0,S.jsx)(fY,{id:C,"data-testid":w,value:t[e]||``,onChange:t=>n(e,t.target.value),placeholder:l.default||``,rows:o}):(0,S.jsx)(TN,{id:C,"data-testid":w,type:`text`,value:t[e]||``,onChange:t=>n(e,t.target.value),placeholder:l.default||``})]},e)})})},[e,t,n,r,i,a,o,s,c])})}function UNe(e){let[t,n]=(0,w.useState)({}),[r,i]=(0,w.useState)(!1),a=e?.request.mode||`form`,o=a===`form`,s=a===`url`;return(0,w.useEffect)(()=>{if(e&&o&&`requestedSchema`in e.request){let t=e.request.requestedSchema,r={};if(t?.type===`object`&&t.properties)for(let[e,n]of Object.entries(t.properties)){let t=n;t.default===void 0?t.type===`array`?r[e]=[]:t.type===`boolean`?r[e]=!1:t.type===`number`||t.type===`integer`?r[e]=0:r[e]=``:r[e]=t.default}n(r)}i(!1)},[e?.id,o]),{formData:t,setFieldValue:(0,w.useCallback)((e,t)=>{n(n=>({...n,[e]:t}))},[]),getMissingRequiredFields:(0,w.useCallback)(()=>!e||!o||!(`requestedSchema`in e.request)?[]:(e.request.requestedSchema?.required??[]).filter(e=>t[e]===void 0||t[e]===``||t[e]===null),[e,t,o]),urlCompleted:r,setUrlCompleted:i,mode:a,isFormMode:o,isUrlMode:s}}function WNe({request:e,onApprove:t,onReject:n}){let{formData:r,setFieldValue:i,getMissingRequiredFields:a,urlCompleted:o,setUrlCompleted:s,mode:c,isFormMode:l,isUrlMode:u}=UNe(e),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(``),h=()=>{if(!d)if(l){let n=a();if(n.length>0){PM.error(`Missing required fields`,{description:`Please fill in: ${n.join(`, `)}`});return}f(!0),m(`accepted`),t(e.id,{action:`accept`,content:r})}else u&&(f(!0),m(`accepted`),t(e.id,{action:`accept`}))},g=()=>{d||(f(!0),m(`declined`),t(e.id,{action:`decline`}))},_=()=>{d||(f(!0),m(`cancelled`),n(e.id,`User cancelled elicitation request`))},v=u&&`url`in e.request?e.request.url:null;return d?(0,S.jsxs)(`div`,{className:`rounded-lg border border-dashed bg-muted/30 p-3 text-sm text-muted-foreground max-w-2xl`,children:[`Elicitation `,p,` — the tool will continue executing.`]}):(0,S.jsxs)(`div`,{className:`rounded-lg border bg-card shadow-sm p-4 space-y-4 max-w-2xl`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,S.jsx)(`span`,{className:`font-medium text-sm text-card-foreground`,children:`Elicitation Request`}),(0,S.jsx)(kt,{variant:`outline`,className:u?`bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30`:`bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30`,children:c}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.serverName})]}),(0,S.jsx)(`p`,{className:`text-sm text-card-foreground`,children:e.request.message}),u&&`url`in e.request&&(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-muted rounded border`,children:[(0,S.jsx)(`code`,{className:`flex-1 text-xs font-mono break-all`,children:v}),(0,S.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>{window.open(v??``,`_blank`),s(!0)},children:[(0,S.jsx)(Ff,{className:`h-3 w-3 mr-1`}),`Open`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(wY,{id:`inline-url-done-${e.id}`,checked:o,onCheckedChange:e=>s(!!e)}),(0,S.jsx)(ON,{htmlFor:`inline-url-done-${e.id}`,className:`text-sm font-normal cursor-pointer`,children:`I have completed the required action`})]})]}),l&&(0,S.jsx)(HNe,{request:e,formData:r,onFieldChange:i,idPrefix:`inline-field-${e.id}`,testIdPrefix:`inline-elicitation-field`,fieldContainerClassName:`space-y-1.5`,textareaRows:3,showOuterLabelForBoolean:!1,emptyFallback:(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No form schema provided.`})}),(0,S.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,S.jsx)(U,{size:`sm`,onClick:h,disabled:u&&!o,"data-testid":`inline-elicitation-accept`,children:`Accept`}),(0,S.jsx)(U,{size:`sm`,variant:`outline`,onClick:g,"data-testid":`inline-elicitation-decline`,children:`Decline`}),(0,S.jsx)(U,{size:`sm`,variant:`outline`,onClick:_,"data-testid":`inline-elicitation-cancel`,children:`Cancel`})]})]})}var GNe=(0,w.memo)(({messages:e,isLoading:t,serverId:n,readResource:r,tools:i,sendMessage:a,serverBaseUrl:o,pendingElicitationRequests:s,onApproveElicitation:c,onRejectElicitation:l})=>{let u=(0,w.useRef)(null),d=e=>{let t=e=>e.replace(/-/g,`_`),n=t(e);return i?.find(e=>t(e.name)===n)?._meta},f=e=>{let t=CQ(d(e),void 0);return t!==null&&t!==`mcp-ui`},p=(0,w.useCallback)(e=>{let t=e.filter(e=>e.type===`text`&&`text`in e).map(e=>e.text).join(`
|
|
795
|
+
`),n=e.filter(e=>e.type===`image`&&`data`in e&&`mimeType`in e).map(e=>({type:`image`,data:e.data,mimeType:e.mimeType}));a?.(t,n.length>0?n:void 0)},[a]);(0,w.useEffect)(()=>{e.length>0&&u.current&&u.current.scrollIntoView({behavior:t?`auto`:`smooth`,block:`start`})},[e.length,t]);let m=t&&(()=>{if(e.length===0)return!0;let t=e[e.length-1];if(t.role===`user`)return!0;if(t.role===`assistant`){if(t.parts&&t.parts.length>0)return!1;let e=typeof t.content==`string`?t.content:Array.isArray(t.content)?t.content.map(e=>typeof e==`string`?e:e.text||JSON.stringify(e)).join(``):JSON.stringify(t.content);return!(e&&e.trim().length>0)}return!1})(),h=n=>{if(!t)return!1;let r=e[e.length-1];return n.id===r.id&&r.role===`assistant`};return(0,S.jsxs)(`div`,{className:`space-y-6 max-w-3xl mx-auto px-2`,children:[e.map(e=>{let t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:e.text||JSON.stringify(e)).join(``):JSON.stringify(e.content);return e.role===`user`?(0,S.jsx)(zNe,{content:t,timestamp:e.timestamp,attachments:e.attachments},e.id):e.role===`assistant`?(0,S.jsx)(`div`,{className:`space-y-4`,children:e.parts&&e.parts.length>0?e.parts.map((t,i)=>{let a=t.type===`text`?`${e.id}-text-${i}-${t.text?.slice(0,20)}`:`${e.id}-tool-${t.toolInvocation?.toolName}-${i}`;return t.type===`text`?(0,S.jsx)(fQ,{content:t.text||``,timestamp:i===e.parts.length-1?e.timestamp:void 0,_isStreaming:h(e)},a):t.type===`tool-invocation`&&t.toolInvocation?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(vQ,{toolName:t.toolInvocation.toolName,args:t.toolInvocation.args,result:t.toolInvocation.result,state:t.toolInvocation.state===`error`?`error`:t.toolInvocation.state===`streaming`||t.toolInvocation.state===`pending`?`call`:`result`,partialArgs:t.toolInvocation.partialArgs}),(t.toolInvocation.result||t.toolInvocation.state===`streaming`||f(t.toolInvocation.toolName))&&(0,S.jsx)(`div`,{"data-tool-call-id":`${e.id}-${t.toolInvocation.toolName}-${i}`,children:(0,S.jsx)(RNe,{toolName:t.toolInvocation.toolName,toolArgs:t.toolInvocation.args,result:t.toolInvocation.result||null,serverId:n,readResource:r,serverBaseUrl:o,toolMeta:d(t.toolInvocation.toolName),onSendFollowUp:p,partialToolArgs:t.toolInvocation.partialArgs,cancelled:t.toolInvocation.state===`error`&&t.toolInvocation.result===`Cancelled by user`})})]},a):null}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(fQ,{content:t,timestamp:e.timestamp,_isStreaming:h(e)}),e.toolCalls&&e.toolCalls.length>0&&(0,S.jsx)(`div`,{className:`space-y-2`,children:e.toolCalls.map(t=>{let i=`${e.id}-${t.toolName}-${JSON.stringify(t.args).slice(0,50)}`;return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(vQ,{toolName:t.toolName,args:t.args,result:t.result,state:t.result?`result`:`call`}),(t.result||f(t.toolName))&&(0,S.jsx)(`div`,{"data-tool-call-id":i,children:(0,S.jsx)(RNe,{toolName:t.toolName,toolArgs:t.args,result:t.result||null,serverId:n,readResource:r,serverBaseUrl:o,toolMeta:d(t.toolName),onSendFollowUp:p})})]},i)})})]})},e.id):null}),s&&s.length>0&&c&&l&&(0,S.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>(0,S.jsx)(WNe,{request:e,onApprove:c,onReject:l},e.id))}),m&&(0,S.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,S.jsx)(`div`,{className:`flex-1`,children:(0,S.jsx)(`div`,{className:`rounded-lg p-4 max-w-fit`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`text-sm`,children:(0,S.jsx)(jY,{duration:2,spread:1,children:`Thinking...`})})})})})}),(0,S.jsx)(`div`,{ref:u})]})});function KNe(e){return jMe(e)}var qNe=e=>{let t=[];for(let n of e){if(n.error||n.result?.isError){let e={id:`prompt-error-${n.promptName}-${n.timestamp}`,role:`assistant`,content:n.error||`Prompt execution failed`,timestamp:n.timestamp};t.push(e);continue}let e=n.result;if(e&&`messages`in e&&Array.isArray(e.messages))for(let r of e.messages){let e=``,i=[];if(typeof r.content==`string`)e=r.content;else if(Array.isArray(r.content)){let t=[];for(let e of r.content)e.type===`text`&&e.text?t.push(e.text):e.type===`image`&&e.data?i.push({type:`image`,data:e.data,mimeType:e.mimeType||`image/png`}):e.type===`resource`&&t.push(`[Resource: ${e.resource?.uri||`embedded`}]`);e=t.join(`
|
|
796
796
|
`)}else r.content&&typeof r.content==`object`&&(r.content.type===`text`&&r.content.text?e=r.content.text:r.content.type===`image`&&r.content.data?i.push({type:`image`,data:r.content.data,mimeType:r.content.mimeType||`image/png`}):e=JSON.stringify(r.content));!e&&i.length===0&&(e=`[no content]`);let a={id:`prompt-${n.promptName}-${n.timestamp}-${t.length}`,role:r.role,content:e||``,timestamp:n.timestamp,attachments:i.length>0?i:void 0};t.push(a)}}return t};function JNe({mcpServerUrl:e,llmConfig:t,authConfig:n,isConnected:r,chatApiUrl:i,waitForChatApiUrl:a,widgetModelContexts:o,initialMessages:s,disabledTools:c,streamProtocol:l=`sse`,credentials:u,extraHeaders:d,body:f}){let[p,m]=(0,w.useState)(s??[]),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)([]),[y,b]=(0,w.useState)(null),[x,S]=(0,w.useState)(null),C=(0,w.useRef)(null);return{messages:p,isLoading:h,attachments:_,rateLimitInfo:y,mcpServerAuthRequired:x,sendMessage:(0,w.useCallback)(async(s,h,y)=>{let x=[..._,...y??[]];if(!(s.trim()||h.length>0||x.length>0)||!t||!r)return;let w=[...qNe(h)];if(s.trim()||x.length>0){let e={id:`user-${Date.now()}`,role:`user`,content:s.trim(),timestamp:Date.now(),attachments:x.length>0?x:void 0};w.push(e)}m(e=>[...e,...w]),g(!0),v([]),C.current=new AbortController;try{let r=n;if(n?.type===`oauth`)try{let t=`mcp:auth_${TY(e)}_tokens`,i=localStorage.getItem(t);if(i){let e=JSON.parse(i);r={...n,oauthTokens:e}}else console.warn(`No OAuth tokens found in localStorage for key:`,t)}catch(e){console.warn(`Failed to retrieve OAuth tokens:`,e)}let s=[];if(o&&o.size>0){let e=[];for(let[,t]of o)t&&(t.content?.length?e.push(t.content.map(e=>e.text).join(`
|
|
797
797
|
`)):t.structuredContent&&e.push(JSON.stringify(t.structuredContent)));e.length>0&&s.push({role:`user`,content:`[Current Widget State]\n${e.join(`
|
|
798
798
|
`)}`})}let h=i??(a?await a():void 0)??`/inspector/api/chat/stream`,g=[...[...p,...w].map(e=>({role:e.role,content:e.content||(e.parts?.filter(e=>e.type===`text`).map(e=>e.text).join(``)??``),attachments:e.attachments})),...s],_=await fetch(h,{method:`POST`,headers:{"Content-Type":`application/json`,...d},signal:C.current.signal,...u?{credentials:u}:{},body:JSON.stringify(f?f(g):{mcpServerUrl:e,llmConfig:t,authConfig:r,messages:g,...c&&c.size>0?{disabledTools:[...c]}:{}})});if(!_.ok){if(_.status===429){let e=await _.json().catch(()=>null);e?.loginRequired&&e?.loginUrl&&b({loginUrl:e.loginUrl}),m(e=>e.filter(e=>e.id!==`assistant-${Date.now()}`));return}if(_.status===401){let t=await _.json().catch(()=>null);if(t?.error===`mcp_auth_required`){S({mcpServerUrl:t.mcpServerUrl??e,message:t.message});return}}throw Error(`HTTP error! status: ${_.status}`)}let v=`assistant-${Date.now()}`,y=``,x=[];m(e=>[...e,{id:v,role:`assistant`,content:``,timestamp:Date.now(),parts:[]}]);let T=_.body?.getReader(),E=new TextDecoder;if(!T)throw Error(`No response body`);let D=()=>{m(e=>e.map(e=>e.id===v?{...e,parts:[...x]}:e))},O=()=>{m(e=>e.map(e=>e.id===v?{...e,parts:[...x],content:``}:e))},k=e=>{y+=e;let t=x[x.length-1];t&&t.type===`text`?t.text=y:x.push({type:`text`,text:y}),D()},A=(e,t)=>{y&&=``,x.push({type:`tool-invocation`,toolInvocation:{toolName:e,args:t,state:`pending`}}),D()},j=(e,t)=>{let n;n=e.by===`toolName`?x.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.toolName===e.toolName&&!t.toolInvocation?.result):x[e.index],n?.toolInvocation&&(n.toolInvocation.result=t,n.toolInvocation.state=t?.isError?`error`:`result`,D())},M=new Map,N=``;for(;;){if(C.current?.signal.aborted){await T.cancel();break}let{done:e,value:t}=await T.read();if(e)break;N+=E.decode(t,{stream:!0});let n=N.split(`
|
|
799
799
|
`);N=n.pop()||``;for(let e of n)if(e.trim())try{if(l===`data-stream`){let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t),r=e.slice(t+1),i;try{i=JSON.parse(r)}catch{continue}switch(n){case`0`:k(typeof i==`string`?i:String(i));break;case`9`:{let e=i,t=e.args??{};if(typeof t.input==`string`&&Object.keys(t).length===1)try{let e=JSON.parse(t.input);typeof e==`object`&&e&&(t=e)}catch{}A(String(e.toolName??``),t),e.toolCallId&&M.set(e.toolCallId,x.length-1);break}case`a`:{let e=i,t=M.get(e.toolCallId),n=e.result,r=n;if(r?.lc===1&&r?.type===`constructor`&&r?.kwargs?.content){let e=r.kwargs.content;if(typeof e==`string`)try{n=JSON.parse(e)}catch{n=e}}t!==void 0&&j({by:`index`,index:t},n);break}case`d`:O();break;case`3`:throw Error(typeof i==`string`?i:JSON.stringify(i));default:break}}else{if(!e.startsWith(`data: `))continue;let t=JSON.parse(e.slice(6));if(t.type!==`message`){if(t.type===`text`)k(t.content);else if(t.type===`tool-call`)A(t.toolName,t.args);else if(t.type===`tool-result`)j({by:`toolName`,toolName:t.toolName},t.result);else if(t.type===`done`)O();else if(t.type===`error`)throw Error(t.message||`Streaming error`)}}}catch(t){if(t instanceof Error&&t.message!==`Streaming error`)console.error(`Failed to parse streaming event:`,t,e);else throw t}}if(C.current?.signal.aborted){for(let e of x)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);m(e=>e.map(e=>e.id===v?{...e,parts:[...x],content:``}:e))}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;let t=`Unknown error occurred`;if(e instanceof Error){t=e.message;let n=e;n.status&&(t=`HTTP ${n.status}: ${t}`),(n.code===401||t.includes(`401`)||t.includes(`Unauthorized`))&&(t=`Authentication failed (401). Check your Authorization header in the connection settings.`)}let n={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${t}`,timestamp:Date.now()};m(e=>[...e,n])}finally{g(!1),C.current=null}},[t,r,e,p,n,_,i,a,o,c,l,u,d,f]),clearMessages:(0,w.useCallback)(()=>{m([]),b(null),S(null)},[]),clearRateLimitInfo:(0,w.useCallback)(()=>{b(null)},[]),clearMcpServerAuthRequired:(0,w.useCallback)(()=>{S(null)},[]),setMessages:m,stop:(0,w.useCallback)(()=>{C.current&&C.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await DY(e);v(e=>{let n=[...e,t];return EY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{v(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{v([])},[])}}async function*YNe(e){let{config:t,tools:n,callTool:r,signal:i}=e,a=e.maxSteps??10,o=[...e.messages];for(let e=0;e<a;e++){if(i?.aborted)return;let e=[],a=``;try{for await(let r of yNe({config:t,messages:o,tools:n,signal:i}))r.type===`text-delta`?a+=r.delta:r.type===`tool-call-ready`&&e.push({id:r.toolCallId,name:r.toolName,args:r.args}),yield r}catch(e){yield{type:`error`,message:e instanceof Error?e.message:String(e)};return}if(e.length===0)return;o.push({role:`assistant`,content:a,toolCalls:e});for(let t of e){if(i?.aborted)return;let e,n=!1;try{e=await r(t.name,t.args),n=CMe(e)}catch(t){n=!0,e={isError:!0,error:t instanceof Error?t.message:String(t)}}o.push({role:`tool`,content:OMe(e),toolCallId:t.id,toolName:t.name,toolResult:e,toolIsError:n}),yield{type:`tool-result`,toolCallId:t.id,toolName:t.name,result:e,isError:n}}}}var XNe=`You are a helpful assistant with access to MCP tools. Help users interact with the MCP server.`;function ZNe({connection:e,llmConfig:t,isConnected:n,readResource:r,widgetModelContexts:i,disabledTools:a}){let[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)([]),f=(0,w.useRef)(null);return{messages:o,isLoading:c,attachments:u,sendMessage:(0,w.useCallback)(async(c,p,m)=>{let h=[...u,...m??[]];if(!(c.trim()||p.length>0||h.length>0)||!t||!n)return;let g=qNe(p),_={id:`user-${Date.now()}`,role:`user`,content:c.trim(),timestamp:Date.now(),attachments:h.length>0?h:void 0},v=[...g];(c.trim()||h.length>0)&&v.push(_),s(e=>[...e,...v]),l(!0),d([]),f.current=new AbortController;let y=Date.now(),b=0;try{let n=`assistant-${Date.now()}`,l=``,u=[],d=new Map,p=0,m=async()=>{let e=Date.now();e-p>=80&&(p=e,await new Promise(e=>setTimeout(e,0)))};s(e=>[...e,{id:n,role:`assistant`,content:``,timestamp:Date.now(),parts:[]}]);let h=(e.tools??[]).filter(e=>!a?.has(e.name)).map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema??{type:`object`}})),v=[];if(i&&i.size>0){let e=[];for(let[,t]of i)t&&(t.content?.length?e.push(t.content.map(e=>e.text).join(`
|
|
800
800
|
`)):t.structuredContent&&e.push(JSON.stringify(t.structuredContent)));e.length>0&&v.push({id:`widget-context-${Date.now()}`,role:`user`,content:`[Current Widget State]\n${e.join(`
|
|
801
|
-
`)}`,timestamp:Date.now()})}let x=(_.attachments?.length??0)>0,S=KNe([...o,...g,...v,...c.trim()||x?[_]:[]]);S.unshift({role:`system`,content:XNe});let C=e=>{try{return JSON.parse(e)}catch{let t=[()=>{let t=e;(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)},()=>{let t=e;t=t.replace(/,\s*"[^"]*"?\s*:\s*("([^"\\]|\\.)*)?$/,``),t=t.replace(/,\s*"[^"]*$/,``),(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)}];for(let e of t)try{return e()}catch{}return}},w=()=>{s(e=>e.map(e=>e.id===n?{...e,parts:[...u]}:e))},T=async e=>{let t=e.toolInvocation?.result,n=t?._meta?.[`openai/outputTemplate`];if(!(!n||typeof n!=`string`||!r))try{let i=await r(n);if(i?.contents&&Array.isArray(i.contents)){let n=i.contents.map(e=>({type:`resource`,resource:e}));e.toolInvocation.result={...t,content:[...t.content||[],...n],structuredContent:t?.structuredContent||null}}}catch(e){console.error(`Failed to fetch Apps SDK resource:`,e)}};for await(let n of YNe({config:{provider:t.provider,model:t.model,apiKey:t.apiKey,temperature:t.temperature,baseUrl:t.baseUrl},messages:S,tools:h,callTool:async(t,n)=>await e.callTool(t,n,{signal:f.current?.signal}),maxSteps:10,signal:f.current?.signal})){if(f.current?.signal.aborted)break;if(n.type===`text-delta`){l+=n.delta;let e=u[u.length-1];e&&e.type===`text`?e.text=l:u.push({type:`text`,text:l}),w()}else if(n.type===`tool-call-start`)l&&=``,d.set(n.toolCallId,{name:n.toolName,accumulatedJson:``}),u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:{},state:`streaming`,partialArgs:{}}}),w();else if(n.type===`tool-call-args-delta`){let e=d.get(n.toolCallId);if(e){e.accumulatedJson+=n.argsDelta;let t=C(e.accumulatedJson);if(t){let n=u.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.state===`streaming`&&t.toolInvocation?.toolName===e.name);if(n&&n.toolInvocation){let e=n.toolInvocation.partialArgs,r=e?Object.keys(e):[],i=Object.keys(t),a=r.reduce((t,n)=>t+String(e[n]??``).length,0),o=i.reduce((e,n)=>e+String(t[n]??``).length,0);(i.length>r.length||o>=a)&&(n.toolInvocation.partialArgs=t),w(),await m()}}}}else if(n.type===`tool-call-ready`){b++,l&&=``;let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.state===`streaming`&&e.toolInvocation?.toolName===n.toolName);e&&e.toolInvocation?(e.toolInvocation.args=n.args,e.toolInvocation.state=`pending`):u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:n.args,state:`pending`}}),w()}else if(n.type===`tool-result`){let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.toolName===n.toolName&&!e.toolInvocation?.result);e&&e.toolInvocation&&(e.toolInvocation.result=n.result,e.toolInvocation.state=n.isError||n.result?.isError?`error`:`result`,await T(e),w())}else if(n.type===`error`)throw Error(n.message)}if(f.current?.signal.aborted)for(let e of u)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);s(e=>e.map(e=>e.id===n?{...e,parts:[...u],content:``}:e)),t&&ef.getInstance().capture(new Ld({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!0,executionMode:`client-side`,duration:Date.now()-y})).catch(()=>{})}catch(n){if(n instanceof DOMException&&n.name===`AbortError`)return;console.error(`Client-side agent error:`,n);let r=`Unknown error occurred`;if(n instanceof Error){r=n.message;let e=n;e.status&&(r=`HTTP ${e.status}: ${r}`),(e.code===401||r.includes(`401`)||r.includes(`Unauthorized`))&&(r=`Authentication failed (401). Check your Authorization header in the connection settings.`)}t&&ef.getInstance().capture(new Ld({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!1,executionMode:`client-side`,duration:Date.now()-y,error:r})).catch(()=>{});let i={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${r}`,timestamp:Date.now()};s(e=>[...e,i])}finally{l(!1),f.current=null}},[e,t,n,o,r,u,a,i]),clearMessages:(0,w.useCallback)(()=>{s([])},[]),setMessages:s,stop:(0,w.useCallback)(()=>{f.current&&f.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await DY(e);d(e=>{let n=[...e,t];return EY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{d(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{d([])},[])}}function K7({mcpServerUrl:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(`openai`),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(rY.openai),[p,m]=(0,w.useState)(oY(`openai`)),h=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-api-keys`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load API keys:`,e),{}}return{}},[]),g=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-api-keys`,JSON.stringify(e))},[]),_=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-base-urls`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load base URLs:`,e),{}}return{}},[]),v=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-base-urls`,JSON.stringify(e))},[]),[y,b]=(0,w.useState)(`none`),[x,S]=(0,w.useState)(``),[C,T]=(0,w.useState)(``),[E,D]=(0,w.useState)(``);return(0,w.useEffect)(()=>{let e=()=>{let e=localStorage.getItem(`mcp-inspector-llm-config`),t=h(),r=_();if(e)try{let i=JSON.parse(e);n(i),c(i.provider),u(t[i.provider]||i.apiKey||``),f(i.model),m(r[i.provider]||i.baseUrl||oY(i.provider))}catch(e){console.error(`Failed to load LLM config:`,e)}};e();let t=()=>{e()},r=t=>{(t.key===`mcp-inspector-llm-config`||t.key===`mcp-inspector-api-keys`||t.key===`mcp-inspector-base-urls`)&&e()};return window.addEventListener(`llm-config-updated`,t),window.addEventListener(`storage`,r),()=>{window.removeEventListener(`llm-config-updated`,t),window.removeEventListener(`storage`,r)}},[h,_]),(0,w.useEffect)(()=>{let t=localStorage.getItem(`mcp-inspector-auth-config`);if(t)try{let e=JSON.parse(t);i(e),b(e.type),e.username&&S(e.username),e.password&&T(e.password),e.token&&D(e.token)}catch(e){console.error(`Failed to load auth config:`,e)}else try{let t=`mcp:auth_${TY(e)}_tokens`;localStorage.getItem(t)&&(i({type:`oauth`}),b(`oauth`))}catch(e){console.error(`Failed to check for OAuth tokens:`,e)}},[e]),(0,w.useEffect)(()=>{aY(s)||f(rY[s]);let e=h(),t=_();u(e[s]||``),m(t[s]||oY(s))},[s,h,_]),{llmConfig:t,authConfig:r,configDialogOpen:a,setConfigDialogOpen:o,tempProvider:s,setTempProvider:c,tempApiKey:l,setTempApiKey:u,tempModel:d,setTempModel:f,tempBaseUrl:p,setTempBaseUrl:m,tempAuthType:y,saveLLMConfig:(0,w.useCallback)(()=>{if(iY(s)&&!l.trim()||aY(s)&&!p.trim())return;let e=h();if(e[s]=l,g(e),aY(s)&&p.trim()){let e=_();e[s]=p.trim(),v(e)}let t={provider:s,apiKey:l,model:d,...aY(s)?{baseUrl:p.trim()||oY(s)}:{}},r={type:y,...y===`basic`&&{username:x.trim(),password:C.trim()},...y===`bearer`&&{token:E.trim()}};n(t),i(r),localStorage.setItem(`mcp-inspector-llm-config`,JSON.stringify(t)),localStorage.setItem(`mcp-inspector-auth-config`,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(`llm-config-updated`));try{ef.getInstance().capture(new Wd({provider:s,model:d})).catch(()=>{})}catch{}o(!1)},[s,l,d,p,y,x,C,E,h,g,_,v]),clearConfig:(0,w.useCallback)(()=>{n(null),i(null);let e=h();delete e[s],g(e);let t=_();delete t[s],v(t),u(``),m(oY(s)),S(``),T(``),D(``),b(`none`),localStorage.removeItem(`mcp-inspector-llm-config`),localStorage.removeItem(`mcp-inspector-auth-config`)},[s,h,g,_,v])}}function QNe({serverName:e,serverUrl:t,message:n,onReconnect:r,onDismiss:i}){let[a,o]=(0,w.useState)(!1),s=(0,w.useCallback)(async()=>{o(!0);try{await r()}finally{o(!1)}},[r]),c=e;if(!c)try{c=new URL(t).host}catch{c=t}return(0,S.jsx)(`div`,{className:`w-full flex justify-center items-center px-2 sm:px-4 mb-2`,children:(0,S.jsxs)(`div`,{role:`alert`,className:`w-full max-w-3xl flex items-start gap-3 rounded-md border border-amber-300/60 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/40 dark:bg-amber-950/40 dark:text-amber-100`,children:[(0,S.jsx)(Tf,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsxs)(`div`,{className:`font-medium`,children:[`Reconnect to `,(0,S.jsx)(`span`,{className:`font-semibold`,children:c})]}),(0,S.jsx)(`div`,{className:`text-xs opacity-90`,children:n??`The MCP server rejected your credentials. Reconnect to refresh them.`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsxs)(U,{size:`sm`,variant:`default`,onClick:s,disabled:a,children:[(0,S.jsx)(dp,{className:`size-3.5 ${a?`animate-spin`:``}`,"aria-hidden":!0}),a?`Reconnecting…`:`Reconnect`]}),i&&(0,S.jsx)(U,{size:`sm`,variant:`ghost`,onClick:i,"aria-label":`Dismiss`,children:`Dismiss`})]})]})})}function $Ne({className:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,S.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,S.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,S.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,S.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})}function ePe({className:e}){return(0,S.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function tPe({text:e}){return(0,S.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`}),(0,S.jsx)(`span`,{className:`mx-3 flex-shrink text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`})]})}function nPe({authOrigin:e,onDismiss:t,onUseApiKey:n}){let[r,i]=(0,w.useState)(``),[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(null),p=(0,w.useCallback)(()=>{window.dispatchEvent(new CustomEvent(`manufact:session-changed`)),t()},[t]),m=async t=>{t.preventDefault(),u(null),f(`email`);try{let t=await fetch(`${e}/api/auth/sign-in/email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:r,password:a,rememberMe:!0})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||`Incorrect email or password.`)}p()}catch(e){u(e instanceof Error?e.message:`Sign in failed.`)}finally{f(null)}},h=t=>{u(null),f(t);let n=`${window.location.origin}/inspector/oauth-popup-closed.html`;fetch(`${e}/api/auth/sign-in/social`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({provider:t,callbackURL:n})}).then(e=>e.json()).then(t=>{if(!t.url)throw Error(`No redirect URL returned`);let n=window.open(t.url,`manufact-oauth`,`width=500,height=650`),r=e=>{if(e.data?.type===`manufact:oauth-complete`){window.removeEventListener(`message`,r),clearInterval(i),f(null);try{n?.close()}catch{}p()}};window.addEventListener(`message`,r);let i=setInterval(async()=>{let t=!n||n.closed;try{if((await(await fetch(`${e}/api/auth/get-session`,{credentials:`include`})).json().catch(()=>null))?.user){if(clearInterval(i),window.removeEventListener(`message`,r),f(null),!t)try{n?.close()}catch{}p();return}}catch{}t&&(clearInterval(i),window.removeEventListener(`message`,r),f(null))},2e3)}).catch(e=>{u(e instanceof Error?e.message:`OAuth failed.`),f(null)})},g=d!==null;return(0,S.jsx)(yN,{open:!0,onOpenChange:e=>{e||t()},children:(0,S.jsxs)(xN,{className:`max-w-sm`,children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Sign in to Manufact`}),(0,S.jsx)(wN,{children:`Sign in to unlock generous usage limits on the Manufact free tier.`})]}),(0,S.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(ON,{htmlFor:`lm-email`,children:`Email`}),(0,S.jsx)(TN,{id:`lm-email`,type:`email`,placeholder:`you@example.com`,value:r,onChange:e=>{i(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`email`})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(ON,{htmlFor:`lm-password`,children:`Password`}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(TN,{id:`lm-password`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>{o(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`current-password`,className:`pr-10`}),(0,S.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),"aria-label":s?`Hide password`:`Show password`,tabIndex:-1,children:s?(0,S.jsx)(If,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})})]})]}),l&&(0,S.jsxs)(`p`,{className:`text-sm text-destructive flex items-center gap-1.5`,children:[(0,S.jsx)(Tf,{className:`h-4 w-4 shrink-0`}),l]}),(0,S.jsx)(U,{type:`submit`,disabled:g,className:`w-full`,children:d===`email`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),`Signing in…`]}):`Sign in`})]}),(0,S.jsx)(tPe,{text:`Or continue with`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`google`),children:[d===`google`?(0,S.jsx)(zq,{className:`mr-2`}):(0,S.jsx)($Ne,{className:H(`mr-2 h-4 w-4`)}),`Google`]}),(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`github`),children:[d===`github`?(0,S.jsx)(zq,{className:`mr-2`}):(0,S.jsx)(ePe,{className:H(`mr-2 h-4 w-4`)}),`GitHub`]})]}),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tPe,{text:`or`}),(0,S.jsx)(`button`,{type:`button`,disabled:g,onClick:n,className:`w-full text-sm text-muted-foreground hover:text-foreground transition-colors text-center`,children:`Use your own API key`})]}),(0,S.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground pt-1`,children:[`By signing in you agree to our`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/terms`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Terms`}),` `,`and`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/privacy`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Privacy Policy`})]})]})})}var rPe=/(?:^\/$|\s+\/$)/,iPe=[`ArrowDown`,`ArrowUp`,`Escape`,`Enter`];function aPe({connection:e,isConnected:t,useClientSide:n=!0,enableKeyboardShortcuts:r=!0,prompts:i,serverId:a,callPrompt:o,readResource:s,chatApiUrl:c,waitForChatApiUrl:l,initialMessages:u,managedLlmConfig:d,enableFreeTierUpgrade:f=!1,clearButtonLabel:p,hideTitle:m,hideModelBadge:h,hideServerUrl:g,clearButtonHideIcon:_,clearButtonHideShortcut:v,clearButtonVariant:y,hideClearButton:b,hideToolSelector:x,chatQuickQuestions:C=[],chatFollowups:T=[],streamProtocol:E,credentials:D,extraHeaders:O,body:k}){let[A,j]=(0,w.useState)(``),[M,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(-1),[I,L]=(0,w.useState)(C),[ee,te]=(0,w.useState)(T),[ne,re]=(0,w.useState)(new Set),R=(0,w.useRef)(null),z=(0,w.useRef)(null),B=(0,w.useRef)(null),ie=(0,w.useMemo)(()=>(e.tools??[]).map(e=>({name:e.name,description:e.description})),[e.tools]),{llmConfig:ae,authConfig:oe,configDialogOpen:se,setConfigDialogOpen:ce,tempProvider:le,setTempProvider:ue,tempApiKey:de,setTempApiKey:fe,tempModel:pe,setTempModel:me,tempBaseUrl:he,setTempBaseUrl:ge,saveLLMConfig:_e,clearConfig:ve}=K7({mcpServerUrl:e.url}),ye=!n&&d!=null,[be,xe]=(0,w.useState)(()=>ye?!1:!!ae),Se=ye?be:n||be||!!ae,Ce=Se?ae:d??ae,we=!Se&&!!d,{getAllModelContexts:Te}=yQ(),Ee=Te(),De={connection:e,llmConfig:Ce,isConnected:t,readResource:s,widgetModelContexts:Ee,disabledTools:ne},Oe=JNe({mcpServerUrl:e.url,llmConfig:Ce,authConfig:oe,isConnected:t,chatApiUrl:c,waitForChatApiUrl:l,widgetModelContexts:Ee,initialMessages:u,disabledTools:ne,streamProtocol:E,credentials:D,extraHeaders:O,body:k}),ke=ZNe(De),{messages:Ae,isLoading:je,attachments:Me,sendMessage:Ne,clearMessages:Pe,setMessages:Fe,stop:Ie,addAttachment:Le,removeAttachment:Re}=Se?ke:Oe,ze=Se?null:Oe.rateLimitInfo??null,Be=Se?void 0:Oe.clearRateLimitInfo,Ve=Se?null:Oe.mcpServerAuthRequired??null,He=Se?void 0:Oe.clearMcpServerAuthRequired,Ue=(0,w.useCallback)(async()=>{try{await e.authenticate()}catch(e){console.error(`[ChatTab] MCP reconnect failed:`,e),PM.error(e instanceof Error?`Reconnect failed: ${e.message}`:`Reconnect failed`);return}He?.()},[e,He]),We=Ve?(0,S.jsx)(QNe,{serverName:e.name,serverUrl:Ve.mcpServerUrl,message:Ve.message,onReconnect:Ue,onDismiss:He}):null,Ge=(0,w.useCallback)(()=>{Be?.(),xe(!0),ce(!0)},[Be,ce]),[Ke,qe]=(0,w.useState)(!1),Je=(0,w.useCallback)(()=>{ce(!1),qe(!0)},[ce]),Ye=we&&f?{onLoginClick:Je}:void 0,V=!!d&&!!h,Xe=V||!!h&&!Se,{filteredPrompts:Ze,setSelectedPrompt:Qe,selectedPrompt:$e,setPromptArgs:et,executePrompt:tt,results:nt,handleDeleteResult:rt,clearPromptResults:it}=kJ({prompts:i,callPrompt:o,serverId:a}),at=(0,w.useCallback)(e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).slice(0,8):[],[]),ot=(0,w.useCallback)(e=>{if(typeof e.content==`string`&&e.content.trim())return e.content;if(Array.isArray(e.content)&&e.content.length>0)return e.content.map(e=>typeof e==`string`?e:e.text??``).join(``);if(e.parts&&e.parts.length>0){let t=e.parts.filter(e=>e.type===`text`&&e.text).map(e=>e.text);if(t.length>0)return t.join(`
|
|
801
|
+
`)}`,timestamp:Date.now()})}let x=(_.attachments?.length??0)>0,S=KNe([...o,...g,...v,...c.trim()||x?[_]:[]]);S.unshift({role:`system`,content:XNe});let C=e=>{try{return JSON.parse(e)}catch{let t=[()=>{let t=e;(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)},()=>{let t=e;t=t.replace(/,\s*"[^"]*"?\s*:\s*("([^"\\]|\\.)*)?$/,``),t=t.replace(/,\s*"[^"]*$/,``),(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)}];for(let e of t)try{return e()}catch{}return}},w=()=>{s(e=>e.map(e=>e.id===n?{...e,parts:[...u]}:e))},T=async e=>{let t=e.toolInvocation?.result,n=t?._meta?.[`openai/outputTemplate`];if(!(!n||typeof n!=`string`||!r))try{let i=await r(n);if(i?.contents&&Array.isArray(i.contents)){let n=i.contents.map(e=>({type:`resource`,resource:e}));e.toolInvocation.result={...t,content:[...t.content||[],...n],structuredContent:t?.structuredContent||null}}}catch(e){console.error(`Failed to fetch Apps SDK resource:`,e)}};for await(let n of YNe({config:{provider:t.provider,model:t.model,apiKey:t.apiKey,temperature:t.temperature,baseUrl:t.baseUrl},messages:S,tools:h,callTool:async(t,n)=>await e.callTool(t,n,{signal:f.current?.signal}),maxSteps:10,signal:f.current?.signal})){if(f.current?.signal.aborted)break;if(n.type===`text-delta`){l+=n.delta;let e=u[u.length-1];e&&e.type===`text`?e.text=l:u.push({type:`text`,text:l}),w()}else if(n.type===`tool-call-start`)l&&=``,d.set(n.toolCallId,{name:n.toolName,accumulatedJson:``}),u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:{},state:`streaming`,partialArgs:{}}}),w();else if(n.type===`tool-call-args-delta`){let e=d.get(n.toolCallId);if(e){e.accumulatedJson+=n.argsDelta;let t=C(e.accumulatedJson);if(t){let n=u.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.state===`streaming`&&t.toolInvocation?.toolName===e.name);if(n&&n.toolInvocation){let e=n.toolInvocation.partialArgs,r=e?Object.keys(e):[],i=Object.keys(t),a=r.reduce((t,n)=>t+String(e[n]??``).length,0),o=i.reduce((e,n)=>e+String(t[n]??``).length,0);(i.length>r.length||o>=a)&&(n.toolInvocation.partialArgs=t),w(),await m()}}}}else if(n.type===`tool-call-ready`){b++,l&&=``;let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.state===`streaming`&&e.toolInvocation?.toolName===n.toolName);e&&e.toolInvocation?(e.toolInvocation.args=n.args,e.toolInvocation.state=`pending`):u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:n.args,state:`pending`}}),w()}else if(n.type===`tool-result`){let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.toolName===n.toolName&&!e.toolInvocation?.result);e&&e.toolInvocation&&(e.toolInvocation.result=n.result,e.toolInvocation.state=n.isError||n.result?.isError?`error`:`result`,await T(e),w())}else if(n.type===`error`)throw Error(n.message)}if(f.current?.signal.aborted)for(let e of u)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);s(e=>e.map(e=>e.id===n?{...e,parts:[...u],content:``}:e)),t&&ef.getInstance().capture(new Ld({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!0,executionMode:`client-side`,duration:Date.now()-y})).catch(()=>{})}catch(n){if(n instanceof DOMException&&n.name===`AbortError`)return;console.error(`Client-side agent error:`,n);let r=`Unknown error occurred`;if(n instanceof Error){r=n.message;let e=n;e.status&&(r=`HTTP ${e.status}: ${r}`),(e.code===401||r.includes(`401`)||r.includes(`Unauthorized`))&&(r=`Authentication failed (401). Check your Authorization header in the connection settings.`)}t&&ef.getInstance().capture(new Ld({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!1,executionMode:`client-side`,duration:Date.now()-y,error:r})).catch(()=>{});let i={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${r}`,timestamp:Date.now()};s(e=>[...e,i])}finally{l(!1),f.current=null}},[e,t,n,o,r,u,a,i]),clearMessages:(0,w.useCallback)(()=>{s([])},[]),setMessages:s,stop:(0,w.useCallback)(()=>{f.current&&f.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await DY(e);d(e=>{let n=[...e,t];return EY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{d(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{d([])},[])}}function K7({mcpServerUrl:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(`openai`),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(rY.openai),[p,m]=(0,w.useState)(oY(`openai`)),h=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-api-keys`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load API keys:`,e),{}}return{}},[]),g=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-api-keys`,JSON.stringify(e))},[]),_=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-base-urls`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load base URLs:`,e),{}}return{}},[]),v=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-base-urls`,JSON.stringify(e))},[]),[y,b]=(0,w.useState)(`none`),[x,S]=(0,w.useState)(``),[C,T]=(0,w.useState)(``),[E,D]=(0,w.useState)(``);return(0,w.useEffect)(()=>{let e=()=>{let e=localStorage.getItem(`mcp-inspector-llm-config`),t=h(),r=_();if(e)try{let i=JSON.parse(e);n(i),c(i.provider),u(t[i.provider]||i.apiKey||``),f(i.model),m(r[i.provider]||i.baseUrl||oY(i.provider))}catch(e){console.error(`Failed to load LLM config:`,e)}};e();let t=()=>{e()},r=t=>{(t.key===`mcp-inspector-llm-config`||t.key===`mcp-inspector-api-keys`||t.key===`mcp-inspector-base-urls`)&&e()};return window.addEventListener(`llm-config-updated`,t),window.addEventListener(`storage`,r),()=>{window.removeEventListener(`llm-config-updated`,t),window.removeEventListener(`storage`,r)}},[h,_]),(0,w.useEffect)(()=>{let t=localStorage.getItem(`mcp-inspector-auth-config`);if(t)try{let e=JSON.parse(t);i(e),b(e.type),e.username&&S(e.username),e.password&&T(e.password),e.token&&D(e.token)}catch(e){console.error(`Failed to load auth config:`,e)}else try{let t=`mcp:auth_${TY(e)}_tokens`;localStorage.getItem(t)&&(i({type:`oauth`}),b(`oauth`))}catch(e){console.error(`Failed to check for OAuth tokens:`,e)}},[e]),(0,w.useEffect)(()=>{aY(s)||f(rY[s]);let e=h(),t=_();u(e[s]||``),m(t[s]||oY(s))},[s,h,_]),{llmConfig:t,authConfig:r,configDialogOpen:a,setConfigDialogOpen:o,tempProvider:s,setTempProvider:c,tempApiKey:l,setTempApiKey:u,tempModel:d,setTempModel:f,tempBaseUrl:p,setTempBaseUrl:m,tempAuthType:y,saveLLMConfig:(0,w.useCallback)(()=>{if(iY(s)&&!l.trim()||aY(s)&&!p.trim())return;let e=h();if(e[s]=l,g(e),aY(s)&&p.trim()){let e=_();e[s]=p.trim(),v(e)}let t={provider:s,apiKey:l,model:d,...aY(s)?{baseUrl:p.trim()||oY(s)}:{}},r={type:y,...y===`basic`&&{username:x.trim(),password:C.trim()},...y===`bearer`&&{token:E.trim()}};n(t),i(r),localStorage.setItem(`mcp-inspector-llm-config`,JSON.stringify(t)),localStorage.setItem(`mcp-inspector-auth-config`,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(`llm-config-updated`));try{ef.getInstance().capture(new Wd({provider:s,model:d})).catch(()=>{})}catch{}o(!1)},[s,l,d,p,y,x,C,E,h,g,_,v]),clearConfig:(0,w.useCallback)(()=>{n(null),i(null);let e=h();delete e[s],g(e);let t=_();delete t[s],v(t),u(``),m(oY(s)),S(``),T(``),D(``),b(`none`),localStorage.removeItem(`mcp-inspector-llm-config`),localStorage.removeItem(`mcp-inspector-auth-config`)},[s,h,g,_,v])}}function QNe({serverName:e,serverUrl:t,message:n,onReconnect:r,onDismiss:i}){let[a,o]=(0,w.useState)(!1),s=(0,w.useCallback)(async()=>{o(!0);try{await r()}finally{o(!1)}},[r]),c=e;if(!c)try{c=new URL(t).host}catch{c=t}return(0,S.jsx)(`div`,{className:`w-full flex justify-center items-center px-2 sm:px-4 mb-2`,children:(0,S.jsxs)(`div`,{role:`alert`,className:`w-full max-w-3xl flex items-start gap-3 rounded-md border border-amber-300/60 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/40 dark:bg-amber-950/40 dark:text-amber-100`,children:[(0,S.jsx)(Tf,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsxs)(`div`,{className:`font-medium`,children:[`Reconnect to `,(0,S.jsx)(`span`,{className:`font-semibold`,children:c})]}),(0,S.jsx)(`div`,{className:`text-xs opacity-90`,children:n??`The MCP server rejected your credentials. Reconnect to refresh them.`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsxs)(U,{size:`sm`,variant:`default`,onClick:s,disabled:a,children:[(0,S.jsx)(dp,{className:`size-3.5 ${a?`animate-spin`:``}`,"aria-hidden":!0}),a?`Reconnecting…`:`Reconnect`]}),i&&(0,S.jsx)(U,{size:`sm`,variant:`ghost`,onClick:i,"aria-label":`Dismiss`,children:`Dismiss`})]})]})})}function $Ne({className:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,S.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,S.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,S.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,S.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})}function ePe({className:e}){return(0,S.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function tPe({text:e}){return(0,S.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`}),(0,S.jsx)(`span`,{className:`mx-3 flex-shrink text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`})]})}function nPe({authOrigin:e,onDismiss:t,onUseApiKey:n}){let[r,i]=(0,w.useState)(``),[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(null),p=(0,w.useCallback)(()=>{window.dispatchEvent(new CustomEvent(`manufact:session-changed`)),t()},[t]),m=async t=>{t.preventDefault(),u(null),f(`email`);try{let t=await fetch(`${e}/api/auth/sign-in/email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:r,password:a,rememberMe:!0})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||`Incorrect email or password.`)}p()}catch(e){u(e instanceof Error?e.message:`Sign in failed.`)}finally{f(null)}},h=t=>{u(null),f(t);let n=`${window.location.origin}/inspector/oauth-popup-closed.html`;fetch(`${e}/api/auth/sign-in/social`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({provider:t,callbackURL:n})}).then(e=>e.json()).then(t=>{if(!t.url)throw Error(`No redirect URL returned`);let n=window.open(t.url,`manufact-oauth`,`width=500,height=650`),r=e=>{if(e.data?.type===`manufact:oauth-complete`){window.removeEventListener(`message`,r),clearInterval(i),f(null);try{n?.close()}catch{}p()}};window.addEventListener(`message`,r);let i=setInterval(async()=>{let t=!n||n.closed;try{if((await(await fetch(`${e}/api/auth/get-session`,{credentials:`include`})).json().catch(()=>null))?.user){if(clearInterval(i),window.removeEventListener(`message`,r),f(null),!t)try{n?.close()}catch{}p();return}}catch{}t&&(clearInterval(i),window.removeEventListener(`message`,r),f(null))},2e3)}).catch(e=>{u(e instanceof Error?e.message:`OAuth failed.`),f(null)})},g=d!==null;return(0,S.jsx)(yN,{open:!0,onOpenChange:e=>{e||t()},children:(0,S.jsxs)(xN,{className:`max-w-sm`,children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Sign in to Manufact`}),(0,S.jsx)(wN,{children:`Sign in to unlock generous usage limits on the Manufact free tier.`})]}),(0,S.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(ON,{htmlFor:`lm-email`,children:`Email`}),(0,S.jsx)(TN,{id:`lm-email`,type:`email`,placeholder:`you@example.com`,value:r,onChange:e=>{i(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`email`})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(ON,{htmlFor:`lm-password`,children:`Password`}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(TN,{id:`lm-password`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>{o(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`current-password`,className:`pr-10`}),(0,S.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),"aria-label":s?`Hide password`:`Show password`,tabIndex:-1,children:s?(0,S.jsx)(If,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})})]})]}),l&&(0,S.jsxs)(`p`,{className:`text-sm text-destructive flex items-center gap-1.5`,children:[(0,S.jsx)(Tf,{className:`h-4 w-4 shrink-0`}),l]}),(0,S.jsx)(U,{type:`submit`,disabled:g,className:`w-full`,children:d===`email`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),`Signing in…`]}):`Sign in`})]}),(0,S.jsx)(tPe,{text:`Or continue with`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`google`),children:[d===`google`?(0,S.jsx)(zq,{className:`mr-2`}):(0,S.jsx)($Ne,{className:H(`mr-2 h-4 w-4`)}),`Google`]}),(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`github`),children:[d===`github`?(0,S.jsx)(zq,{className:`mr-2`}):(0,S.jsx)(ePe,{className:H(`mr-2 h-4 w-4`)}),`GitHub`]})]}),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tPe,{text:`or`}),(0,S.jsx)(`button`,{type:`button`,disabled:g,onClick:n,className:`w-full text-sm text-muted-foreground hover:text-foreground transition-colors text-center`,children:`Use your own API key`})]}),(0,S.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground pt-1`,children:[`By signing in you agree to our`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/terms`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Terms`}),` `,`and`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/privacy`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Privacy Policy`})]})]})})}var rPe=/(?:^\/$|\s+\/$)/,iPe=[`ArrowDown`,`ArrowUp`,`Escape`,`Enter`];function aPe({connection:e,isConnected:t,useClientSide:n=!0,enableKeyboardShortcuts:r=!0,prompts:i,serverId:a,callPrompt:o,readResource:s,chatApiUrl:c,waitForChatApiUrl:l,initialMessages:u,managedLlmConfig:d,enableFreeTierUpgrade:f=!1,clearButtonLabel:p,hideTitle:m,hideModelBadge:h,hideServerUrl:g,clearButtonHideIcon:_,clearButtonHideShortcut:v,clearButtonVariant:y,hideClearButton:b,hideToolSelector:x,chatQuickQuestions:C=[],chatFollowups:T=[],streamProtocol:E,credentials:D,extraHeaders:O,body:k}){let[A,j]=(0,w.useState)(``),[M,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(-1),[I,L]=(0,w.useState)(C),[ee,te]=(0,w.useState)(T),[ne,re]=(0,w.useState)(new Set),R=(0,w.useRef)(null),z=(0,w.useRef)(null),B=(0,w.useRef)(null),ie=(0,w.useMemo)(()=>(e.tools??[]).map(e=>({name:e.name,description:e.description})),[e.tools]),{llmConfig:ae,authConfig:oe,configDialogOpen:se,setConfigDialogOpen:ce,tempProvider:le,setTempProvider:ue,tempApiKey:de,setTempApiKey:fe,tempModel:pe,setTempModel:me,tempBaseUrl:he,setTempBaseUrl:ge,saveLLMConfig:_e,clearConfig:ve}=K7({mcpServerUrl:e.url}),ye=!n&&d!=null,[be,xe]=(0,w.useState)(()=>ye?!1:!!ae),Se=ye?be:n||be||!!ae,Ce=Se?ae:d??ae,we=!Se&&!!d,{getAllModelContexts:Te}=bQ(),Ee=Te(),De={connection:e,llmConfig:Ce,isConnected:t,readResource:s,widgetModelContexts:Ee,disabledTools:ne},Oe=JNe({mcpServerUrl:e.url,llmConfig:Ce,authConfig:oe,isConnected:t,chatApiUrl:c,waitForChatApiUrl:l,widgetModelContexts:Ee,initialMessages:u,disabledTools:ne,streamProtocol:E,credentials:D,extraHeaders:O,body:k}),ke=ZNe(De),{messages:Ae,isLoading:je,attachments:Me,sendMessage:Ne,clearMessages:Pe,setMessages:Fe,stop:Ie,addAttachment:Le,removeAttachment:Re}=Se?ke:Oe,ze=Se?null:Oe.rateLimitInfo??null,Be=Se?void 0:Oe.clearRateLimitInfo,Ve=Se?null:Oe.mcpServerAuthRequired??null,He=Se?void 0:Oe.clearMcpServerAuthRequired,Ue=(0,w.useCallback)(async()=>{try{await e.authenticate()}catch(e){console.error(`[ChatTab] MCP reconnect failed:`,e),PM.error(e instanceof Error?`Reconnect failed: ${e.message}`:`Reconnect failed`);return}He?.()},[e,He]),We=Ve?(0,S.jsx)(QNe,{serverName:e.name,serverUrl:Ve.mcpServerUrl,message:Ve.message,onReconnect:Ue,onDismiss:He}):null,Ge=(0,w.useCallback)(()=>{Be?.(),xe(!0),ce(!0)},[Be,ce]),[Ke,qe]=(0,w.useState)(!1),Je=(0,w.useCallback)(()=>{ce(!1),qe(!0)},[ce]),Ye=we&&f?{onLoginClick:Je}:void 0,V=!!d&&!!h,Xe=V||!!h&&!Se,{filteredPrompts:Ze,setSelectedPrompt:Qe,selectedPrompt:$e,setPromptArgs:et,executePrompt:tt,results:nt,handleDeleteResult:rt,clearPromptResults:it}=kJ({prompts:i,callPrompt:o,serverId:a}),at=(0,w.useCallback)(e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).slice(0,8):[],[]),ot=(0,w.useCallback)(e=>{if(typeof e.content==`string`&&e.content.trim())return e.content;if(Array.isArray(e.content)&&e.content.length>0)return e.content.map(e=>typeof e==`string`?e:e.text??``).join(``);if(e.parts&&e.parts.length>0){let t=e.parts.filter(e=>e.type===`text`&&e.text).map(e=>e.text);if(t.length>0)return t.join(`
|
|
802
802
|
`)}return``},[]),st=(0,w.useCallback)(e=>{if(e==null)return`No result`;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}if(typeof e==`object`&&Array.isArray(e.content)){let t=e.content;return t.length===0?`Empty result`:t.map(e=>{if(e.type===`text`){let t=e.text||``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}return e.type===`image`?`[Image: ${e.mimeType}]`:e.type===`resource`?`[Resource: ${e.resource?.uri||`unknown`}]`:JSON.stringify(e,null,2)}).join(`
|
|
803
803
|
|
|
804
804
|
`)}return JSON.stringify(e,null,2)},[]),ct=(0,w.useCallback)(()=>Ae.map(e=>{let t=ot(e),n=e.parts?.filter(e=>e.type===`tool-invocation`&&e.toolInvocation).map(e=>({toolName:e.toolInvocation.toolName,args:e.toolInvocation.args,state:e.toolInvocation.state,result:typeof e.toolInvocation.result==`string`?e.toolInvocation.result.slice(0,2e3):e.toolInvocation.result==null?void 0:JSON.stringify(e.toolInvocation.result).slice(0,2e3)})),r=t||(n?.length?`[Tool calls: ${n.map(e=>`${e.toolName}(${e.state})`).join(`, `)}]`:``);return{id:e.id,role:e.role,content:r,timestamp:e.timestamp,toolInvocations:n?.length?n:void 0}}),[Ae,ot]),lt=(0,w.useCallback)((e,t={})=>{typeof window>`u`||window.parent===window||window.parent.postMessage({type:e,serverId:a,...t},`*`)},[a]);(0,w.useEffect)(()=>{lt(`mcp-inspector:chat:ready`,{capabilities:{send:!0,clear:!0,getState:!0,setQuickQuestions:!0,setFollowups:!0,loadMessages:!0}})},[lt]),(0,w.useEffect)(()=>{lt(`mcp-inspector:chat:state_changed`,{isLoading:je,messageCount:Ae.length,messages:ct(),quickQuestions:I,followups:ee})},[ee,ct,je,Ae.length,lt,I]),(0,w.useEffect)(()=>{let e=e=>{if(!e.data||typeof e.data!=`object`)return;let n=e.data;if(!n.type?.startsWith(`mcp-inspector:chat:`)||n.serverId&&n.serverId!==a)return;let r=n.requestId,i=(e,t={})=>{lt(`mcp-inspector:chat:command_result`,{requestId:r,ok:e,...t})};if(n.type===`mcp-inspector:chat:send`){let e=(n.message??n.prompt??``).trim();if(!e){i(!1,{error:`Missing message`});return}if(!Ce||!t){i(!1,{error:`Chat is not ready to send messages`});return}Ne(e,[]).then(()=>{lt(`mcp-inspector:chat:message_sent`,{requestId:r,message:e,source:`bridge`}),i(!0)}).catch(e=>{i(!1,{error:e instanceof Error?e.message:String(e)})});return}if(n.type===`mcp-inspector:chat:clear`){Pe(),lt(`mcp-inspector:chat:cleared`,{requestId:r}),i(!0);return}if(n.type===`mcp-inspector:chat:get_state`){lt(`mcp-inspector:chat:state`,{requestId:r,isLoading:je,messageCount:Ae.length,messages:ct(),quickQuestions:I,followups:ee}),i(!0);return}if(n.type===`mcp-inspector:chat:set_quick_questions`){let e=at(n.questions);L(e),i(!0,{quickQuestions:e});return}if(n.type===`mcp-inspector:chat:set_followups`){let e=at(n.followups);te(e),i(!0,{followups:e});return}if(n.type===`mcp-inspector:chat:load_messages`){let e=n.messages;if(!Array.isArray(e)){i(!1,{error:`messages must be an array`});return}Fe(e),i(!0,{count:e.length});return}if(n.type===`mcp-inspector:chat:screenshot`){let e=n.toolCallId;(async()=>{try{let t=null;if(e&&(t=document.querySelector(`[data-tool-call-id="${e}"]`)),!t){let e=document.querySelectorAll(`[data-tool-call-id]`);e.length>0&&(t=e[e.length-1])}if(!t&&z.current&&(t=z.current),!t){i(!1,{error:`No screenshot target found`});return}let n=1e4,a=null,o=``,s=``;try{let e=await J(()=>import(`https://esm.sh/html-to-image@1.11.13`),[]);e?.toPng?a=await Promise.race([e.toPng(t,{pixelRatio:1,backgroundColor:`#ffffff`,includeQueryParams:!0}),new Promise((e,t)=>setTimeout(()=>t(Error(`html-to-image timed out`)),n))]):o=`toPng not found on module`}catch(e){o=e instanceof Error?e.message:String(e)}if(!a)try{if(!window.html2canvas){let e=document.createElement(`script`);e.src=`https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js`,document.head.appendChild(e),await new Promise((t,n)=>{e.onload=()=>t(),e.onerror=()=>n(Error(`Failed to load html2canvas`))})}let e=window.html2canvas;a=(await Promise.race([e(t,{useCORS:!0,allowTaint:!0,backgroundColor:`#ffffff`,scale:1,logging:!1,foreignObjectRendering:!1}),new Promise((e,t)=>setTimeout(()=>t(Error(`html2canvas timed out`)),n))])).toDataURL(`image/png`)}catch(e){s=e instanceof Error?e.message:String(e)}if(a)lt(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:a,timestamp:Date.now()}),i(!0);else{let t=z.current||document.body,n=t.innerText?.substring(0,5e3)||``,a=t.innerHTML?.substring(0,1e4)||``;lt(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,domHtml:a,error:`html-to-image: ${o||`ok`}; html2canvas: ${s||`ok`}`,timestamp:Date.now()}),i(!1,{error:`html-to-image: ${o}; html2canvas: ${s}`})}}catch(t){let n=(z.current||document.body).innerText?.substring(0,5e3)||``;lt(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,error:t instanceof Error?t.message:`Screenshot capture failed`,timestamp:Date.now()}),i(!1,{error:t instanceof Error?t.message:`Screenshot failed`})}})();return}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Pe,Fe,ee,ct,je,Ae.length,lt,I,at,Ne,a,Ce,t]),Wq(r?{onNewChat:Pe}:{});let ut=(0,w.useCallback)(()=>{F(-1),N(!1),B.current=null},[]),dt=(0,w.useCallback)(()=>{if(!R.current)return;let e=R.current.selectionStart,t=A.slice(0,e),n=rPe.test(t);N(n),n?(B.current={start:e-1,end:e},F(0)):ut()},[A,ut]);(0,w.useEffect)(()=>{Ce&&Ae.length===0&&R.current&&R.current.focus()},[Ce,Ae.length]),(0,w.useEffect)(()=>{!je&&Ae.length>0&&R.current&&R.current.focus()},[je,Ae.length]),(0,w.useEffect)(()=>{R.current&&dt()},[A,dt]);let ft=(0,w.useCallback)(()=>{Qe(null),et({}),ut()},[ut]),pt=(0,w.useCallback)(async e=>{if(Qe(e),e.arguments&&e.arguments.length>0){Qe(null),PM.error(`Prompts with arguments are not supported`,{description:`This prompt requires arguments which are not yet supported in chat mode.`});return}try{await tt(e,{})}catch(e){console.error(`Error executing prompt`,e)}finally{if(R.current&&B.current){let{start:e,end:t}=B.current;j(A.slice(0,e)+A.slice(t)),requestAnimationFrame(()=>{R.current?.focus(),R.current?.setSelectionRange(e,e)})}ft()}},[tt,ft,A]),mt=(0,w.useCallback)(()=>{(A.trim()||nt.length>0||Me.length>0)&&(Ne(A,nt),j(``),it())},[A,nt,Ne,it,Me]),ht=(0,w.useCallback)(e=>{if(e.key===`ArrowDown`)F(e=>Ze.length===0?-1:(e+1)%Ze.length);else if(e.key===`ArrowUp`)F(e=>Ze.length===0?-1:(e-1+Ze.length)%Ze.length);else if(e.key===`Escape`)e.stopPropagation(),ut();else if(e.key===`Enter`&&P>=0){let e=Ze[P];e&&pt(e)}},[Ze,P,pt,ut]),gt=(0,w.useCallback)(e=>{iPe.includes(e.key)&&M?(e.preventDefault(),ht(e)):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),mt())},[mt,ht,M]),_t=(0,w.useCallback)(e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&dt()},[dt]),vt=(0,w.useCallback)(e=>{let t=`# Chat Export - ${new Date().toLocaleString()}\n\n`;return t+=e.map(e=>{let t=e.role.charAt(0).toUpperCase()+e.role.slice(1);if(!e.parts||e.parts.length===0){let n=ot(e).trim();return n?`## ${t}\n${n}`:``}let n=[];for(let t of e.parts)if(t.type===`text`&&t.text?.trim())n.push(t.text.trim());else if(t.type===`tool-invocation`&&t.toolInvocation){let e=t.toolInvocation,r=st(e.result);n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args,null,2)}\n\`\`\`\n**Result:**\n\n${r}`)}return n.length===0?``:`## ${t}\n\n${n.join(`
|
|
@@ -822,9 +822,9 @@ Based on this information, suggest 3-5 common customizable properties like theme
|
|
|
822
822
|
</body>
|
|
823
823
|
</html>
|
|
824
824
|
`),e.document.close()}}}},[k,ee]),he=(0,w.useCallback)(()=>{N?(se.current&&se.current.expand(),ce.current&&ce.current.expand(),P(!1)):(se.current&&se.current.collapse(),ce.current&&ce.current.collapse(),P(!0))},[N,se,ce]),ge=(0,w.useCallback)(()=>{I&&(x(``),y(!0))},[I]),_e=(0,w.useCallback)(e=>{le(g.filter(t=>t.id!==e)),c?.id===e&&l(null)},[g,le,c]);return k?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[j!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{j===`response`?M(`detail`):(L(null),M(`list`))},className:`p-0 h-8 w-8`,children:(0,S.jsx)(bf,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{L(null),M(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Prompts`}),j===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`button`,{onClick:()=>{M(`response`)},className:j===`detail`?`text-foreground hover:underline`:j===`response`?`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`:`text-muted-foreground`,children:`Execute`})]}),j===`response`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Response`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(JK,{initial:!1,mode:`popLayout`,children:[j===`list`&&(0,S.jsxs)(Lq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(OFe,{activeTab:m,isSearchExpanded:C,searchQuery:ae,filteredPromptsCount:F.length,savedPromptsCount:g.length,onSearchExpand:()=>T(!0),onSearchChange:oe,onSearchBlur:ue,onTabSwitch:()=>h(m===`prompts`?`saved`:`prompts`),searchInputRef:O,onRefresh:a?de:void 0,isRefreshing:o}),m===`prompts`?(0,S.jsx)(DFe,{prompts:F,selectedPrompt:I,onPromptSelect:z,focusedIndex:E}):(0,S.jsx)(kFe,{savedPrompts:g,selectedPrompt:c,onLoadPrompt:fe,onDeletePrompt:_e,focusedIndex:E})]},`list`),j===`detail`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-10`,children:(0,S.jsx)(jFe,{selectedPrompt:I,promptArgs:ne,isExecuting:R,isConnected:i,onArgChange:B,onExecute:ie,onSave:ge})},`detail`),j===`response`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-20`,children:(0,S.jsx)(RFe,{results:ee,copiedResult:f,onCopy:pe,onDelete:te,onFullscreen:me})},`response`)]})})]}):(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{id:`left-panel`,panelRef:se,defaultSize:`33%`,collapsible:!0,className:`flex flex-col h-full relative`,children:(0,S.jsxs)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(k9,{defaultSize:`75%`,minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(OFe,{activeTab:m,isSearchExpanded:C,searchQuery:ae,filteredPromptsCount:F.length,savedPromptsCount:g.length,onSearchExpand:()=>T(!0),onSearchChange:oe,onSearchBlur:ue,onTabSwitch:()=>h(m===`prompts`?`saved`:`prompts`),searchInputRef:O,onRefresh:a?de:void 0,isRefreshing:o}),m===`prompts`?(0,S.jsx)(DFe,{prompts:F,selectedPrompt:I,onPromptSelect:z,focusedIndex:E}):(0,S.jsx)(kFe,{savedPrompts:g,selectedPrompt:c,onLoadPrompt:fe,onDeletePrompt:_e,focusedIndex:E})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(P9,{serverId:r})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`67%`,children:(0,S.jsxs)(O9,{orientation:`vertical`,children:[(0,S.jsx)(k9,{panelRef:ce,defaultSize:`40%`,collapsible:!0,children:(0,S.jsx)(jFe,{selectedPrompt:I,promptArgs:ne,isExecuting:R,isConnected:i,onArgChange:B,onExecute:ie,onSave:ge})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`60%`,children:(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(RFe,{results:ee,copiedResult:f,onCopy:pe,onDelete:te,onFullscreen:me,onMaximize:he,isMaximized:N})})})]})})]})}BFe.displayName=`PromptsTab`;function F9(e){if(!e?.mimeType)return!1;let t=e.mimeType.toLowerCase();return t===`text/html`||t===`text/html;profile=mcp-app`||t===`text/html+skybridge`||t===`text/uri-list`||t.startsWith(`application/vnd.mcp-ui.remote-dom`)}function VFe({resource:e,className:t}){let n=e,r=(0,w.useMemo)(()=>{if(n.text)return n.text;if(n.blob)try{return atob(n.blob)}catch{return null}return null},[n.text,n.blob]);return r?(0,S.jsx)(`div`,{className:t,children:(0,S.jsx)(`iframe`,{srcDoc:r,sandbox:`allow-scripts allow-forms allow-popups`,title:e.uri??`MCP UI Resource`,style:{width:`100%`,minHeight:`200px`,border:`none`}})}):null}function HFe(e){if(`error`in e&&e.error&&typeof e.error==`string`)return e.error;if(!(`isError`in e&&e.isError))return null;if(`contents`in e&&Array.isArray(e.contents)){let t=e.contents.filter(e=>`text`in e).map(e=>e.text).filter(Boolean);if(t.length>0)return t.join(`
|
|
825
|
-
`)}return`An error occurred`}function UFe({result:e,isLoading:t,previewMode:n,serverId:r,readResource:i,onTogglePreview:a,onCopy:o,onDownload:s,onFullscreen:c,isCopied:l=!1,selectedResource:u,llmConfig:d}){let f=(0,w.useMemo)(()=>({}),[]),[p,m]=(0,w.useState)(null),h=(0,w.useCallback)(e=>{m(e)},[]),[g,_]=(0,w.useState)(`inline`),v=[],y;if(e?.resourceAnnotations&&(v=Object.keys(e.resourceAnnotations).filter(e=>e.startsWith(`openai/`)),y=e.resourceAnnotations[`openai/outputTemplate`]),e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents[0]?._meta){let t=e.result.contents[0]._meta,n=Object.keys(t).filter(e=>e.startsWith(`openai/`));n.length>0&&(v=[...v,...n]),!y&&t[`openai/outputTemplate`]&&(y=t[`openai/outputTemplate`]),!y&&e.uri&&e.uri.startsWith(`ui://widget/`)&&(y=e.uri)}let b=!!(v.length>0&&y&&typeof y==`string`&&r&&i),x=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents[0]?._meta||{},C={...e?.resourceAnnotations,...x},T=(0,w.useMemo)(()=>{let e=C?.[`mcp-use/propsSchema`];if(!e)return[];let t=e.def?.shape;return t?Object.entries(t).filter(([,e])=>{let t=e?.def?.type??e?.type;return t!==`optional`&&t!==`default`}).map(([e])=>e):e.required??[]},[C]),E=SQ(C,e?.result),D=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents.some(e=>e.mimeType===`text/html;profile=mcp-app`),O=C?.ui?.resourceUri||x?.ui?.resourceUri||(D?e.uri:void 0),k=(E===`mcp-apps`||D)&&!!O,A=T.length>0&&!p;if(t)return(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})});if(!e)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a resource to view its contents`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Choose a resource from the list to see its data`})]});let j=e.error||(e.result?HFe(e.result):null);if(j)return(0,S.jsx)(`div`,{className:`p-4`,children:(0,S.jsxs)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:j})]})});let M=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents.some(e=>e.mimeType&&F9(e)),N=M&&e.result&&`contents`in e.result&&Array.isArray(e.result.contents)?e.result.contents.filter(e=>e.mimeType&&F9(e)):[];return(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Df,{className:`h-3 w-3 text-gray-400`}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{let t=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return t===void 0?null:(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Ip,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[t,`ms`]})]})})(),M&&(0,S.jsx)(kt,{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`}),k&&(0,S.jsx)(kt,{variant:`outline`,className:`text-xs bg-green-50 dark:bg-green-900/20 border-none border-green-200 dark:border-green-800/50 text-green-600 dark:text-green-400`,children:`MCP Apps`}),b&&(0,S.jsx)(kt,{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`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(k||M||b)&&(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:a,className:n?``:`text-purple-600 dark:text-purple-400`,children:[n?(0,S.jsx)(Of,{className:`h-4 w-4 mr-1`}):(0,S.jsx)(gf,{className:`h-4 w-4 mr-1`}),n?`JSON`:b?`Component`:`Preview`]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:o,children:l?(0,S.jsx)(vf,{className:`h-4 w-4`}):(0,S.jsx)(jf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,children:(0,S.jsx)(Nf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,children:(0,S.jsx)($f,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto relative`,children:k&&r&&i&&O?n?(0,S.jsxs)(`div`,{className:`flex-1 h-full relative`,"data-testid":`resource-widget-preview`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-2`,children:(0,S.jsx)(U7,{toolCallId:`resource-${e.timestamp}`,displayMode:g,onDisplayModeChange:_,propsContext:`resource`,resourceUri:e.uri,resourceAnnotations:C,llmConfig:d||null,resource:u||null,onPropsChange:h,requiredProps:T.length>0&&!p?T:void 0})}),A?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-full min-h-[200px] rounded-xl border-2 border-dashed border-gray-300 dark:border-zinc-600 bg-gray-50 dark:bg-zinc-800/50 m-4`,children:(0,S.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center px-6`,children:`This widget requires props, set or generate them in the props debugger`})}):(0,S.jsx)(N7,{serverId:r,toolCallId:`resource-${e.timestamp}`,toolName:e.uri,toolInput:f,toolOutput:e.result,toolMetadata:C,resourceUri:O,readResource:i,className:`w-full h-full relative flex p-4`,customProps:p||void 0,displayMode:g,onDisplayModeChange:_})]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-mcp-apps-${Date.now()}.json`})}):b&&r&&i&&y?n?(0,S.jsx)(`div`,{className:`flex-1 h-full relative`,children:A?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-full min-h-[200px] rounded-xl border-2 border-dashed border-gray-300 dark:border-zinc-600 bg-gray-50 dark:bg-zinc-800/50 m-4`,children:(0,S.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center px-6`,children:`This widget requires props, set or generate them in the props debugger`})}):(0,S.jsx)(W7,{componentUrl:y,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:r,readResource:i,className:`w-full h-full relative flex p-4`,customProps:p||void 0})}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})}):M?n?(0,S.jsxs)(`div`,{className:`space-y-0 h-full`,children:[N.map((e,t)=>(0,S.jsx)(`div`,{className:`mx-0 size-full`,children:(0,S.jsx)(`div`,{className:`w-full h-full`,children:(0,S.jsx)(VFe,{resource:e,className:`w-full h-full`,customProps:p||void 0})})},`mcp-ui-${e.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result&&`contents`in e.result&&Array.isArray(e.result.contents)){let t=e.result.contents.filter(e=>!(e.mimeType&&F9(e)));if(t.length>0)return(0,S.jsx)(`div`,{className:`px-4`,children:(0,S.jsx)(RV,{data:t,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-non-ui-${Date.now()}.json`})})}return null})()]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-mcp-ui-${Date.now()}.json`})}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})})})]})}function WFe(e,t){if(!e&&!t)return(0,S.jsx)(Vf,{className:`h-5 w-5`});let n=(e||t||``).toLowerCase();return n.includes(`image`)?(0,S.jsx)(zf,{className:`h-5 w-5`}):n.includes(`json`)||n.includes(`javascript`)||n.includes(`typescript`)?(0,S.jsx)(Rf,{className:`h-5 w-5`}):n.includes(`html`)||n.includes(`xml`)?(0,S.jsx)(Uf,{className:`h-5 w-5`}):n.includes(`database`)||n.includes(`sql`)?(0,S.jsx)(Mf,{className:`h-5 w-5`}):(0,S.jsx)(Bf,{className:`h-5 w-5`})}function GFe({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:r}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Mf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No resources available`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,i)=>{let a=WFe(e.mimeType,e.uri),o=[e.description,e.mimeType&&(0,S.jsx)(`span`,{className:`font-mono`,children:e.mimeType},`mime`)].filter(Boolean);return(0,S.jsx)(M9,{id:`resource-${e.uri}`,"data-testid":`resource-item-${e.name}`,isSelected:t?.uri===e.uri,isFocused:r===i,icon:a,title:e.name,description:o.length>0?(0,S.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[e.description&&(0,S.jsx)(`span`,{children:e.description}),e.mimeType&&(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-500 font-mono`,children:e.mimeType})]}):void 0,onClick:()=>n(e)},e.uri)})})}function KFe({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:r,onSearchChange:i,onSearchBlur:a,searchInputRef:o,onRefresh:s,isRefreshing:c=!1}){return(0,S.jsx)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:e?(0,S.jsx)(TN,{ref:o,placeholder:`Search resources...`,value:t,onChange:e=>i(e.target.value),onBlur:a,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Resources`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:r,className:`h-8 w-8 p-0`,children:(0,S.jsx)(hp,{className:`h-4 w-4`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(j9,{children:`F`})]})]}),s&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:c,className:`h-8 w-8 p-0`,children:(0,S.jsx)(dp,{className:`h-4 w-4 ${c?`animate-spin`:``}`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Refresh list`,(0,S.jsx)(j9,{children:`R`})]})]})]})})})}function qFe({ref:e,resources:t,readResource:n,serverId:r,isConnected:i,mcpServerUrl:a,refreshResources:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),{selectedResourceUri:d,setSelectedResourceUri:f}=Uq(),{llmConfig:p}=K7({mcpServerUrl:a}),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b]=(0,w.useState)(`resources`),[x,C]=(0,w.useState)(!0),[T,E]=(0,w.useState)(!1),[D,O]=(0,w.useState)(-1),[k,A]=(0,w.useState)(!1),j=(0,w.useRef)(null),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(`list`);(0,w.useEffect)(()=>{let e=()=>{P(window.innerWidth<1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,w.useEffect)(()=>{I(l?`detail`:`list`)},[l]),(0,w.useImperativeHandle)(e,()=>({focusSearch:()=>{E(!0),setTimeout(()=>{j.current&&j.current.focus()},0)},blurSearch:()=>{y(``),E(!1),j.current&&j.current.blur()}})),(0,w.useEffect)(()=>{T&&j.current&&j.current.focus()},[T]);let L=(0,w.useCallback)(()=>{v.trim()||E(!1)},[v]),ee=(0,w.useCallback)(async()=>{if(o){c(!0);try{await o()}finally{c(!1)}}},[o]),te=(0,w.useMemo)(()=>{if(!v)return t;let e=v.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.uri.toLowerCase().includes(e))},[t,v]),ne=(0,w.useCallback)(async e=>{if(u(e),i){_(!0);let t=Date.now();try{let i=await n(e.uri);ef.getInstance().capture(new Pd({resourceUri:e.uri,serverId:r,success:!0})).catch(()=>{}),h({uri:e.uri,result:i,timestamp:t,resourceAnnotations:{...e.annotations,...e._meta||{}}})}catch(n){ef.getInstance().capture(new Pd({resourceUri:e.uri,serverId:r,success:!1,error:n instanceof Error?n.message:`Unknown error`})).catch(()=>{}),h({uri:e.uri,result:{contents:[],_meta:{}},error:n instanceof Error?n.message:`Unknown error`,timestamp:t,resourceAnnotations:{...e.annotations,...e._meta||{}}})}finally{_(!1)}}},[n,r,i]);(0,w.useEffect)(()=>{O(-1)},[v,b]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=te;if(e.key===`ArrowDown`)e.preventDefault(),O(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),O(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&D>=0){e.preventDefault();let t=te[D];t&&ne(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[D,te,ne]),(0,w.useEffect)(()=>{if(D>=0){let e=`resource-${te[D]?.uri}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[D,te]),(0,w.useEffect)(()=>{if(d&&t.length>0){let e=t.find(e=>e.uri===d);e&&l?.uri!==e.uri&&(f(null),setTimeout(()=>{ne(e);let t=document.getElementById(`resource-${e.uri}`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[d,t,l,ne,f]),(0,w.useEffect)(()=>{if(l){let e=t.find(e=>e.uri===l.uri);e&&e!==l&&(e.description!==l.description||e.mimeType!==l.mimeType||e.name!==l.name)&&u(e)}},[t,l]);let re=(0,w.useCallback)(async()=>{if(m)try{await dj(JSON.stringify(m.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(e){console.error(`[ResourcesTab] Failed to copy result:`,e)}},[m]),R=(0,w.useCallback)(()=>{if(m)try{let e=new globalThis.Blob([JSON.stringify(m.result,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`resource-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[ResourcesTab] Failed to download result:`,e)}},[m]),z=(0,w.useCallback)(async()=>{if(M.current)try{document.fullscreenElement?await document.exitFullscreen():await M.current.requestFullscreen()}catch(e){console.error(`[ResourcesTab] Failed to toggle fullscreen:`,e)}},[]);return N?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[F!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{u(null),I(`list`)},className:`p-0 h-8 w-8`,children:(0,S.jsx)(bf,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),I(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Resources`}),F===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Content`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(JK,{initial:!1,mode:`popLayout`,children:[F===`list`&&(0,S.jsxs)(Lq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(KFe,{activeTab:b,isSearchExpanded:T,searchQuery:v,filteredResourcesCount:te.length,onSearchExpand:()=>E(!0),onSearchChange:y,onSearchBlur:L,onTabSwitch:()=>{},searchInputRef:j,onRefresh:o?ee:void 0,isRefreshing:s}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(GFe,{resources:te,selectedResource:l,onResourceSelect:ne,focusedIndex:D})})]},`list`),F===`detail`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-white dark:bg-zinc-900 z-10`,children:(0,S.jsx)(`div`,{ref:M,className:`h-full`,children:(0,S.jsx)(UFe,{result:m,isLoading:g,previewMode:x,serverId:r,readResource:n,onTogglePreview:()=>C(!x),onCopy:re,onDownload:R,onFullscreen:z,isCopied:k,selectedResource:l,llmConfig:p})})},`detail`)]})})]}):(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{defaultSize:`33%`,children:(0,S.jsxs)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(k9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(KFe,{activeTab:b,isSearchExpanded:T,searchQuery:v,filteredResourcesCount:te.length,onSearchExpand:()=>E(!0),onSearchChange:y,onSearchBlur:L,onTabSwitch:()=>{},searchInputRef:j,onRefresh:o?ee:void 0,isRefreshing:s}),(0,S.jsx)(GFe,{resources:te,selectedResource:l,onResourceSelect:ne,focusedIndex:D})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(P9,{serverId:r})]})}),(0,S.jsx)(A9,{}),(0,S.jsx)(k9,{defaultSize:`67%`,children:(0,S.jsx)(`div`,{ref:M,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(UFe,{result:m,isLoading:g,previewMode:x,serverId:r,readResource:n,onTogglePreview:()=>C(!x),onCopy:re,onDownload:R,onFullscreen:z,isCopied:k,selectedResource:l,llmConfig:p})})})]})}qFe.displayName=`ResourcesTab`;function JFe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onRejectAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(TN,{ref:c,placeholder:`Search requests...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Sampling`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(hp,{className:`h-4 w-4`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(j9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{side:`bottom`,children:`Reject all`})]})})]})}function YFe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(iu,{vertical:!0,noBorder:!0,message:`No sampling requests`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e.request.params?.messages?.length||0,s=e.request.params?.maxTokens;return(0,S.jsx)(M9,{id:`sampling-request-${e.id}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.serverName,(0,S.jsx)(`span`,{className:`size-1.5 block rounded-full bg-orange-500`})]}),description:(()=>{let t=i(e.timestamp),n=[];return o>0&&n.push(`${o} message${o>1?`s`:``}`),s&&n.push(`max ${s} tokens`),t+(n.length>0?` | ${n.join(`, `)}`:``)})(),onClick:()=>n(e)},e.id)})})}function XFe({llmConfig:e}){return{generateResponse:(0,w.useCallback)(async({request:t})=>{if(!e)throw Error(`LLM config is not available`);let n=t.params||{},r=n.maxTokens,i=n.temperature,a=n.messages||[];if(a.length===0)throw Error(`No messages found in sampling request`);let o=[];for(let e of a){if(!e||!e.role)continue;let t=Array.isArray(e.content)?e.content[0]:e.content;t&&t.type===`text`&&t.text&&(e.role===`user`||e.role===`assistant`)&&o.push({role:e.role,content:t.text})}if(o.length===0)throw Error(`No valid messages could be converted. Please ensure messages have 'text' content type.`);let{text:s}=await B7({config:{provider:e.provider,model:e.model,apiKey:e.apiKey,temperature:i??e.temperature,maxTokens:r,baseUrl:e.baseUrl},messages:o});return{role:`assistant`,content:{type:`text`,text:s},model:e.model,stopReason:`endTurn`}},[e]),isAvailable:e!==null}}function ZFe({request:t,onApprove:n,onReject:r,onClose:i,previewMode:a,onTogglePreview:o,isCopied:s,onCopy:c,onDownload:l,onFullscreen:u,llmConfig:d}){let[f,p]=(0,w.useState)(`manual`),[h,g]=(0,w.useState)(`stub-model`),[_,v]=(0,w.useState)(`endTurn`),[y,b]=(0,w.useState)(`assistant`),[x,C]=(0,w.useState)(`text`),[T,E]=(0,w.useState)(`positive`),[D,O]=(0,w.useState)(``),[k,A]=(0,w.useState)(`image/png`),[j,M]=(0,w.useState)(!1),[N,P]=(0,w.useState)(null),{generateResponse:F,isAvailable:I}=XFe({llmConfig:d});(0,w.useEffect)(()=>{t&&(g(f===`llm`&&d?.model?d.model:`stub-model`),v(`endTurn`),b(`assistant`),C(`text`),E(`positive`),O(``),A(`image/png`),P(null))},[t?.id]),(0,w.useEffect)(()=>{f===`llm`&&d?.model&&g(d.model)},[f,d?.model]);let L=async()=>{if(!t||!I){console.log(`[SamplingRequestDisplay] Cannot generate:`,{hasRequest:!!t,isAvailable:I});return}console.log(`[SamplingRequestDisplay] Starting LLM generation:`,{requestId:t.id,llmConfig:d}),M(!0),P(null);try{let e=await F({request:t.request});console.log(`[SamplingRequestDisplay] LLM generation result:`,{result:e,model:e.model,stopReason:e.stopReason,role:e.role,contentIsArray:Array.isArray(e.content),content:e.content}),g(e.model||d?.model||`stub-model`),v(e.stopReason||`endTurn`),b(e.role||`assistant`);let n=Array.isArray(e.content)?e.content[0]:e.content;console.log(`[SamplingRequestDisplay] Setting content:`,{contentType:n.type,hasText:`text`in n,text:`text`in n?n.text:void 0}),n.type===`text`?(C(`text`),E(n.text||``),console.log(`[SamplingRequestDisplay] Set text content:`,n.text)):n.type===`image`&&(C(`image`),O(n.data||``),A(n.mimeType||`image/png`),console.log(`[SamplingRequestDisplay] Set image content`)),console.log(`[SamplingRequestDisplay] Form state after update:`,{model:h,stopReason:_,role:y,contentType:x,textContent:T})}catch(e){console.error(`[SamplingRequestDisplay] LLM generation error:`,e);let t=e instanceof Error?e.message:`Failed to generate response`;P(t),PM.error(`LLM Generation Failed`,{description:t})}finally{M(!1),console.log(`[SamplingRequestDisplay] Generation complete`)}},ee=(0,w.useMemo)(()=>{let e={model:h,stopReason:_,role:y,content:{type:x}};return x===`text`?e.content.text=T:x===`image`&&(e.content.data=D,e.content.mimeType=k),e},[h,_,y,x,T,D,k]);return t?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b dark:border-zinc-700`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100`,children:t.serverName}),(0,S.jsx)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:new Date(t.timestamp).toLocaleString()})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,className:`h-8 w-8 p-0`,children:s?(0,S.jsx)(vf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(jf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Copy request`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:l,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Nf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Download request`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Qf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Fullscreen`})]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Fp,{className:`h-4 w-4`})})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Request`}),(0,S.jsx)(`div`,{className:`bg-muted rounded-lg p-3 max-h-64 overflow-auto`,children:(0,S.jsx)(RV,{data:t.request})})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Response`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(ON,{htmlFor:`responseMode-${t.id}`,className:`text-xs text-gray-500 dark:text-gray-400`,children:`Mode:`}),(0,S.jsxs)(bP,{value:f,onValueChange:e=>p(e),children:[(0,S.jsx)(SP,{id:`responseMode-${t.id}`,className:`w-32 h-8 text-xs`,"data-testid":`sampling-response-mode-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`manual`,"data-testid":`sampling-response-mode-manual`,children:`Manual`}),(0,S.jsx)(wP,{value:`llm`,"data-testid":`sampling-response-mode-llm`,children:`LLM`})]})]})]})]}),f===`llm`&&(0,S.jsxs)(`div`,{className:`space-y-2 p-3 bg-muted rounded-lg`,children:[I?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(U,{onClick:L,disabled:j,size:`sm`,className:`flex items-center gap-2`,"data-testid":`sampling-generate-llm-button`,children:j?(0,S.jsxs)(`span`,{"data-testid":`sampling-generating`,className:`flex items-center gap-2`,children:[(0,S.jsx)(Zf,{className:`h-4 w-4 animate-spin`}),`Generating...`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Cp,{className:`h-4 w-4`}),`Generate with LLM`]})}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[`Using `,d?.provider,` (`,d?.model,`)`]})]}):(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`LLM not configured. Please configure LLM in the Chat tab.`}),N&&(0,S.jsx)(`div`,{className:`text-xs text-red-600 dark:text-red-400`,"data-testid":`sampling-generation-error`,children:N})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`model-${t.id}`,children:`Model`}),(0,S.jsx)(TN,{id:`model-${t.id}`,value:h,onChange:e=>g(e.target.value),placeholder:`stub-model`,disabled:f===`llm`&&j,"data-testid":`sampling-model-input`})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`stopReason-${t.id}`,children:`Stop Reason`}),(0,S.jsx)(TN,{id:`stopReason-${t.id}`,value:_,onChange:e=>v(e.target.value),placeholder:`endTurn`,disabled:f===`llm`&&j,"data-testid":`sampling-stop-reason-input`})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`role-${t.id}`,children:`Role`}),(0,S.jsxs)(bP,{value:y,onValueChange:e=>b(e),disabled:f===`llm`&&j,children:[(0,S.jsx)(SP,{id:`role-${t.id}`,"data-testid":`sampling-role-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`assistant`,children:`assistant`}),(0,S.jsx)(wP,{value:`user`,children:`user`})]})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`contentType-${t.id}`,children:`Content Type`}),(0,S.jsxs)(bP,{value:x,onValueChange:e=>C(e),disabled:f===`llm`&&j,children:[(0,S.jsx)(SP,{id:`contentType-${t.id}`,"data-testid":`sampling-content-type-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`text`,children:`text`}),(0,S.jsx)(wP,{value:`image`,children:`image`})]})]})]}),x===`text`&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`text-${t.id}`,children:`Text Content`}),(0,S.jsx)(fY,{id:`text-${t.id}`,value:T,onChange:e=>E(e.target.value),placeholder:`Enter response text...`,rows:6,disabled:f===`llm`&&j,"data-testid":`sampling-text-content`})]}),x===`image`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`imageData-${t.id}`,children:`Base64 Image Data`}),(0,S.jsx)(fY,{id:`imageData-${t.id}`,value:D,onChange:e=>O(e.target.value),placeholder:`Base64 encoded image data...`,rows:4,disabled:f===`llm`&&j})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`mimeType-${t.id}`,children:`MIME Type`}),(0,S.jsx)(TN,{id:`mimeType-${t.id}`,value:k,onChange:e=>A(e.target.value),placeholder:`image/png`,disabled:f===`llm`&&j})]})]})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2 p-4 border-t dark:border-zinc-700`,children:[(0,S.jsx)(U,{onClick:()=>{if(!t)return;let r=a_.safeParse(ee);if(!r.success){PM.error(`Invalid response`,{description:`Validation failed: ${r.error.message}`});return}n(t.id,r.data),i(),J(()=>Promise.resolve().then(()=>e(m(),1)).then(e=>{let n=PM(e.createElement(`div`,{className:`space-y-3`},e.createElement(`div`,null,e.createElement(`strong`,null,`Sampling Response Sent`),e.createElement(`p`,{className:`text-sm text-muted-foreground mt-1`},`The tool will continue executing.`)),e.createElement(`div`,{className:`flex gap-2`},e.createElement(`button`,{"data-testid":`sampling-view-tool-result`,className:`px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,onClick:()=>{let e=new globalThis.CustomEvent(`navigate-to-tool-result`,{detail:{toolName:t.toolName}});window.dispatchEvent(e),PM.dismiss(n)}},`View Tool Result`))),{duration:5e3})}),void 0)},className:`flex-1`,disabled:f===`llm`&&j,"data-testid":`sampling-approve-button`,children:`Approve`}),(0,S.jsx)(U,{onClick:()=>{t&&(r(t.id,`User rejected sampling request`),i())},variant:`outline`,className:`flex-1`,disabled:f===`llm`&&j,"data-testid":`sampling-reject-button`,children:`Reject`})]})]}):(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select a sampling request to view details`})})}function QFe({pendingRequests:e,onApprove:t,onReject:n,serverId:r,isConnected:i,mcpServerUrl:a}){let{selectedSamplingRequestId:o,setSelectedSamplingRequestId:s}=Uq(),{llmConfig:c}=K7({mcpServerUrl:a}),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(-1),[h,g]=(0,w.useState)(!0),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)(!0),[x,C]=(0,w.useState)(!1),T=(0,w.useRef)(null),E=(0,w.useRef)(null),D=(0,w.useRef)(null),O=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(console.log(`[SamplingTab] Auto-selection check:`,{selectedSamplingRequestId:o,pendingRequestsCount:e.length,currentSelectedId:l?.id}),o&&e.length>0){let t=e.find(e=>e.id===o);console.log(`[SamplingTab] Found request for auto-selection:`,!!t,t?.id),t&&(console.log(`[SamplingTab] Auto-selecting request:`,t.id),s(null),u(t),setTimeout(()=>{let e=document.getElementById(`sampling-request-${t.id}`);console.log(`[SamplingTab] Scrolling to element:`,!!e),e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[o,e,s]),(0,w.useEffect)(()=>{let t=t=>{let n=t.detail.requestId;console.log(`[SamplingTab] Custom navigate event received:`,n);let r=e.find(e=>e.id===n);r&&(console.log(`[SamplingTab] Selecting request from event:`,n),u(r),setTimeout(()=>{let e=document.getElementById(`sampling-request-${n}`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},200))};return window.addEventListener(`navigate-to-sampling`,t),()=>window.removeEventListener(`navigate-to-sampling`,t)},[e]),(0,w.useEffect)(()=>{h&&e.length>0&&T.current&&!O.current&&(T.current.scrollTop=0)},[e.length,h]),(0,w.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{e.scrollTop>0&&(O.current=!0,g(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(O.current=!1,g(!0))},[e.length]),(0,w.useEffect)(()=>{_&&D.current&&D.current.focus()},[_]);let k=(0,w.useCallback)(()=>{d.trim()||v(!1)},[d]),A=(0,w.useMemo)(()=>{if(!d.trim())return e;let t=d.toLowerCase();return e.filter(e=>e.serverName.toLowerCase().includes(t)||JSON.stringify(e.request||{}).toLowerCase().includes(t))},[e,d]);(0,w.useEffect)(()=>{m(-1)},[d]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=A;if(e.key===`ArrowDown`)e.preventDefault(),m(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),m(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&p>=0){e.preventDefault();let t=A[p];t&&j(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[p,A]),(0,w.useEffect)(()=>{if(p>=0){let e=`sampling-request-${A[p]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[p,A]);let j=(0,w.useCallback)(e=>{u(e)},[]),M=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to reject all sampling requests? This cannot be undone.`)&&(e.forEach(e=>{n(e.id,`User rejected all requests`)}),u(null))},[e,n]),N=(0,w.useCallback)(async()=>{if(l)try{await dj(JSON.stringify({id:l.id,serverName:l.serverName,timestamp:l.timestamp,request:l.request},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error(`[SamplingTab] Failed to copy request:`,e)}},[l]),P=(0,w.useCallback)(()=>{if(l)try{let e=new globalThis.Blob([JSON.stringify({id:l.id,serverName:l.serverName,timestamp:l.timestamp,request:l.request},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[SamplingTab] Failed to download request:`,e)}},[l]),F=(0,w.useCallback)(async()=>{if(E.current)try{document.fullscreenElement?await document.exitFullscreen():await E.current.requestFullscreen()}catch(e){console.error(`[SamplingTab] Failed to toggle fullscreen:`,e)}},[]);return i?(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{defaultSize:40,minSize:30,children:(0,S.jsx)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(k9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(JFe,{isSearchExpanded:_,searchQuery:d,filteredRequestsCount:A.length,requestsCount:e.length,onSearchExpand:()=>v(!0),onSearchChange:f,onSearchBlur:k,onRejectAll:M,searchInputRef:D}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(YFe,{requests:A,selectedRequest:l,onRequestSelect:j,focusedIndex:p,formatRelativeTime:N9,listRef:T})})]})})}),(0,S.jsx)(A9,{}),(0,S.jsx)(k9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:E,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(ZFe,{request:l,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:y,onTogglePreview:()=>b(!y),isCopied:x,onCopy:N,onDownload:P,onFullscreen:F,llmConfig:c})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Gf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function $Fe({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:r,focusedIndex:i}){if(e.length===0)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Mf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`No saved requests yet`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Execute a tool and click Save to store requests`})]});let a=(e,t)=>{e.stopPropagation(),t()};return(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,o)=>(0,S.jsxs)(`div`,{className:`relative group`,children:[(0,S.jsx)(M9,{id:`saved-${e.id}`,isSelected:t?.id===e.id,isFocused:i===o,icon:(0,S.jsx)(Kf,{className:`h-4 w-4`}),title:e.name,description:e.toolName,metadata:(0,S.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,S.jsx)(`span`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:new Date(e.savedAt).toLocaleString()})}),onClick:()=>n(e)}),(0,S.jsx)(`div`,{className:`absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10`,children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`secondary`,size:`sm`,onClick:t=>a(t,()=>r(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Delete saved request`})})]})})]},e.id))})}function eIe({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:r,onSave:i,onCancel:a}){return e?(0,S.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:a,children:(0,S.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:e=>e.stopPropagation(),children:[(0,S.jsx)(`h3`,{className:`text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100`,children:`Save Request`}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(ON,{htmlFor:`request-name`,children:`Request Name (optional)`}),(0,S.jsx)(TN,{id:`request-name`,value:t,onChange:e=>r(e.target.value),placeholder:n,className:`mt-2`,onKeyDown:e=>{e.key===`Enter`&&i()},autoFocus:!0})]}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,S.jsx)(U,{variant:`outline`,onClick:a,children:`Cancel`}),(0,S.jsxs)(U,{onClick:i,children:[(0,S.jsx)(mp,{className:`h-4 w-4 mr-2`}),`Save`]})]})]})]})}):null}function I9(e,t){if(!e?.$ref)return e;let n=e.$ref;if(!n.startsWith(`#/`))return e;let r=n.substring(2).split(`/`),i=t;for(let t of r)if(i&&typeof i==`object`&&t in i)i=i[t];else return e;return i}function tIe(e,t){if(e?.anyOf&&Array.isArray(e.anyOf)){let n=e.anyOf.find(e=>I9(e,t)?.type!==`null`);if(n)return{...I9(n,t),nullable:!0}}return e}function nIe(e,t){let n=tIe(e||{},t);return n=I9(n,t),n}function L9(e,t){let n=nIe(e,t);if(typeof n.type==`string`)return n.type;if(Array.isArray(n.type)){let e=n.type.find(e=>e!==`null`);return typeof e==`string`?e:void 0}}function rIe(e){let t=e?.enum;return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:null}function iIe(e){let t=e.trim().toLowerCase();return[`true`,`1`,`yes`,`on`].includes(t)?!0:[`false`,`0`,`no`,`off`].includes(t)?!1:e}function aIe(e,t){if(t===`number`||t===`integer`){let t=e.trim();if(!t)return e;let n=Number(t);return Number.isFinite(n)?n:e}return t===`boolean`?iIe(e):e}function oIe(e,t){if(e===void 0)return e;if(t===`object`||t===`array`){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}if(t===`number`||t===`integer`){if(typeof e==`number`)return e;if(typeof e==`string`){let t=e.trim();if(!t)return e;let n=Number(t);return Number.isFinite(n)?n:e}return e}return t===`boolean`?typeof e==`boolean`?e:typeof e==`string`?iIe(e):e:e}function sIe(e){let t=``,n=0,r=!1,i=!1;for(;n<e.length;){let a=e[n];if(i){t+=a,i=!1,n++;continue}if(a===`\\`){i=!0,t+=a,n++;continue}if(a==="`"){r?(t+=`"`,r=!1):(t+=`"`,r=!0),n++;continue}if(r&&a===`"`){t+=`\\"`,n++;continue}t+=a,n++}return t}function cIe(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return e}catch{try{let e=sIe(t),n=JSON.parse(e);if(n&&typeof n==`object`&&!Array.isArray(n))return n}catch{return null}}return null}function lIe({selectedTool:e,toolArgs:t,onArgChange:n,onBulkPaste:r,autoFilledFields:i,setFields:a,sendEmptyFields:o,onToggleEmpty:s}){let c=e?.inputSchema?.properties||{},l=e?.inputSchema?.required||[],u=Object.keys(c).length>0,d=async(e,t)=>{r&&await r(e.clipboardData.getData(`text`),t)&&e.preventDefault()};return u?(0,S.jsx)(`div`,{className:`space-y-4`,children:Object.entries(c).map(([r,c])=>{let u=nIe(c,e?.inputSchema||{}),f=rIe(u),p=u.type===`string`&&f!==null,m=u,h=l.includes(r),g=t[r],_=``;g!=null&&(_=typeof g==`string`?g:typeof g==`object`&&g?JSON.stringify(g,null,2):String(g));let v=m.type===`object`||m.type===`array`,y=v?m.type===`array`?`array`:`object`:`string`,b=a?.has(r)??!0,x=s&&(m.type===`string`||v);return v?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),x&&s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:y===`array`?`Send empty array explicitly`:`Send empty object explicitly`}),(0,S.jsx)(MP,{checked:o?.has(r)??!1,onCheckedChange:e=>s(r,y,e),"aria-label":y===`array`?`Send empty array`:`Send empty object`,title:y===`array`?`Send empty array []`:`Send empty object {}`})]})]}),(0,S.jsx)(fY,{id:r,"data-testid":`tool-param-${r}`,value:_,onChange:e=>n(r,e.target.value),onPaste:e=>d(e,r),placeholder:m?.description||`Enter ${r}`,disabled:o?.has(r)??!1,className:`min-h-[100px] ${b?``:`opacity-70`} ${i?.has(r)?`animate-pulse ring-2 ring-green-500 dark:ring-green-400`:``}`}),m?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r):p&&f?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsxs)(bP,{value:String(t[r]||``),onValueChange:e=>n(r,e),children:[(0,S.jsx)(SP,{id:r,className:`w-full ${b?``:`opacity-70`}`,"data-testid":`tool-param-${r}`,children:(0,S.jsx)(xP,{placeholder:m.description||`Select an option`})}),(0,S.jsx)(CP,{children:f.map((e,t)=>(0,S.jsx)(wP,{value:e,children:m.enumNames?.[t]||e},e))})]}),m.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r):(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),x&&s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`Send empty string`}),(0,S.jsx)(MP,{checked:o?.has(r)??!1,onCheckedChange:e=>s(r,`string`,e),"aria-label":`Send empty string`,title:`Send empty string`})]})]}),(0,S.jsx)(TN,{id:r,"data-testid":`tool-param-${r}`,value:_,onChange:e=>n(r,e.target.value),onPaste:e=>d(e,r),placeholder:m?.description||`Enter ${r}`,disabled:o?.has(r)??!1,className:`${b?``:`opacity-70`} ${i?.has(r)?`animate-pulse ring-2 ring-green-500 dark:ring-green-400`:``}`}),m?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r)})}):(0,S.jsx)(`div`,{className:`flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm`,children:`No parameters required`})}function uIe({selectedTool:e,toolArgs:t,payloadToSend:n,isExecuting:r,isConnected:i,onArgChange:a,onExecute:o,onSave:s,onCancel:c,onBulkPaste:l,autoFilledFields:u,setFields:d,sendEmptyFields:f,onToggleEmpty:p}){let[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(!1),O=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(O.current&&e?.description){let e=O.current,t=parseFloat(getComputedStyle(e).lineHeight),n=e.scrollHeight;D(Math.round(n/t)>3),T(!1)}},[e?.description]),(0,w.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&e&&!r&&i&&(t.preventDefault(),o()),t.key===`Escape`&&r&&c&&(t.preventDefault(),c())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,r,i,o,c]),e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4`,children:(0,S.jsx)(`div`,{children:(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-0 gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-base sm:text-lg font-semibold`,"data-testid":`tool-execution-title`,children:e.name}),(0,S.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`tool-execution-metadata-button`,variant:g?`default`:`outline`,onClick:()=>_(!g),disabled:r,size:`sm`,className:`lg:size-default gap-2`,title:`View tool metadata`,children:[(0,S.jsx)(Of,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Metadata`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`View tool definition metadata`})})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`tool-execution-copy-payload-button`,variant:`outline`,onClick:async()=>{if(e)try{await dj(JSON.stringify(n??t,null,2)),x(!0),setTimeout(()=>x(!1),2e3)}catch{}},disabled:r,size:`sm`,className:`lg:size-default gap-2`,title:`Copy payload as JSON`,children:[b?(0,S.jsx)(vf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(jf,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:b?`Copied!`:`Payload`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Copy payload as JSON`})})]}),(0,S.jsxs)(U,{"data-testid":`tool-execution-save-button`,variant:`outline`,onClick:s,disabled:r,size:`sm`,className:`lg:size-default gap-2`,children:[(0,S.jsx)(mp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Save`})]}),r&&c?(0,S.jsxs)(kd,{open:m?void 0:!1,children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`div`,{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:`relative`,children:(0,S.jsx)(U,{"data-testid":`tool-execution-cancel-button`,onClick:c,variant:m?`destructive`:`default`,size:`sm`,className:`lg:size-default gap-2 transition-all`,children:m?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Fp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Cancel`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border border-current p-1 rounded-full ml-2`,children:`Esc`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]})})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Hover to cancel (or press Esc)`})})]}):(0,S.jsx)(U,{"data-testid":`tool-execution-execute-button`,onClick:o,disabled:r||!i,size:`sm`,className:`lg:size-default pr-1! gap-0`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(cp,{className:`h-4 w-4 sm:mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Execute`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2`,children:`⌘↵`})]})})]})]})})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3 sm:px-5 pb-4 pr-3`,children:[e.description&&(0,S.jsxs)(`div`,{className:`relative mb-4`,children:[(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`p`,{ref:O,"data-testid":`tool-execution-description`,className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed transition-all duration-300 ${!C&&E?`line-clamp-3`:``}`,children:e.description}),E&&!C&&(0,S.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-[1.4em] bg-linear-to-t from-white/95 dark:from-black/95 via-white/55 dark:via-black/55 to-transparent pointer-events-none`})]}),E&&(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(`button`,{onClick:()=>T(!C),className:`relative z-10 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 mt-1 transition-colors`,children:C?(0,S.jsxs)(S.Fragment,{children:[`Show less`,(0,S.jsx)(Sf,{className:`h-3 w-3`})]}):(0,S.jsxs)(S.Fragment,{children:[`Show more`,(0,S.jsx)(yf,{className:`h-3 w-3`})]})})})]}),(0,S.jsx)(lIe,{selectedTool:e,toolArgs:t,onArgChange:a,onBulkPaste:l,autoFilledFields:u,setFields:d,sendEmptyFields:f,onToggleEmpty:p})]}),(0,S.jsx)(yN,{open:g,onOpenChange:_,children:(0,S.jsxs)(xN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:[(0,S.jsx)(SN,{children:(0,S.jsxs)(CN,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsx)(`span`,{children:`Tool Definition`}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e)try{await dj(JSON.stringify(e,null,2)),y(!0),setTimeout(()=>y(!1),2e3)}catch{}},className:`h-7 w-7 p-0`,title:`Copy metadata`,children:v?(0,S.jsx)(vf,{className:`h-3.5 w-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})]})}),(0,S.jsx)(RV,{data:e,filename:`tool-definition-${e.name}-${Date.now()}.json`})]})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a tool to get started`}),(0,S.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 dIe({timestamp:e}){let[t,n]=(0,w.useState)(()=>R9(e));return(0,w.useEffect)(()=>{let t=()=>n(R9(e));t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),(0,S.jsx)(`span`,{children:t})}function R9(e){let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<10?`now`:n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`}function fIe(e){if(!e?.isError)return null;let t=e.content;if(Array.isArray(t)){let e=t.filter(e=>e.type===`text`).map(e=>e.text).filter(Boolean);if(e.length>0)return e.join(`
|
|
825
|
+
`)}return`An error occurred`}function UFe({result:e,isLoading:t,previewMode:n,serverId:r,readResource:i,onTogglePreview:a,onCopy:o,onDownload:s,onFullscreen:c,isCopied:l=!1,selectedResource:u,llmConfig:d}){let f=(0,w.useMemo)(()=>({}),[]),[p,m]=(0,w.useState)(null),h=(0,w.useCallback)(e=>{m(e)},[]),[g,_]=(0,w.useState)(`inline`),v=[],y;if(e?.resourceAnnotations&&(v=Object.keys(e.resourceAnnotations).filter(e=>e.startsWith(`openai/`)),y=e.resourceAnnotations[`openai/outputTemplate`]),e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents[0]?._meta){let t=e.result.contents[0]._meta,n=Object.keys(t).filter(e=>e.startsWith(`openai/`));n.length>0&&(v=[...v,...n]),!y&&t[`openai/outputTemplate`]&&(y=t[`openai/outputTemplate`]),!y&&e.uri&&e.uri.startsWith(`ui://widget/`)&&(y=e.uri)}let b=!!(v.length>0&&y&&typeof y==`string`&&r&&i),x=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents[0]?._meta||{},C={...e?.resourceAnnotations,...x},T=(0,w.useMemo)(()=>{let e=C?.[`mcp-use/propsSchema`];if(!e)return[];let t=e.def?.shape;return t?Object.entries(t).filter(([,e])=>{let t=e?.def?.type??e?.type;return t!==`optional`&&t!==`default`}).map(([e])=>e):e.required??[]},[C]),E=CQ(C,e?.result),D=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents.some(e=>e.mimeType===`text/html;profile=mcp-app`),O=C?.ui?.resourceUri||x?.ui?.resourceUri||(D?e.uri:void 0),k=(E===`mcp-apps`||D)&&!!O,A=T.length>0&&!p;if(t)return(0,S.jsx)(`div`,{className:`flex absolute left-0 top-0 items-center justify-center w-full h-full`,children:(0,S.jsx)(zq,{className:`size-5`})});if(!e)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a resource to view its contents`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Choose a resource from the list to see its data`})]});let j=e.error||(e.result?HFe(e.result):null);if(j)return(0,S.jsx)(`div`,{className:`p-4`,children:(0,S.jsxs)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:j})]})});let M=e?.result&&`contents`in e.result&&Array.isArray(e.result.contents)&&e.result.contents.some(e=>e.mimeType&&F9(e)),N=M&&e.result&&`contents`in e.result&&Array.isArray(e.result.contents)?e.result.contents.filter(e=>e.mimeType&&F9(e)):[];return(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Df,{className:`h-3 w-3 text-gray-400`}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{let t=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return t===void 0?null:(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Ip,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[t,`ms`]})]})})(),M&&(0,S.jsx)(kt,{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`}),k&&(0,S.jsx)(kt,{variant:`outline`,className:`text-xs bg-green-50 dark:bg-green-900/20 border-none border-green-200 dark:border-green-800/50 text-green-600 dark:text-green-400`,children:`MCP Apps`}),b&&(0,S.jsx)(kt,{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`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(k||M||b)&&(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:a,className:n?``:`text-purple-600 dark:text-purple-400`,children:[n?(0,S.jsx)(Of,{className:`h-4 w-4 mr-1`}):(0,S.jsx)(gf,{className:`h-4 w-4 mr-1`}),n?`JSON`:b?`Component`:`Preview`]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:o,children:l?(0,S.jsx)(vf,{className:`h-4 w-4`}):(0,S.jsx)(jf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,children:(0,S.jsx)(Nf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,children:(0,S.jsx)($f,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto relative`,children:k&&r&&i&&O?n?(0,S.jsxs)(`div`,{className:`flex-1 h-full relative`,"data-testid":`resource-widget-preview`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-2`,children:(0,S.jsx)(U7,{toolCallId:`resource-${e.timestamp}`,displayMode:g,onDisplayModeChange:_,propsContext:`resource`,resourceUri:e.uri,resourceAnnotations:C,llmConfig:d||null,resource:u||null,onPropsChange:h,requiredProps:T.length>0&&!p?T:void 0})}),A?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-full min-h-[200px] rounded-xl border-2 border-dashed border-gray-300 dark:border-zinc-600 bg-gray-50 dark:bg-zinc-800/50 m-4`,children:(0,S.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center px-6`,children:`This widget requires props, set or generate them in the props debugger`})}):(0,S.jsx)(N7,{serverId:r,toolCallId:`resource-${e.timestamp}`,toolName:e.uri,toolInput:f,toolOutput:e.result,toolMetadata:C,resourceUri:O,readResource:i,className:`w-full h-full relative flex p-4`,customProps:p||void 0,displayMode:g,onDisplayModeChange:_})]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-mcp-apps-${Date.now()}.json`})}):b&&r&&i&&y?n?(0,S.jsx)(`div`,{className:`flex-1 h-full relative`,children:A?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-full min-h-[200px] rounded-xl border-2 border-dashed border-gray-300 dark:border-zinc-600 bg-gray-50 dark:bg-zinc-800/50 m-4`,children:(0,S.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center px-6`,children:`This widget requires props, set or generate them in the props debugger`})}):(0,S.jsx)(W7,{componentUrl:y,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:r,readResource:i,className:`w-full h-full relative flex p-4`,customProps:p||void 0})}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})}):M?n?(0,S.jsxs)(`div`,{className:`space-y-0 h-full`,children:[N.map((e,t)=>(0,S.jsx)(`div`,{className:`mx-0 size-full`,children:(0,S.jsx)(`div`,{className:`w-full h-full`,children:(0,S.jsx)(VFe,{resource:e,className:`w-full h-full`,customProps:p||void 0})})},`mcp-ui-${e.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result&&`contents`in e.result&&Array.isArray(e.result.contents)){let t=e.result.contents.filter(e=>!(e.mimeType&&F9(e)));if(t.length>0)return(0,S.jsx)(`div`,{className:`px-4`,children:(0,S.jsx)(RV,{data:t,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-non-ui-${Date.now()}.json`})})}return null})()]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-mcp-ui-${Date.now()}.json`})}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,"data-testid":`resource-result-json`,children:(0,S.jsx)(RV,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})})})]})}function WFe(e,t){if(!e&&!t)return(0,S.jsx)(Vf,{className:`h-5 w-5`});let n=(e||t||``).toLowerCase();return n.includes(`image`)?(0,S.jsx)(zf,{className:`h-5 w-5`}):n.includes(`json`)||n.includes(`javascript`)||n.includes(`typescript`)?(0,S.jsx)(Rf,{className:`h-5 w-5`}):n.includes(`html`)||n.includes(`xml`)?(0,S.jsx)(Uf,{className:`h-5 w-5`}):n.includes(`database`)||n.includes(`sql`)?(0,S.jsx)(Mf,{className:`h-5 w-5`}):(0,S.jsx)(Bf,{className:`h-5 w-5`})}function GFe({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:r}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Mf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No resources available`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,i)=>{let a=WFe(e.mimeType,e.uri),o=[e.description,e.mimeType&&(0,S.jsx)(`span`,{className:`font-mono`,children:e.mimeType},`mime`)].filter(Boolean);return(0,S.jsx)(M9,{id:`resource-${e.uri}`,"data-testid":`resource-item-${e.name}`,isSelected:t?.uri===e.uri,isFocused:r===i,icon:a,title:e.name,description:o.length>0?(0,S.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[e.description&&(0,S.jsx)(`span`,{children:e.description}),e.mimeType&&(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-500 font-mono`,children:e.mimeType})]}):void 0,onClick:()=>n(e)},e.uri)})})}function KFe({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:r,onSearchChange:i,onSearchBlur:a,searchInputRef:o,onRefresh:s,isRefreshing:c=!1}){return(0,S.jsx)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:e?(0,S.jsx)(TN,{ref:o,placeholder:`Search resources...`,value:t,onChange:e=>i(e.target.value),onBlur:a,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Resources`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:r,className:`h-8 w-8 p-0`,children:(0,S.jsx)(hp,{className:`h-4 w-4`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(j9,{children:`F`})]})]}),s&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:c,className:`h-8 w-8 p-0`,children:(0,S.jsx)(dp,{className:`h-4 w-4 ${c?`animate-spin`:``}`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Refresh list`,(0,S.jsx)(j9,{children:`R`})]})]})]})})})}function qFe({ref:e,resources:t,readResource:n,serverId:r,isConnected:i,mcpServerUrl:a,refreshResources:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),{selectedResourceUri:d,setSelectedResourceUri:f}=Uq(),{llmConfig:p}=K7({mcpServerUrl:a}),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b]=(0,w.useState)(`resources`),[x,C]=(0,w.useState)(!0),[T,E]=(0,w.useState)(!1),[D,O]=(0,w.useState)(-1),[k,A]=(0,w.useState)(!1),j=(0,w.useRef)(null),M=(0,w.useRef)(null),[N,P]=(0,w.useState)(!1),[F,I]=(0,w.useState)(`list`);(0,w.useEffect)(()=>{let e=()=>{P(window.innerWidth<1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,w.useEffect)(()=>{I(l?`detail`:`list`)},[l]),(0,w.useImperativeHandle)(e,()=>({focusSearch:()=>{E(!0),setTimeout(()=>{j.current&&j.current.focus()},0)},blurSearch:()=>{y(``),E(!1),j.current&&j.current.blur()}})),(0,w.useEffect)(()=>{T&&j.current&&j.current.focus()},[T]);let L=(0,w.useCallback)(()=>{v.trim()||E(!1)},[v]),ee=(0,w.useCallback)(async()=>{if(o){c(!0);try{await o()}finally{c(!1)}}},[o]),te=(0,w.useMemo)(()=>{if(!v)return t;let e=v.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.uri.toLowerCase().includes(e))},[t,v]),ne=(0,w.useCallback)(async e=>{if(u(e),i){_(!0);let t=Date.now();try{let i=await n(e.uri);ef.getInstance().capture(new Pd({resourceUri:e.uri,serverId:r,success:!0})).catch(()=>{}),h({uri:e.uri,result:i,timestamp:t,resourceAnnotations:{...e.annotations,...e._meta||{}}})}catch(n){ef.getInstance().capture(new Pd({resourceUri:e.uri,serverId:r,success:!1,error:n instanceof Error?n.message:`Unknown error`})).catch(()=>{}),h({uri:e.uri,result:{contents:[],_meta:{}},error:n instanceof Error?n.message:`Unknown error`,timestamp:t,resourceAnnotations:{...e.annotations,...e._meta||{}}})}finally{_(!1)}}},[n,r,i]);(0,w.useEffect)(()=>{O(-1)},[v,b]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=te;if(e.key===`ArrowDown`)e.preventDefault(),O(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),O(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&D>=0){e.preventDefault();let t=te[D];t&&ne(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[D,te,ne]),(0,w.useEffect)(()=>{if(D>=0){let e=`resource-${te[D]?.uri}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[D,te]),(0,w.useEffect)(()=>{if(d&&t.length>0){let e=t.find(e=>e.uri===d);e&&l?.uri!==e.uri&&(f(null),setTimeout(()=>{ne(e);let t=document.getElementById(`resource-${e.uri}`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[d,t,l,ne,f]),(0,w.useEffect)(()=>{if(l){let e=t.find(e=>e.uri===l.uri);e&&e!==l&&(e.description!==l.description||e.mimeType!==l.mimeType||e.name!==l.name)&&u(e)}},[t,l]);let re=(0,w.useCallback)(async()=>{if(m)try{await dj(JSON.stringify(m.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(e){console.error(`[ResourcesTab] Failed to copy result:`,e)}},[m]),R=(0,w.useCallback)(()=>{if(m)try{let e=new globalThis.Blob([JSON.stringify(m.result,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`resource-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[ResourcesTab] Failed to download result:`,e)}},[m]),z=(0,w.useCallback)(async()=>{if(M.current)try{document.fullscreenElement?await document.exitFullscreen():await M.current.requestFullscreen()}catch(e){console.error(`[ResourcesTab] Failed to toggle fullscreen:`,e)}},[]);return N?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[F!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{u(null),I(`list`)},className:`p-0 h-8 w-8`,children:(0,S.jsx)(bf,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),I(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Resources`}),F===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Content`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(JK,{initial:!1,mode:`popLayout`,children:[F===`list`&&(0,S.jsxs)(Lq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(KFe,{activeTab:b,isSearchExpanded:T,searchQuery:v,filteredResourcesCount:te.length,onSearchExpand:()=>E(!0),onSearchChange:y,onSearchBlur:L,onTabSwitch:()=>{},searchInputRef:j,onRefresh:o?ee:void 0,isRefreshing:s}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(GFe,{resources:te,selectedResource:l,onResourceSelect:ne,focusedIndex:D})})]},`list`),F===`detail`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-white dark:bg-zinc-900 z-10`,children:(0,S.jsx)(`div`,{ref:M,className:`h-full`,children:(0,S.jsx)(UFe,{result:m,isLoading:g,previewMode:x,serverId:r,readResource:n,onTogglePreview:()=>C(!x),onCopy:re,onDownload:R,onFullscreen:z,isCopied:k,selectedResource:l,llmConfig:p})})},`detail`)]})})]}):(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{defaultSize:`33%`,children:(0,S.jsxs)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(k9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(KFe,{activeTab:b,isSearchExpanded:T,searchQuery:v,filteredResourcesCount:te.length,onSearchExpand:()=>E(!0),onSearchChange:y,onSearchBlur:L,onTabSwitch:()=>{},searchInputRef:j,onRefresh:o?ee:void 0,isRefreshing:s}),(0,S.jsx)(GFe,{resources:te,selectedResource:l,onResourceSelect:ne,focusedIndex:D})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(P9,{serverId:r})]})}),(0,S.jsx)(A9,{}),(0,S.jsx)(k9,{defaultSize:`67%`,children:(0,S.jsx)(`div`,{ref:M,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(UFe,{result:m,isLoading:g,previewMode:x,serverId:r,readResource:n,onTogglePreview:()=>C(!x),onCopy:re,onDownload:R,onFullscreen:z,isCopied:k,selectedResource:l,llmConfig:p})})})]})}qFe.displayName=`ResourcesTab`;function JFe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onRejectAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(TN,{ref:c,placeholder:`Search requests...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Sampling`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(hp,{className:`h-4 w-4`})})}),(0,S.jsxs)(jd,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(j9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{side:`bottom`,children:`Reject all`})]})})]})}function YFe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(iu,{vertical:!0,noBorder:!0,message:`No sampling requests`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e.request.params?.messages?.length||0,s=e.request.params?.maxTokens;return(0,S.jsx)(M9,{id:`sampling-request-${e.id}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.serverName,(0,S.jsx)(`span`,{className:`size-1.5 block rounded-full bg-orange-500`})]}),description:(()=>{let t=i(e.timestamp),n=[];return o>0&&n.push(`${o} message${o>1?`s`:``}`),s&&n.push(`max ${s} tokens`),t+(n.length>0?` | ${n.join(`, `)}`:``)})(),onClick:()=>n(e)},e.id)})})}function XFe({llmConfig:e}){return{generateResponse:(0,w.useCallback)(async({request:t})=>{if(!e)throw Error(`LLM config is not available`);let n=t.params||{},r=n.maxTokens,i=n.temperature,a=n.messages||[];if(a.length===0)throw Error(`No messages found in sampling request`);let o=[];for(let e of a){if(!e||!e.role)continue;let t=Array.isArray(e.content)?e.content[0]:e.content;t&&t.type===`text`&&t.text&&(e.role===`user`||e.role===`assistant`)&&o.push({role:e.role,content:t.text})}if(o.length===0)throw Error(`No valid messages could be converted. Please ensure messages have 'text' content type.`);let{text:s}=await B7({config:{provider:e.provider,model:e.model,apiKey:e.apiKey,temperature:i??e.temperature,maxTokens:r,baseUrl:e.baseUrl},messages:o});return{role:`assistant`,content:{type:`text`,text:s},model:e.model,stopReason:`endTurn`}},[e]),isAvailable:e!==null}}function ZFe({request:t,onApprove:n,onReject:r,onClose:i,previewMode:a,onTogglePreview:o,isCopied:s,onCopy:c,onDownload:l,onFullscreen:u,llmConfig:d}){let[f,p]=(0,w.useState)(`manual`),[h,g]=(0,w.useState)(`stub-model`),[_,v]=(0,w.useState)(`endTurn`),[y,b]=(0,w.useState)(`assistant`),[x,C]=(0,w.useState)(`text`),[T,E]=(0,w.useState)(`positive`),[D,O]=(0,w.useState)(``),[k,A]=(0,w.useState)(`image/png`),[j,M]=(0,w.useState)(!1),[N,P]=(0,w.useState)(null),{generateResponse:F,isAvailable:I}=XFe({llmConfig:d});(0,w.useEffect)(()=>{t&&(g(f===`llm`&&d?.model?d.model:`stub-model`),v(`endTurn`),b(`assistant`),C(`text`),E(`positive`),O(``),A(`image/png`),P(null))},[t?.id]),(0,w.useEffect)(()=>{f===`llm`&&d?.model&&g(d.model)},[f,d?.model]);let L=async()=>{if(!t||!I){console.log(`[SamplingRequestDisplay] Cannot generate:`,{hasRequest:!!t,isAvailable:I});return}console.log(`[SamplingRequestDisplay] Starting LLM generation:`,{requestId:t.id,llmConfig:d}),M(!0),P(null);try{let e=await F({request:t.request});console.log(`[SamplingRequestDisplay] LLM generation result:`,{result:e,model:e.model,stopReason:e.stopReason,role:e.role,contentIsArray:Array.isArray(e.content),content:e.content}),g(e.model||d?.model||`stub-model`),v(e.stopReason||`endTurn`),b(e.role||`assistant`);let n=Array.isArray(e.content)?e.content[0]:e.content;console.log(`[SamplingRequestDisplay] Setting content:`,{contentType:n.type,hasText:`text`in n,text:`text`in n?n.text:void 0}),n.type===`text`?(C(`text`),E(n.text||``),console.log(`[SamplingRequestDisplay] Set text content:`,n.text)):n.type===`image`&&(C(`image`),O(n.data||``),A(n.mimeType||`image/png`),console.log(`[SamplingRequestDisplay] Set image content`)),console.log(`[SamplingRequestDisplay] Form state after update:`,{model:h,stopReason:_,role:y,contentType:x,textContent:T})}catch(e){console.error(`[SamplingRequestDisplay] LLM generation error:`,e);let t=e instanceof Error?e.message:`Failed to generate response`;P(t),PM.error(`LLM Generation Failed`,{description:t})}finally{M(!1),console.log(`[SamplingRequestDisplay] Generation complete`)}},ee=(0,w.useMemo)(()=>{let e={model:h,stopReason:_,role:y,content:{type:x}};return x===`text`?e.content.text=T:x===`image`&&(e.content.data=D,e.content.mimeType=k),e},[h,_,y,x,T,D,k]);return t?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b dark:border-zinc-700`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100`,children:t.serverName}),(0,S.jsx)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:new Date(t.timestamp).toLocaleString()})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,className:`h-8 w-8 p-0`,children:s?(0,S.jsx)(vf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(jf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Copy request`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:l,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Nf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Download request`})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Qf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:`Fullscreen`})]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Fp,{className:`h-4 w-4`})})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Request`}),(0,S.jsx)(`div`,{className:`bg-muted rounded-lg p-3 max-h-64 overflow-auto`,children:(0,S.jsx)(RV,{data:t.request})})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Response`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(ON,{htmlFor:`responseMode-${t.id}`,className:`text-xs text-gray-500 dark:text-gray-400`,children:`Mode:`}),(0,S.jsxs)(bP,{value:f,onValueChange:e=>p(e),children:[(0,S.jsx)(SP,{id:`responseMode-${t.id}`,className:`w-32 h-8 text-xs`,"data-testid":`sampling-response-mode-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`manual`,"data-testid":`sampling-response-mode-manual`,children:`Manual`}),(0,S.jsx)(wP,{value:`llm`,"data-testid":`sampling-response-mode-llm`,children:`LLM`})]})]})]})]}),f===`llm`&&(0,S.jsxs)(`div`,{className:`space-y-2 p-3 bg-muted rounded-lg`,children:[I?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(U,{onClick:L,disabled:j,size:`sm`,className:`flex items-center gap-2`,"data-testid":`sampling-generate-llm-button`,children:j?(0,S.jsxs)(`span`,{"data-testid":`sampling-generating`,className:`flex items-center gap-2`,children:[(0,S.jsx)(Zf,{className:`h-4 w-4 animate-spin`}),`Generating...`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Cp,{className:`h-4 w-4`}),`Generate with LLM`]})}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[`Using `,d?.provider,` (`,d?.model,`)`]})]}):(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`LLM not configured. Please configure LLM in the Chat tab.`}),N&&(0,S.jsx)(`div`,{className:`text-xs text-red-600 dark:text-red-400`,"data-testid":`sampling-generation-error`,children:N})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`model-${t.id}`,children:`Model`}),(0,S.jsx)(TN,{id:`model-${t.id}`,value:h,onChange:e=>g(e.target.value),placeholder:`stub-model`,disabled:f===`llm`&&j,"data-testid":`sampling-model-input`})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`stopReason-${t.id}`,children:`Stop Reason`}),(0,S.jsx)(TN,{id:`stopReason-${t.id}`,value:_,onChange:e=>v(e.target.value),placeholder:`endTurn`,disabled:f===`llm`&&j,"data-testid":`sampling-stop-reason-input`})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`role-${t.id}`,children:`Role`}),(0,S.jsxs)(bP,{value:y,onValueChange:e=>b(e),disabled:f===`llm`&&j,children:[(0,S.jsx)(SP,{id:`role-${t.id}`,"data-testid":`sampling-role-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`assistant`,children:`assistant`}),(0,S.jsx)(wP,{value:`user`,children:`user`})]})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`contentType-${t.id}`,children:`Content Type`}),(0,S.jsxs)(bP,{value:x,onValueChange:e=>C(e),disabled:f===`llm`&&j,children:[(0,S.jsx)(SP,{id:`contentType-${t.id}`,"data-testid":`sampling-content-type-select`,children:(0,S.jsx)(xP,{})}),(0,S.jsxs)(CP,{children:[(0,S.jsx)(wP,{value:`text`,children:`text`}),(0,S.jsx)(wP,{value:`image`,children:`image`})]})]})]}),x===`text`&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`text-${t.id}`,children:`Text Content`}),(0,S.jsx)(fY,{id:`text-${t.id}`,value:T,onChange:e=>E(e.target.value),placeholder:`Enter response text...`,rows:6,disabled:f===`llm`&&j,"data-testid":`sampling-text-content`})]}),x===`image`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`imageData-${t.id}`,children:`Base64 Image Data`}),(0,S.jsx)(fY,{id:`imageData-${t.id}`,value:D,onChange:e=>O(e.target.value),placeholder:`Base64 encoded image data...`,rows:4,disabled:f===`llm`&&j})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(ON,{htmlFor:`mimeType-${t.id}`,children:`MIME Type`}),(0,S.jsx)(TN,{id:`mimeType-${t.id}`,value:k,onChange:e=>A(e.target.value),placeholder:`image/png`,disabled:f===`llm`&&j})]})]})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2 p-4 border-t dark:border-zinc-700`,children:[(0,S.jsx)(U,{onClick:()=>{if(!t)return;let r=a_.safeParse(ee);if(!r.success){PM.error(`Invalid response`,{description:`Validation failed: ${r.error.message}`});return}n(t.id,r.data),i(),J(()=>Promise.resolve().then(()=>e(m(),1)).then(e=>{let n=PM(e.createElement(`div`,{className:`space-y-3`},e.createElement(`div`,null,e.createElement(`strong`,null,`Sampling Response Sent`),e.createElement(`p`,{className:`text-sm text-muted-foreground mt-1`},`The tool will continue executing.`)),e.createElement(`div`,{className:`flex gap-2`},e.createElement(`button`,{"data-testid":`sampling-view-tool-result`,className:`px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,onClick:()=>{let e=new globalThis.CustomEvent(`navigate-to-tool-result`,{detail:{toolName:t.toolName}});window.dispatchEvent(e),PM.dismiss(n)}},`View Tool Result`))),{duration:5e3})}),void 0)},className:`flex-1`,disabled:f===`llm`&&j,"data-testid":`sampling-approve-button`,children:`Approve`}),(0,S.jsx)(U,{onClick:()=>{t&&(r(t.id,`User rejected sampling request`),i())},variant:`outline`,className:`flex-1`,disabled:f===`llm`&&j,"data-testid":`sampling-reject-button`,children:`Reject`})]})]}):(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select a sampling request to view details`})})}function QFe({pendingRequests:e,onApprove:t,onReject:n,serverId:r,isConnected:i,mcpServerUrl:a}){let{selectedSamplingRequestId:o,setSelectedSamplingRequestId:s}=Uq(),{llmConfig:c}=K7({mcpServerUrl:a}),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(-1),[h,g]=(0,w.useState)(!0),[_,v]=(0,w.useState)(!1),[y,b]=(0,w.useState)(!0),[x,C]=(0,w.useState)(!1),T=(0,w.useRef)(null),E=(0,w.useRef)(null),D=(0,w.useRef)(null),O=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(console.log(`[SamplingTab] Auto-selection check:`,{selectedSamplingRequestId:o,pendingRequestsCount:e.length,currentSelectedId:l?.id}),o&&e.length>0){let t=e.find(e=>e.id===o);console.log(`[SamplingTab] Found request for auto-selection:`,!!t,t?.id),t&&(console.log(`[SamplingTab] Auto-selecting request:`,t.id),s(null),u(t),setTimeout(()=>{let e=document.getElementById(`sampling-request-${t.id}`);console.log(`[SamplingTab] Scrolling to element:`,!!e),e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[o,e,s]),(0,w.useEffect)(()=>{let t=t=>{let n=t.detail.requestId;console.log(`[SamplingTab] Custom navigate event received:`,n);let r=e.find(e=>e.id===n);r&&(console.log(`[SamplingTab] Selecting request from event:`,n),u(r),setTimeout(()=>{let e=document.getElementById(`sampling-request-${n}`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},200))};return window.addEventListener(`navigate-to-sampling`,t),()=>window.removeEventListener(`navigate-to-sampling`,t)},[e]),(0,w.useEffect)(()=>{h&&e.length>0&&T.current&&!O.current&&(T.current.scrollTop=0)},[e.length,h]),(0,w.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{e.scrollTop>0&&(O.current=!0,g(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(O.current=!1,g(!0))},[e.length]),(0,w.useEffect)(()=>{_&&D.current&&D.current.focus()},[_]);let k=(0,w.useCallback)(()=>{d.trim()||v(!1)},[d]),A=(0,w.useMemo)(()=>{if(!d.trim())return e;let t=d.toLowerCase();return e.filter(e=>e.serverName.toLowerCase().includes(t)||JSON.stringify(e.request||{}).toLowerCase().includes(t))},[e,d]);(0,w.useEffect)(()=>{m(-1)},[d]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=A;if(e.key===`ArrowDown`)e.preventDefault(),m(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),m(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&p>=0){e.preventDefault();let t=A[p];t&&j(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[p,A]),(0,w.useEffect)(()=>{if(p>=0){let e=`sampling-request-${A[p]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[p,A]);let j=(0,w.useCallback)(e=>{u(e)},[]),M=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to reject all sampling requests? This cannot be undone.`)&&(e.forEach(e=>{n(e.id,`User rejected all requests`)}),u(null))},[e,n]),N=(0,w.useCallback)(async()=>{if(l)try{await dj(JSON.stringify({id:l.id,serverName:l.serverName,timestamp:l.timestamp,request:l.request},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error(`[SamplingTab] Failed to copy request:`,e)}},[l]),P=(0,w.useCallback)(()=>{if(l)try{let e=new globalThis.Blob([JSON.stringify({id:l.id,serverName:l.serverName,timestamp:l.timestamp,request:l.request},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[SamplingTab] Failed to download request:`,e)}},[l]),F=(0,w.useCallback)(async()=>{if(E.current)try{document.fullscreenElement?await document.exitFullscreen():await E.current.requestFullscreen()}catch(e){console.error(`[SamplingTab] Failed to toggle fullscreen:`,e)}},[]);return i?(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{defaultSize:40,minSize:30,children:(0,S.jsx)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(k9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(JFe,{isSearchExpanded:_,searchQuery:d,filteredRequestsCount:A.length,requestsCount:e.length,onSearchExpand:()=>v(!0),onSearchChange:f,onSearchBlur:k,onRejectAll:M,searchInputRef:D}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(YFe,{requests:A,selectedRequest:l,onRequestSelect:j,focusedIndex:p,formatRelativeTime:N9,listRef:T})})]})})}),(0,S.jsx)(A9,{}),(0,S.jsx)(k9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:E,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(ZFe,{request:l,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:y,onTogglePreview:()=>b(!y),isCopied:x,onCopy:N,onDownload:P,onFullscreen:F,llmConfig:c})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Gf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function $Fe({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:r,focusedIndex:i}){if(e.length===0)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Mf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`No saved requests yet`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Execute a tool and click Save to store requests`})]});let a=(e,t)=>{e.stopPropagation(),t()};return(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,o)=>(0,S.jsxs)(`div`,{className:`relative group`,children:[(0,S.jsx)(M9,{id:`saved-${e.id}`,isSelected:t?.id===e.id,isFocused:i===o,icon:(0,S.jsx)(Kf,{className:`h-4 w-4`}),title:e.name,description:e.toolName,metadata:(0,S.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,S.jsx)(`span`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:new Date(e.savedAt).toLocaleString()})}),onClick:()=>n(e)}),(0,S.jsx)(`div`,{className:`absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10`,children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(U,{variant:`secondary`,size:`sm`,onClick:t=>a(t,()=>r(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Delete saved request`})})]})})]},e.id))})}function eIe({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:r,onSave:i,onCancel:a}){return e?(0,S.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:a,children:(0,S.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:e=>e.stopPropagation(),children:[(0,S.jsx)(`h3`,{className:`text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100`,children:`Save Request`}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(ON,{htmlFor:`request-name`,children:`Request Name (optional)`}),(0,S.jsx)(TN,{id:`request-name`,value:t,onChange:e=>r(e.target.value),placeholder:n,className:`mt-2`,onKeyDown:e=>{e.key===`Enter`&&i()},autoFocus:!0})]}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,S.jsx)(U,{variant:`outline`,onClick:a,children:`Cancel`}),(0,S.jsxs)(U,{onClick:i,children:[(0,S.jsx)(mp,{className:`h-4 w-4 mr-2`}),`Save`]})]})]})]})}):null}function I9(e,t){if(!e?.$ref)return e;let n=e.$ref;if(!n.startsWith(`#/`))return e;let r=n.substring(2).split(`/`),i=t;for(let t of r)if(i&&typeof i==`object`&&t in i)i=i[t];else return e;return i}function tIe(e,t){if(e?.anyOf&&Array.isArray(e.anyOf)){let n=e.anyOf.find(e=>I9(e,t)?.type!==`null`);if(n)return{...I9(n,t),nullable:!0}}return e}function nIe(e,t){let n=tIe(e||{},t);return n=I9(n,t),n}function L9(e,t){let n=nIe(e,t);if(typeof n.type==`string`)return n.type;if(Array.isArray(n.type)){let e=n.type.find(e=>e!==`null`);return typeof e==`string`?e:void 0}}function rIe(e){let t=e?.enum;return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:null}function iIe(e){let t=e.trim().toLowerCase();return[`true`,`1`,`yes`,`on`].includes(t)?!0:[`false`,`0`,`no`,`off`].includes(t)?!1:e}function aIe(e,t){if(t===`number`||t===`integer`){let t=e.trim();if(!t)return e;let n=Number(t);return Number.isFinite(n)?n:e}return t===`boolean`?iIe(e):e}function oIe(e,t){if(e===void 0)return e;if(t===`object`||t===`array`){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}if(t===`number`||t===`integer`){if(typeof e==`number`)return e;if(typeof e==`string`){let t=e.trim();if(!t)return e;let n=Number(t);return Number.isFinite(n)?n:e}return e}return t===`boolean`?typeof e==`boolean`?e:typeof e==`string`?iIe(e):e:e}function sIe(e){let t=``,n=0,r=!1,i=!1;for(;n<e.length;){let a=e[n];if(i){t+=a,i=!1,n++;continue}if(a===`\\`){i=!0,t+=a,n++;continue}if(a==="`"){r?(t+=`"`,r=!1):(t+=`"`,r=!0),n++;continue}if(r&&a===`"`){t+=`\\"`,n++;continue}t+=a,n++}return t}function cIe(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return e}catch{try{let e=sIe(t),n=JSON.parse(e);if(n&&typeof n==`object`&&!Array.isArray(n))return n}catch{return null}}return null}function lIe({selectedTool:e,toolArgs:t,onArgChange:n,onBulkPaste:r,autoFilledFields:i,setFields:a,sendEmptyFields:o,onToggleEmpty:s}){let c=e?.inputSchema?.properties||{},l=e?.inputSchema?.required||[],u=Object.keys(c).length>0,d=async(e,t)=>{r&&await r(e.clipboardData.getData(`text`),t)&&e.preventDefault()};return u?(0,S.jsx)(`div`,{className:`space-y-4`,children:Object.entries(c).map(([r,c])=>{let u=nIe(c,e?.inputSchema||{}),f=rIe(u),p=u.type===`string`&&f!==null,m=u,h=l.includes(r),g=t[r],_=``;g!=null&&(_=typeof g==`string`?g:typeof g==`object`&&g?JSON.stringify(g,null,2):String(g));let v=m.type===`object`||m.type===`array`,y=v?m.type===`array`?`array`:`object`:`string`,b=a?.has(r)??!0,x=s&&(m.type===`string`||v);return v?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),x&&s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:y===`array`?`Send empty array explicitly`:`Send empty object explicitly`}),(0,S.jsx)(MP,{checked:o?.has(r)??!1,onCheckedChange:e=>s(r,y,e),"aria-label":y===`array`?`Send empty array`:`Send empty object`,title:y===`array`?`Send empty array []`:`Send empty object {}`})]})]}),(0,S.jsx)(fY,{id:r,"data-testid":`tool-param-${r}`,value:_,onChange:e=>n(r,e.target.value),onPaste:e=>d(e,r),placeholder:m?.description||`Enter ${r}`,disabled:o?.has(r)??!1,className:`min-h-[100px] ${b?``:`opacity-70`} ${i?.has(r)?`animate-pulse ring-2 ring-green-500 dark:ring-green-400`:``}`}),m?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r):p&&f?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsxs)(bP,{value:String(t[r]||``),onValueChange:e=>n(r,e),children:[(0,S.jsx)(SP,{id:r,className:`w-full ${b?``:`opacity-70`}`,"data-testid":`tool-param-${r}`,children:(0,S.jsx)(xP,{placeholder:m.description||`Select an option`})}),(0,S.jsx)(CP,{children:f.map((e,t)=>(0,S.jsx)(wP,{value:e,children:m.enumNames?.[t]||e},e))})]}),m.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r):(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsxs)(ON,{htmlFor:r,className:`text-sm font-medium`,children:[r,h&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),x&&s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`Send empty string`}),(0,S.jsx)(MP,{checked:o?.has(r)??!1,onCheckedChange:e=>s(r,`string`,e),"aria-label":`Send empty string`,title:`Send empty string`})]})]}),(0,S.jsx)(TN,{id:r,"data-testid":`tool-param-${r}`,value:_,onChange:e=>n(r,e.target.value),onPaste:e=>d(e,r),placeholder:m?.description||`Enter ${r}`,disabled:o?.has(r)??!1,className:`${b?``:`opacity-70`} ${i?.has(r)?`animate-pulse ring-2 ring-green-500 dark:ring-green-400`:``}`}),m?.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:m.description})]},r)})}):(0,S.jsx)(`div`,{className:`flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm`,children:`No parameters required`})}function uIe({selectedTool:e,toolArgs:t,payloadToSend:n,isExecuting:r,isConnected:i,onArgChange:a,onExecute:o,onSave:s,onCancel:c,onBulkPaste:l,autoFilledFields:u,setFields:d,sendEmptyFields:f,onToggleEmpty:p}){let[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(!1),O=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(O.current&&e?.description){let e=O.current,t=parseFloat(getComputedStyle(e).lineHeight),n=e.scrollHeight;D(Math.round(n/t)>3),T(!1)}},[e?.description]),(0,w.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&e&&!r&&i&&(t.preventDefault(),o()),t.key===`Escape`&&r&&c&&(t.preventDefault(),c())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,r,i,o,c]),e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4`,children:(0,S.jsx)(`div`,{children:(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-0 gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-base sm:text-lg font-semibold`,"data-testid":`tool-execution-title`,children:e.name}),(0,S.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`tool-execution-metadata-button`,variant:g?`default`:`outline`,onClick:()=>_(!g),disabled:r,size:`sm`,className:`lg:size-default gap-2`,title:`View tool metadata`,children:[(0,S.jsx)(Of,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Metadata`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`View tool definition metadata`})})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(U,{"data-testid":`tool-execution-copy-payload-button`,variant:`outline`,onClick:async()=>{if(e)try{await dj(JSON.stringify(n??t,null,2)),x(!0),setTimeout(()=>x(!1),2e3)}catch{}},disabled:r,size:`sm`,className:`lg:size-default gap-2`,title:`Copy payload as JSON`,children:[b?(0,S.jsx)(vf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(jf,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:b?`Copied!`:`Payload`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Copy payload as JSON`})})]}),(0,S.jsxs)(U,{"data-testid":`tool-execution-save-button`,variant:`outline`,onClick:s,disabled:r,size:`sm`,className:`lg:size-default gap-2`,children:[(0,S.jsx)(mp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Save`})]}),r&&c?(0,S.jsxs)(kd,{open:m?void 0:!1,children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`div`,{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:`relative`,children:(0,S.jsx)(U,{"data-testid":`tool-execution-cancel-button`,onClick:c,variant:m?`destructive`:`default`,size:`sm`,className:`lg:size-default gap-2 transition-all`,children:m?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Fp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Cancel`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border border-current p-1 rounded-full ml-2`,children:`Esc`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]})})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Hover to cancel (or press Esc)`})})]}):(0,S.jsx)(U,{"data-testid":`tool-execution-execute-button`,onClick:o,disabled:r||!i,size:`sm`,className:`lg:size-default pr-1! gap-0`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(cp,{className:`h-4 w-4 sm:mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Execute`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2`,children:`⌘↵`})]})})]})]})})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3 sm:px-5 pb-4 pr-3`,children:[e.description&&(0,S.jsxs)(`div`,{className:`relative mb-4`,children:[(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`p`,{ref:O,"data-testid":`tool-execution-description`,className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed transition-all duration-300 ${!C&&E?`line-clamp-3`:``}`,children:e.description}),E&&!C&&(0,S.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-[1.4em] bg-linear-to-t from-white/95 dark:from-black/95 via-white/55 dark:via-black/55 to-transparent pointer-events-none`})]}),E&&(0,S.jsx)(`div`,{className:`flex justify-end`,children:(0,S.jsx)(`button`,{onClick:()=>T(!C),className:`relative z-10 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 mt-1 transition-colors`,children:C?(0,S.jsxs)(S.Fragment,{children:[`Show less`,(0,S.jsx)(Sf,{className:`h-3 w-3`})]}):(0,S.jsxs)(S.Fragment,{children:[`Show more`,(0,S.jsx)(yf,{className:`h-3 w-3`})]})})})]}),(0,S.jsx)(lIe,{selectedTool:e,toolArgs:t,onArgChange:a,onBulkPaste:l,autoFilledFields:u,setFields:d,sendEmptyFields:f,onToggleEmpty:p})]}),(0,S.jsx)(yN,{open:g,onOpenChange:_,children:(0,S.jsxs)(xN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:[(0,S.jsx)(SN,{children:(0,S.jsxs)(CN,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsx)(`span`,{children:`Tool Definition`}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e)try{await dj(JSON.stringify(e,null,2)),y(!0),setTimeout(()=>y(!1),2e3)}catch{}},className:`h-7 w-7 p-0`,title:`Copy metadata`,children:v?(0,S.jsx)(vf,{className:`h-3.5 w-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`h-3.5 w-3.5`})})]})}),(0,S.jsx)(RV,{data:e,filename:`tool-definition-${e.name}-${Date.now()}.json`})]})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a tool to get started`}),(0,S.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 dIe({timestamp:e}){let[t,n]=(0,w.useState)(()=>R9(e));return(0,w.useEffect)(()=>{let t=()=>n(R9(e));t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),(0,S.jsx)(`span`,{children:t})}function R9(e){let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<10?`now`:n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`}function fIe(e){if(!e?.isError)return null;let t=e.content;if(Array.isArray(t)){let e=t.filter(e=>e.type===`text`).map(e=>e.text).filter(Boolean);if(e.length>0)return e.join(`
|
|
826
826
|
`)}return`An error occurred`}function pIe(e){try{return JSON.parse(e),!0}catch{return!1}}function mIe({content:e}){let[t,n]=(0,w.useState)(new Set),r=(0,w.useCallback)(e=>{n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return!Array.isArray(e)||e.length===0?(0,S.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:`No content`}):(0,S.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{if(e.type===`text`){let i=e.text||``,a=t.has(n),o=pIe(i),s=o?(()=>{try{return JSON.parse(i)}catch{return null}})():null;return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:[`Text Content`,a?` (formatted)`:``]}),o&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>r(n),className:`text-xs text-blue-600 dark:text-blue-400 hover:underline`,"data-testid":`tool-result-format-toggle-${n}`,children:a?`Show as text`:`Try to format`})]}),a&&s!==null?(0,S.jsx)(RV,{data:s,filename:`content-${n}.json`}):(0,S.jsx)(`div`,{className:`bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words`,"data-testid":`tool-execution-results-text-content`,children:i})]},n)}if(e.type===`image`)return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Image Content`}),(0,S.jsxs)(`div`,{className:`bg-gray-50 dark:bg-zinc-900 rounded-lg p-3`,children:[(0,S.jsx)(`img`,{src:`data:${e.mimeType||`image/png`};base64,${e.data}`,alt:`Result`,className:`max-w-full rounded`,"data-testid":`tool-execution-results-image-content`}),e.annotations&&(0,S.jsx)(`div`,{className:`mt-2 text-xs text-gray-500 dark:text-gray-400`,children:(0,S.jsx)(RV,{data:e.annotations,filename:`image-annotations-${n}.json`,"data-testid":`tool-execution-results-image-annotations`})})]})]},n);if(e.type===`audio`)return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Audio Content`}),(0,S.jsxs)(`div`,{className:`bg-gray-50 dark:bg-zinc-900 rounded-lg p-3`,children:[(0,S.jsx)(`audio`,{controls:!0,src:`data:${e.mimeType||`audio/wav`};base64,${e.data}`,className:`w-full`,"data-testid":`tool-execution-results-audio-content`}),e.annotations&&(0,S.jsx)(`div`,{className:`mt-2 text-xs text-gray-500 dark:text-gray-400`,children:(0,S.jsx)(RV,{data:e.annotations,filename:`audio-annotations-${n}.json`,"data-testid":`tool-execution-results-audio-annotations`})})]})]},n);if(e.type===`resource_link`)return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Resource Link`}),(0,S.jsxs)(`div`,{className:`bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:`URI:`}),` `,e.uri]}),e.name&&(0,S.jsxs)(`div`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:`Name:`}),` `,e.name]}),e.description&&(0,S.jsxs)(`div`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:`Description:`}),` `,e.description]}),e.mimeType&&(0,S.jsxs)(`div`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:`MIME Type:`}),` `,e.mimeType]}),e.annotations&&(0,S.jsxs)(`div`,{className:`mt-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-1`,children:`Annotations:`}),(0,S.jsx)(RV,{data:e.annotations,filename:`resource-link-annotations-${n}.json`,"data-testid":`tool-execution-results-resource-link-annotations`})]})]})]},n);if(e.type===`resource`){let t=e.resource||{};return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Embedded Resource`}),(0,S.jsxs)(`div`,{className:`bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`font-mono text-sm break-all`,"data-testid":`tool-execution-results-resource-uri`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:`URI:`}),` `,t.uri]}),t.mimeType&&(0,S.jsxs)(`div`,{className:`text-sm`,children:[(0,S.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,"data-testid":`tool-execution-results-mime-type`,children:`MIME Type:`}),` `,t.mimeType]}),t.text&&(0,S.jsxs)(`div`,{"data-testid":`tool-execution-results-resource-text-content`,children:[(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-1`,children:`Content:`}),(0,S.jsx)(`div`,{className:`bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto`,children:t.text})]}),t.blob&&(0,S.jsxs)(`div`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:[`[Binary content: `,t.blob.length||0,` bytes]`]}),t.annotations&&(0,S.jsxs)(`div`,{className:`mt-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-1`,children:`Annotations:`}),(0,S.jsx)(RV,{data:t.annotations,filename:`resource-annotations-${n}.json`,"data-testid":`tool-execution-results-resource-annotations`})]})]})]},n)}return(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:[`Unknown Content Type: `,e.type||`N/A`]}),(0,S.jsx)(RV,{data:e,filename:`content-${n}.json`,"data-testid":`tool-execution-results-unknown-content`})]},n)})})}function hIe({results:e,copiedResult:t,serverId:n,readResource:r,onCopy:i,onMaximize:a,isMaximized:o=!1,onRerunTool:s}){let[c,l]=(0,w.useState)(0),[u,d]=(0,w.useState)(!0),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(`inline`),[g,_]=(0,w.useState)(null),v=(0,w.useRef)(!1),y=e[0],b=y?e.filter(e=>e.toolName===y.toolName):[],x=b[c]||b[0],C=e.findIndex(e=>e===x),T=(x?x.error||fIe(x.result):null)??(x==null?``:JSON.stringify(x.result,null,2));(0,w.useEffect)(()=>{b.length>0&&c>=b.length&&l(0)},[b.length,c]),(0,w.useEffect)(()=>{v.current=!1,p(null)},[y?.toolName]);let E=(0,w.useMemo)(()=>x?.args,[x?.timestamp,c]),D=(0,w.useMemo)(()=>x?.result,[x?.timestamp,x?.duration,c]),O=(0,w.useCallback)(e=>r(e),[r]),k=(0,w.useCallback)(e=>{let t=e.filter(e=>e.type===`text`&&`text`in e).map(e=>e.text).join(`
|
|
827
|
-
`),n=e.filter(e=>e.type===`image`).length,r=e.filter(e=>e.type===`resource`).length,i=[n>0&&`${n} image${n>1?`s`:``}`,r>0&&`${r} resource${r>1?`s`:``}`].filter(Boolean).join(`, `);PM.info(`Widget follow-up`,{description:[t,i].filter(Boolean).join(` — `),duration:5e3})},[]),{playground:A}=yQ(),j=(0,w.useMemo)(()=>x?SQ(x.toolMeta,x.result):null,[x]),M=(0,w.useMemo)(()=>x?xQ(x.toolMeta):!1,[x]),N=(0,w.useMemo)(()=>j?j===`both`?A.selectedProtocol?A.selectedProtocol:`mcp-apps`:j:null,[j,A.selectedProtocol]),P=(0,w.useMemo)(()=>x?M?CQ(`mcp-apps`,x.toolMeta):x.toolMeta?.ui?.resourceUri:null,[x,M]),F=(0,w.useMemo)(()=>(N===`mcp-apps`||M)&&!!P,[N,M,P]),I=(0,w.useMemo)(()=>x?M?CQ(`chatgpt-app`,x.toolMeta):x.toolMeta?.[`openai/outputTemplate`]:null,[x,M]),L=(0,w.useMemo)(()=>!!((N===`chatgpt-app`||M)&&I&&typeof I==`string`&&x?.appsSdkResource),[N,M,I,x]),ee=I,te=(0,w.useMemo)(()=>x?.result?.content||[],[x]),ne=(0,w.useMemo)(()=>te.filter(e=>e.type===`resource`&&F9(e.resource)),[te]),re=ne.length>0,R=(0,w.useMemo)(()=>ee||P||ne[0]?.resource?.uri||null,[ee,P,ne]),z=(0,w.useMemo)(()=>!!(te&&te.length>0||x?.result?.structuredContent),[te,x]),B=(0,w.useMemo)(()=>!F&&!re&&!L&&z,[F,re,L,z]),ie=(0,w.useMemo)(()=>{let e=[];return(F||M&&P)&&e.push({mode:`mcp-apps`,label:`Component (MCP Apps)`}),(L||M&&I)&&e.push({mode:`chatgpt-app`,label:`Component (Apps SDK)`}),re&&e.push({mode:`mcp-ui`,label:`Component (MCP-UI)`}),e.push({mode:`json`,label:`Raw JSON`}),e},[L,F,re,M,I,P]);return(0,w.useEffect)(()=>{if(ie.length===0)return;let e=f&&ie.some(e=>e.mode===f),t=ie.find(e=>e.mode!==`json`);if(t){let n=v.current;if(v.current=!0,!f||!e||f===`json`&&!n){p(t.mode);return}}else (!f||!e)&&p(`json`)},[ie,f]),e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,S.jsx)(`div`,{className:`text-center`,children:(0,S.jsx)(iu,{vertical:!0,noBorder:!0,message:`No Results yet`})})})})}):(0,S.jsxs)(`div`,{className:`relative flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:[(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsxs)(`div`,{className:`space-y-0 flex flex-col flex-1 h-full`,children:[(0,S.jsxs)(`div`,{className:`sticky top-0 z-40 flex items-center gap-2 px-4 pt-2 backdrop-blur-xs bg-white/50 dark:bg-black/50 ${F||re||L||B?`border-b border-gray-200 dark:border-zinc-600 pb-2`:``}`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium hidden sm:block`,children:`Response`}),x.duration!==void 0&&(0,S.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(Ip,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[x.duration,`ms`]})]}),(L||F||re)&&(0,S.jsx)(`div`,{className:`flex items-center gap-4 sm:ml-4`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:ie.map((e,t)=>(0,S.jsxs)(w.Fragment,{children:[t>0&&(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{"data-testid":`tool-result-view-${e.mode}`,onClick:()=>p(e.mode),className:`text-xs font-medium ${f===e.mode?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:e.label})]},e.mode))})}),B&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:ml-4`,children:[(0,S.jsx)(`button`,{onClick:()=>d(!0),className:`text-xs font-medium ${u?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:`Formatted`}),(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{onClick:()=>d(!1),className:`text-xs font-medium ${u?`text-zinc-500 dark:text-zinc-400`:`text-black dark:text-white`}`,children:`Raw`})]}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o&&s&&(0,S.jsxs)(U,{"data-testid":`tool-result-rerun`,variant:`ghost`,size:`sm`,onClick:s,title:`Re-run with same arguments`,children:[(0,S.jsx)(cp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline ml-1`,children:`Re-run`})]}),(F||L||re)&&a&&(0,S.jsx)(U,{"data-testid":`tool-result-maximize`,variant:`ghost`,size:`sm`,onClick:a,title:o?`Restore`:`Maximize`,children:o?(0,S.jsx)(np,{className:`h-4 w-4`}):(0,S.jsx)($f,{className:`h-4 w-4`})}),b.length>1&&(0,S.jsxs)(bP,{value:c.toString(),onValueChange:e=>l(parseInt(e)),children:[(0,S.jsx)(SP,{size:`sm`,className:`w-[140px] h-8 text-xs`,children:(0,S.jsx)(xP,{children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Kf,{className:`h-3 w-3`}),(0,S.jsx)(dIe,{timestamp:x.timestamp})]})})}),(0,S.jsx)(CP,{children:b.map((e,t)=>(0,S.jsx)(wP,{value:t.toString(),children:(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Kf,{className:`h-3 w-3`}),(0,S.jsx)(`span`,{children:R9(e.timestamp)}),(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,new Date(e.timestamp).toLocaleTimeString(),`)`]})]})},t))})]}),(0,S.jsx)(U,{"data-testid":`tool-result-copy-${C}`,variant:`ghost`,size:`sm`,onClick:()=>i(C,T),children:t===C?(0,S.jsx)(vf,{className:`h-4 w-4`}):(0,S.jsx)(jf,{className:`h-4 w-4`})})]})]}),(()=>{let e=x.error||fIe(x.result);return e?(0,S.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:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:e})]}):(()=>{if(!f)return(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px]`,children:(0,S.jsx)(zq,{className:`size-5`})});switch(f){case`chatgpt-app`:{if(!L||!x.appsSdkResource)return(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`Apps SDK resource not available`})})});let e=x.appsSdkResource;return e.isLoading?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px]`,children:(0,S.jsx)(zq,{className:`size-5`})}):e.error?(0,S.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:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Resource Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:e.error})]}):(0,S.jsx)(`div`,{className:`flex-1`,children:(0,S.jsx)(W7,{componentUrl:e.uri,toolName:x.toolName,toolArgs:E,toolResult:D,serverId:n,readResource:O,className:`w-full h-full relative p-4`,invoking:x.toolMeta?.[`openai/toolInvocation/invoking`],invoked:x.toolMeta?.[`openai/toolInvocation/invoked`]},`openai-${x.timestamp}`)})}case`mcp-apps`:return!F||!P?(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`MCP Apps resource not available`})})}):(0,S.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-30 flex items-center gap-2`,children:(0,S.jsx)(U7,{toolCallId:`tool-${x.timestamp}`,displayMode:m,onDisplayModeChange:h,propsContext:`tool`,resourceUri:P,toolInput:x.args,resourceAnnotations:x.toolMeta,llmConfig:null,resource:null,onPropsChange:_})}),(0,S.jsx)(N7,{serverId:n,invoking:x.toolMeta?.[`openai/toolInvocation/invoking`],invoked:x.toolMeta?.[`openai/toolInvocation/invoked`],toolCallId:`tool-${x.timestamp}`,toolName:x.toolName,toolInput:E,toolOutput:D,toolMetadata:x.toolMeta,resourceUri:P,readResource:O,className:`w-full h-full relative p-4`,customProps:g||void 0,displayMode:m,onDisplayModeChange:h,onSendFollowUp:k,onRerun:s},`mcp-apps-${x.timestamp}`)]});case`mcp-ui`:return re?(0,S.jsxs)(`div`,{className:`space-y-0 h-full`,children:[ne.map((e,t)=>(0,S.jsx)(`div`,{className:`mx-0 size-full`,children:(0,S.jsx)(VFe,{resource:e.resource,onUIAction:e=>{},className:`w-full h-full relative`})},t)),te.filter(e=>!(e.type===`resource`&&F9(e.resource))).length>0&&(0,S.jsx)(`div`,{className:`px-4`,children:(0,S.jsx)(RV,{data:te.filter(e=>!(e.type===`resource`&&F9(e.resource))),filename:`tool-result-${x.toolName}-non-ui-${Date.now()}.json`})})]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`MCP-UI resource not available`})})});case`json`:if(B&&u){let e=x.result?.structuredContent;return(0,S.jsxs)(`div`,{className:`px-4 pt-4 space-y-4`,"data-testid":`tool-execution-results-content`,children:[e&&(0,S.jsxs)(`div`,{className:`space-y-2`,"data-testid":`tool-execution-results-structured-content`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Structured Content`}),(0,S.jsx)(RV,{data:e,filename:`structured-content-${x.toolName}-${Date.now()}.json`})]}),te&&te.length>0&&(0,S.jsx)(mIe,{content:te}),!e&&(!te||te.length===0)&&(0,S.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-gray-400`,"data-testid":`tool-execution-results-no-content`,children:`No content to display`})]})}return(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(RV,{data:x.result,filename:`tool-result-${x.toolName}-${Date.now()}.json`})});default:return null}})()})()]})}),R&&(f===`chatgpt-app`||f===`mcp-apps`||f===`mcp-ui`)&&(0,S.jsx)(`div`,{className:`absolute bottom-0 left-1/2 -translate-x-1/2 z-40 pointer-events-none`,children:(0,S.jsx)(`span`,{className:`text-[11px] bg-gray-200 dark:bg-zinc-800 text-gray-500 dark:text-gray-400 px-3 py-0.5 rounded-t-xl font-mono max-w-[320px] truncate block`,children:R})})]})}function gIe({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:r}){if(e.length===0)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Pp,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No tools available`})]});let i=e.some(e=>e.inputSchema?.properties&&Object.keys(e.inputSchema.properties).length>0);return(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e._meta,s=SQ(o,void 0),c=e.inputSchema?.properties,l=c?Object.keys(c).length:0,u=i&&l>0&&(0,S.jsxs)(kt,{variant:`outline`,className:`text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400`,children:[l,` params`]}),d=s===`mcp-apps`||s===`chatgpt-app`||s===`both`||u?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(s===`mcp-apps`||s===`both`)&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(rTe,{className:`h-3.5 w-3.5`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`MCP-APP`})})]}),(s===`chatgpt-app`||s===`both`)&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(iTe,{className:`h-3.5 w-3.5`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Apps SDK`})})]}),u]}):void 0;return(0,S.jsx)(M9,{id:`tool-${e.name}`,"data-testid":`tool-item-${e.name}`,isSelected:t?.name===e.name,isFocused:r===a,icon:(0,S.jsx)(Pp,{className:`h-4 w-4`}),title:e.name,description:e.description,metadata:d,onClick:()=>n(e)},e.name)})})}function _Ie({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:r,savedRequestsCount:i,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d}){return(0,S.jsx)(TFe,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:`tools`,secondaryTabName:`saved`,primaryTabTitle:`Tools`,secondaryTabTitle:`Saved`,primaryCount:r,secondaryCount:i,primaryIcon:Pp,secondaryIcon:Mf,searchPlaceholder:`Search tools...`,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d})}var vIe=`AlertDialog`,[yIe,bIe]=Nt(vIe,[UM]),z9=UM(),xIe=e=>{let{__scopeAlertDialog:t,...n}=e,r=z9(t);return(0,S.jsx)(dN,{...r,...n,modal:!0})};xIe.displayName=vIe;var SIe=`AlertDialogTrigger`,CIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(fN,{...i,...r,ref:t})});CIe.displayName=SIe;var wIe=`AlertDialogPortal`,TIe=e=>{let{__scopeAlertDialog:t,...n}=e,r=z9(t);return(0,S.jsx)(pN,{...r,...n})};TIe.displayName=wIe;var EIe=`AlertDialogOverlay`,DIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(mN,{...i,...r,ref:t})});DIe.displayName=EIe;var B9=`AlertDialogContent`,[OIe,kIe]=yIe(B9),AIe=Wt(`AlertDialogContent`),jIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=z9(n),o=w.useRef(null),s=D(t,o),c=w.useRef(null);return(0,S.jsx)(She,{contentName:B9,titleName:MIe,docsSlug:`alert-dialog`,children:(0,S.jsx)(OIe,{scope:n,cancelRef:c,children:(0,S.jsxs)(hN,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:jt(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,S.jsx)(AIe,{children:r}),(0,S.jsx)(BIe,{contentRef:o})]})})})});jIe.displayName=B9;var MIe=`AlertDialogTitle`,NIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(gN,{...i,...r,ref:t})});NIe.displayName=MIe;var PIe=`AlertDialogDescription`,FIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(_N,{...i,...r,ref:t})});FIe.displayName=PIe;var IIe=`AlertDialogAction`,LIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(vN,{...i,...r,ref:t})});LIe.displayName=IIe;var RIe=`AlertDialogCancel`,zIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=kIe(RIe,n),a=z9(n),o=D(t,i);return(0,S.jsx)(vN,{...a,...r,ref:o})});zIe.displayName=RIe;var BIe=({contentRef:e})=>{let t=`\`${B9}\` requires a description for the component to be accessible for screen reader users.
|
|
827
|
+
`),n=e.filter(e=>e.type===`image`).length,r=e.filter(e=>e.type===`resource`).length,i=[n>0&&`${n} image${n>1?`s`:``}`,r>0&&`${r} resource${r>1?`s`:``}`].filter(Boolean).join(`, `);PM.info(`Widget follow-up`,{description:[t,i].filter(Boolean).join(` — `),duration:5e3})},[]),{playground:A}=bQ(),j=(0,w.useMemo)(()=>x?CQ(x.toolMeta,x.result):null,[x]),M=(0,w.useMemo)(()=>x?SQ(x.toolMeta):!1,[x]),N=(0,w.useMemo)(()=>j?j===`both`?A.selectedProtocol?A.selectedProtocol:`mcp-apps`:j:null,[j,A.selectedProtocol]),P=(0,w.useMemo)(()=>x?M?wQ(`mcp-apps`,x.toolMeta):x.toolMeta?.ui?.resourceUri:null,[x,M]),F=(0,w.useMemo)(()=>(N===`mcp-apps`||M)&&!!P,[N,M,P]),I=(0,w.useMemo)(()=>x?M?wQ(`chatgpt-app`,x.toolMeta):x.toolMeta?.[`openai/outputTemplate`]:null,[x,M]),L=(0,w.useMemo)(()=>!!((N===`chatgpt-app`||M)&&I&&typeof I==`string`&&x?.appsSdkResource),[N,M,I,x]),ee=I,te=(0,w.useMemo)(()=>x?.result?.content||[],[x]),ne=(0,w.useMemo)(()=>te.filter(e=>e.type===`resource`&&F9(e.resource)),[te]),re=ne.length>0,R=(0,w.useMemo)(()=>ee||P||ne[0]?.resource?.uri||null,[ee,P,ne]),z=(0,w.useMemo)(()=>!!(te&&te.length>0||x?.result?.structuredContent),[te,x]),B=(0,w.useMemo)(()=>!F&&!re&&!L&&z,[F,re,L,z]),ie=(0,w.useMemo)(()=>{let e=[];return(F||M&&P)&&e.push({mode:`mcp-apps`,label:`Component (MCP Apps)`}),(L||M&&I)&&e.push({mode:`chatgpt-app`,label:`Component (Apps SDK)`}),re&&e.push({mode:`mcp-ui`,label:`Component (MCP-UI)`}),e.push({mode:`json`,label:`Raw JSON`}),e},[L,F,re,M,I,P]);return(0,w.useEffect)(()=>{if(ie.length===0)return;let e=f&&ie.some(e=>e.mode===f),t=ie.find(e=>e.mode!==`json`);if(t){let n=v.current;if(v.current=!0,!f||!e||f===`json`&&!n){p(t.mode);return}}else (!f||!e)&&p(`json`)},[ie,f]),e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,S.jsx)(`div`,{className:`text-center`,children:(0,S.jsx)(iu,{vertical:!0,noBorder:!0,message:`No Results yet`})})})})}):(0,S.jsxs)(`div`,{className:`relative flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:[(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsxs)(`div`,{className:`space-y-0 flex flex-col flex-1 h-full`,children:[(0,S.jsxs)(`div`,{className:`sticky top-0 z-40 flex items-center gap-2 px-4 pt-2 backdrop-blur-xs bg-white/50 dark:bg-black/50 ${F||re||L||B?`border-b border-gray-200 dark:border-zinc-600 pb-2`:``}`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium hidden sm:block`,children:`Response`}),x.duration!==void 0&&(0,S.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(Ip,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[x.duration,`ms`]})]}),(L||F||re)&&(0,S.jsx)(`div`,{className:`flex items-center gap-4 sm:ml-4`,children:(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:ie.map((e,t)=>(0,S.jsxs)(w.Fragment,{children:[t>0&&(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{"data-testid":`tool-result-view-${e.mode}`,onClick:()=>p(e.mode),className:`text-xs font-medium ${f===e.mode?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:e.label})]},e.mode))})}),B&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:ml-4`,children:[(0,S.jsx)(`button`,{onClick:()=>d(!0),className:`text-xs font-medium ${u?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:`Formatted`}),(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{onClick:()=>d(!1),className:`text-xs font-medium ${u?`text-zinc-500 dark:text-zinc-400`:`text-black dark:text-white`}`,children:`Raw`})]}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o&&s&&(0,S.jsxs)(U,{"data-testid":`tool-result-rerun`,variant:`ghost`,size:`sm`,onClick:s,title:`Re-run with same arguments`,children:[(0,S.jsx)(cp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline ml-1`,children:`Re-run`})]}),(F||L||re)&&a&&(0,S.jsx)(U,{"data-testid":`tool-result-maximize`,variant:`ghost`,size:`sm`,onClick:a,title:o?`Restore`:`Maximize`,children:o?(0,S.jsx)(np,{className:`h-4 w-4`}):(0,S.jsx)($f,{className:`h-4 w-4`})}),b.length>1&&(0,S.jsxs)(bP,{value:c.toString(),onValueChange:e=>l(parseInt(e)),children:[(0,S.jsx)(SP,{size:`sm`,className:`w-[140px] h-8 text-xs`,children:(0,S.jsx)(xP,{children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Kf,{className:`h-3 w-3`}),(0,S.jsx)(dIe,{timestamp:x.timestamp})]})})}),(0,S.jsx)(CP,{children:b.map((e,t)=>(0,S.jsx)(wP,{value:t.toString(),children:(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Kf,{className:`h-3 w-3`}),(0,S.jsx)(`span`,{children:R9(e.timestamp)}),(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,new Date(e.timestamp).toLocaleTimeString(),`)`]})]})},t))})]}),(0,S.jsx)(U,{"data-testid":`tool-result-copy-${C}`,variant:`ghost`,size:`sm`,onClick:()=>i(C,T),children:t===C?(0,S.jsx)(vf,{className:`h-4 w-4`}):(0,S.jsx)(jf,{className:`h-4 w-4`})})]})]}),(()=>{let e=x.error||fIe(x.result);return e?(0,S.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:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:e})]}):(()=>{if(!f)return(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px]`,children:(0,S.jsx)(zq,{className:`size-5`})});switch(f){case`chatgpt-app`:{if(!L||!x.appsSdkResource)return(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`Apps SDK resource not available`})})});let e=x.appsSdkResource;return e.isLoading?(0,S.jsx)(`div`,{className:`flex items-center justify-center w-full h-[200px]`,children:(0,S.jsx)(zq,{className:`size-5`})}):e.error?(0,S.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:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Resource Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:e.error})]}):(0,S.jsx)(`div`,{className:`flex-1`,children:(0,S.jsx)(W7,{componentUrl:e.uri,toolName:x.toolName,toolArgs:E,toolResult:D,serverId:n,readResource:O,className:`w-full h-full relative p-4`,invoking:x.toolMeta?.[`openai/toolInvocation/invoking`],invoked:x.toolMeta?.[`openai/toolInvocation/invoked`]},`openai-${x.timestamp}`)})}case`mcp-apps`:return!F||!P?(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`MCP Apps resource not available`})})}):(0,S.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-30 flex items-center gap-2`,children:(0,S.jsx)(U7,{toolCallId:`tool-${x.timestamp}`,displayMode:m,onDisplayModeChange:h,propsContext:`tool`,resourceUri:P,toolInput:x.args,resourceAnnotations:x.toolMeta,llmConfig:null,resource:null,onPropsChange:_})}),(0,S.jsx)(N7,{serverId:n,invoking:x.toolMeta?.[`openai/toolInvocation/invoking`],invoked:x.toolMeta?.[`openai/toolInvocation/invoked`],toolCallId:`tool-${x.timestamp}`,toolName:x.toolName,toolInput:E,toolOutput:D,toolMetadata:x.toolMeta,resourceUri:P,readResource:O,className:`w-full h-full relative p-4`,customProps:g||void 0,displayMode:m,onDisplayModeChange:h,onSendFollowUp:k,onRerun:s},`mcp-apps-${x.timestamp}`)]});case`mcp-ui`:return re?(0,S.jsxs)(`div`,{className:`space-y-0 h-full`,children:[ne.map((e,t)=>(0,S.jsx)(`div`,{className:`mx-0 size-full`,children:(0,S.jsx)(VFe,{resource:e.resource,onUIAction:e=>{},className:`w-full h-full relative`})},t)),te.filter(e=>!(e.type===`resource`&&F9(e.resource))).length>0&&(0,S.jsx)(`div`,{className:`px-4`,children:(0,S.jsx)(RV,{data:te.filter(e=>!(e.type===`resource`&&F9(e.resource))),filename:`tool-result-${x.toolName}-non-ui-${Date.now()}.json`})})]}):(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:(0,S.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:`MCP-UI resource not available`})})});case`json`:if(B&&u){let e=x.result?.structuredContent;return(0,S.jsxs)(`div`,{className:`px-4 pt-4 space-y-4`,"data-testid":`tool-execution-results-content`,children:[e&&(0,S.jsxs)(`div`,{className:`space-y-2`,"data-testid":`tool-execution-results-structured-content`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400`,children:`Structured Content`}),(0,S.jsx)(RV,{data:e,filename:`structured-content-${x.toolName}-${Date.now()}.json`})]}),te&&te.length>0&&(0,S.jsx)(mIe,{content:te}),!e&&(!te||te.length===0)&&(0,S.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-gray-400`,"data-testid":`tool-execution-results-no-content`,children:`No content to display`})]})}return(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(RV,{data:x.result,filename:`tool-result-${x.toolName}-${Date.now()}.json`})});default:return null}})()})()]})}),R&&(f===`chatgpt-app`||f===`mcp-apps`||f===`mcp-ui`)&&(0,S.jsx)(`div`,{className:`absolute bottom-0 left-1/2 -translate-x-1/2 z-40 pointer-events-none`,children:(0,S.jsx)(`span`,{className:`text-[11px] bg-gray-200 dark:bg-zinc-800 text-gray-500 dark:text-gray-400 px-3 py-0.5 rounded-t-xl font-mono max-w-[320px] truncate block`,children:R})})]})}function gIe({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:r}){if(e.length===0)return(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Pp,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No tools available`})]});let i=e.some(e=>e.inputSchema?.properties&&Object.keys(e.inputSchema.properties).length>0);return(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e._meta,s=CQ(o,void 0),c=e.inputSchema?.properties,l=c?Object.keys(c).length:0,u=i&&l>0&&(0,S.jsxs)(kt,{variant:`outline`,className:`text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400`,children:[l,` params`]}),d=s===`mcp-apps`||s===`chatgpt-app`||s===`both`||u?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(s===`mcp-apps`||s===`both`)&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(rTe,{className:`h-3.5 w-3.5`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`MCP-APP`})})]}),(s===`chatgpt-app`||s===`both`)&&(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`span`,{className:`inline-flex`,children:(0,S.jsx)(iTe,{className:`h-3.5 w-3.5`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Apps SDK`})})]}),u]}):void 0;return(0,S.jsx)(M9,{id:`tool-${e.name}`,"data-testid":`tool-item-${e.name}`,isSelected:t?.name===e.name,isFocused:r===a,icon:(0,S.jsx)(Pp,{className:`h-4 w-4`}),title:e.name,description:e.description,metadata:d,onClick:()=>n(e)},e.name)})})}function _Ie({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:r,savedRequestsCount:i,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d}){return(0,S.jsx)(TFe,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:`tools`,secondaryTabName:`saved`,primaryTabTitle:`Tools`,secondaryTabTitle:`Saved`,primaryCount:r,secondaryCount:i,primaryIcon:Pp,secondaryIcon:Mf,searchPlaceholder:`Search tools...`,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d})}var vIe=`AlertDialog`,[yIe,bIe]=Nt(vIe,[UM]),z9=UM(),xIe=e=>{let{__scopeAlertDialog:t,...n}=e,r=z9(t);return(0,S.jsx)(dN,{...r,...n,modal:!0})};xIe.displayName=vIe;var SIe=`AlertDialogTrigger`,CIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(fN,{...i,...r,ref:t})});CIe.displayName=SIe;var wIe=`AlertDialogPortal`,TIe=e=>{let{__scopeAlertDialog:t,...n}=e,r=z9(t);return(0,S.jsx)(pN,{...r,...n})};TIe.displayName=wIe;var EIe=`AlertDialogOverlay`,DIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(mN,{...i,...r,ref:t})});DIe.displayName=EIe;var B9=`AlertDialogContent`,[OIe,kIe]=yIe(B9),AIe=Wt(`AlertDialogContent`),jIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=z9(n),o=w.useRef(null),s=D(t,o),c=w.useRef(null);return(0,S.jsx)(She,{contentName:B9,titleName:MIe,docsSlug:`alert-dialog`,children:(0,S.jsx)(OIe,{scope:n,cancelRef:c,children:(0,S.jsxs)(hN,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:jt(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,S.jsx)(AIe,{children:r}),(0,S.jsx)(BIe,{contentRef:o})]})})})});jIe.displayName=B9;var MIe=`AlertDialogTitle`,NIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(gN,{...i,...r,ref:t})});NIe.displayName=MIe;var PIe=`AlertDialogDescription`,FIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(_N,{...i,...r,ref:t})});FIe.displayName=PIe;var IIe=`AlertDialogAction`,LIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=z9(n);return(0,S.jsx)(vN,{...i,...r,ref:t})});LIe.displayName=IIe;var RIe=`AlertDialogCancel`,zIe=w.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=kIe(RIe,n),a=z9(n),o=D(t,i);return(0,S.jsx)(vN,{...a,...r,ref:o})});zIe.displayName=RIe;var BIe=({contentRef:e})=>{let t=`\`${B9}\` requires a description for the component to be accessible for screen reader users.
|
|
828
828
|
|
|
829
829
|
You can add a description to the \`${B9}\` by passing a \`${PIe}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
830
830
|
|
|
@@ -844,4 +844,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
844
844
|
<pre>${JSON.stringify(t.result,null,2)}</pre>
|
|
845
845
|
</body>
|
|
846
846
|
</html>
|
|
847
|
-
`),e.document.close())}},[x]),Fe=(0,w.useCallback)(()=>{l&&(ne(``),ee(!0))},[l]),Ie=(0,w.useCallback)(()=>{if(!l)return;let e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:ke,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};ve([...F,e]),ef.getInstance().capture(new Vd({toolName:l.name,serverId:i})).catch(()=>{}),ee(!1),ne(``)},[l,te,ke,F,ve,i]),Le=(0,w.useCallback)(e=>{ve(F.filter(t=>t.id!==e)),d?.id===e&&f(null)},[F,ve,d]);return ae?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[se!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{se===`response`?ce(`detail`):(u(null),ce(`list`))},className:`p-0 h-8 w-8`,children:(0,S.jsx)(bf,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),ce(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Tools`}),se===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`button`,{onClick:()=>{ce(`response`)},className:se===`detail`?`text-foreground hover:underline`:se===`response`?`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`:`text-muted-foreground`,children:`Execute`})]}),se===`response`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Response`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(JK,{initial:!1,mode:`popLayout`,children:[se===`list`&&(0,S.jsxs)(Lq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(_Ie,{activeTab:N,isSearchExpanded:re,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>R(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(gIe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:z}):(0,S.jsx)($Fe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:z})]},`list`),se===`detail`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-10`,children:(0,S.jsx)(uIe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})},`detail`),se===`response`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-20`,children:(0,S.jsx)(hIe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onRerunTool:Ae})},`response`)]})}),(0,S.jsx)(eIe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)(YIe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(QIe,{children:[(0,S.jsxs)($Ie,{children:[(0,S.jsx)(tLe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(nLe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(eLe,{children:[(0,S.jsx)(iLe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(rLe,{onClick:De,children:`Auto-fill`})]})]})})]}):(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{id:`left-panel`,defaultSize:`33%`,minSize:`20%`,collapsible:!0,className:`flex flex-col h-full relative`,panelRef:he,children:(0,S.jsxs)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(k9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(_Ie,{activeTab:N,isSearchExpanded:re,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>R(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(gIe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:z}):(0,S.jsx)($Fe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:z})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(P9,{serverId:i})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`67%`,children:(0,S.jsxs)(O9,{orientation:`vertical`,children:[(0,S.jsx)(k9,{defaultSize:`40%`,collapsible:!0,panelRef:ge,children:(0,S.jsx)(uIe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onCancel:()=>{k&&k.abort()},onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`60%`,children:(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(hIe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onMaximize:_e,isMaximized:le,onRerunTool:Ae})})})]})}),(0,S.jsx)(eIe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)(YIe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(QIe,{children:[(0,S.jsxs)($Ie,{children:[(0,S.jsx)(tLe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(nLe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(eLe,{children:[(0,S.jsx)(iLe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(rLe,{onClick:De,children:`Auto-fill`})]})]})})]})}oLe.displayName=`ToolsTab`;function sLe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,children:a}){let{embeddedConfig:o}=Uq();if(!e&&o.forceConnected)return o.chatApiUrl?(0,S.jsx)(aPe,{connection:{id:`force-connected`,url:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!0,hideServerUrl:o.chatHideServerUrl??!0,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`):(0,S.jsx)(S.Fragment,{children:a});if(!e)return(0,S.jsx)(S.Fragment,{children:a});let s=e=>o.visibleTabs?o.visibleTabs.includes(e):!0;return(0,S.jsxs)(S.Fragment,{children:[s(`tools`)&&(0,S.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(oLe,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,refreshTools:e.refreshTools},`tools-${e.id}`)}),s(`prompts`)&&(0,S.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(BFe,{ref:r,prompts:e.prompts,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),serverId:e.id,isConnected:e.state===`ready`,refreshPrompts:e.refreshPrompts},`prompts-${e.id}`)}),s(`resources`)&&(0,S.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(qFe,{ref:i,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url||``,refreshResources:e.refreshResources},`resources-${e.id}`)}),s(`chat`)&&(0,S.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(aPe,{connection:e,isConnected:o.forceConnected||e.state===`ready`,prompts:e.prompts,serverId:e.id,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),readResource:e.readResource,useClientSide:!o.chatApiUrl,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??(o.chatApiUrl?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0),enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!!o.chatApiUrl,hideServerUrl:o.chatHideServerUrl??!!o.chatApiUrl,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,streamProtocol:o.chatStreamProtocol,credentials:o.chatCredentials},`chat-${e.id}`)}),s(`sampling`)&&(0,S.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(QFe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url},`sampling-${e.id}`)}),s(`elicitation`)&&(0,S.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(bFe,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),s(`notifications`)&&(0,S.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(wFe,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state===`ready`},`notifications-${e.id}`)}),![`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(t)&&(0,S.jsx)(S.Fragment,{children:a})]})}function cLe({className:e}){return(0,S.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentcolor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[(0,S.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,S.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var lLe=w.createContext(void 0);function uLe(){let e=w.use(lLe);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var dLe=w.createContext(void 0);function fLe(){return w.use(dLe)}function V9({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=w.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=w.useState(!1),h=w.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,S.jsx)(lLe,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:w.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,S.jsx)(`div`,{ref:e,className:H(`flex flex-col gap-2`,a),...c,children:t})})}V9.displayName=`Tabs`;function H9({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=uLe(),[l,u]=w.useState({width:0,left:0}),d=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useCallback(()=>{let e=d.current;if(!e)return;let t=e.querySelector(`div:first-child`);if(!t)return;let n=t.querySelector(`button[data-tab-value="${o}"]`);if(n&&o){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();u({width:r.width,left:r.left-e.left})}else u({width:0,left:0})},[o]),h=w.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);w.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),w.useEffect(()=>{let e=d.current;if(!e)return;f.current=new ResizeObserver(()=>{h()}),f.current.observe(e);let t=e.querySelector(`div:first-child`);return t&&t.querySelectorAll(`button[data-tab-value]`).forEach(e=>{f.current&&f.current.observe(e)}),()=>{f.current&&f.current.disconnect(),p.current&&clearTimeout(p.current)}},[h]),w.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=w.useRef(null);return w.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,S.jsx)(dLe,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,S.jsx)(`div`,{ref:d,className:H(`relative flex items-center bg-none gap-1`,r===`default`&&`p-1 rounded-full border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`border-b border-zinc-200 dark:border-zinc-700`,n),...a,children:(0,S.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,S.jsx)(`span`,{ref:g,className:H(`absolute transition-all duration-[250ms] ease-in-out z-0`,r===`default`&&`bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`bottom-0 h-0.5 bg-black dark:bg-white`)})]})})})}H9.displayName=`TabsList`;var pLe=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,S.jsx)(Od,{children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{children:e}),(0,S.jsx)(jd,{children:t})]})}),U9=w.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,badge:c,...l},u)=>{let{activeValue:d,handleValueChange:f,collapsed:p}=uLe(),m=fLe()?.variant||`default`,h=d===t,g=!p||h||s;return(0,S.jsx)(pLe,{title:a,collapsed:p&&!g,children:(0,S.jsxs)(`button`,{ref:u,disabled:r,onClick:()=>f(t),"data-tab-value":t,"data-tab-active":h,role:`tab`,"aria-selected":h?`true`:`false`,title:p&&!g&&a?a:void 0,className:H(`relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-[250ms] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,m===`default`&&`py-2.5`,m===`default`&&`rounded-md px-4`,m===`underline`&&`px-6 py-3 border-b-2 border-transparent`,h&&`text-foreground`,!h&&`text-muted-foreground hover:text-foreground`,n),...l,children:[i&&(0,S.jsx)(i,{className:H(`h-4 w-4 shrink-0 transition-all duration-[250ms] ease-in-out`,g&&`mr-2`,!g&&`mr-0!`)}),o&&(0,S.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2 h-2 bg-orange-500 dark:bg-orange-400 border-2 border-white dark:border-zinc-900 rounded-full transition-opacity duration-300 z-10 animate-status-pulse-orange`}),(0,S.jsx)(`span`,{className:H(`min-w-0 transition-all duration-[250ms] ease-in-out overflow-hidden`,g?`w-auto opacity-100`:`w-0 opacity-0`),children:e}),c]})})});U9.displayName=`TabsTrigger`;function mLe(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return(0,S.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=w.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>w.createContext(e));return function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,hLe(i,...t)]}function hLe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var gLe=i((e=>{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),_Le=i(((e,t)=>{t.exports=gLe()}))();function vLe(){return(0,_Le.useSyncExternalStore)(yLe,()=>!0,()=>!1)}function yLe(){return()=>{}}var W9=`Avatar`,[bLe,xLe]=mLe(W9),[SLe,CLe]=bLe(W9),wLe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=w.useState(`idle`);return(0,S.jsx)(SLe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,S.jsx)(EN.span,{...r,ref:t})})});wLe.displayName=W9;var TLe=`AvatarImage`,ELe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=CLe(TLe,n),s=ALe(r,a),c=$t(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ft(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,S.jsx)(EN.img,{...a,ref:t,src:r}):null});ELe.displayName=TLe;var DLe=`AvatarFallback`,OLe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=CLe(DLe,n),[o,s]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,S.jsx)(EN.span,{...i,ref:t}):null});OLe.displayName=DLe;function kLe(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function ALe(e,{referrerPolicy:t,crossOrigin:n}){let r=vLe(),i=w.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=w.useState(()=>kLe(a,e));return Ft(()=>{s(kLe(a,e))},[a,e]),Ft(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var jLe=wLe,MLe=ELe,NLe=OLe;function PLe({className:e,...t}){return(0,S.jsx)(jLe,{"data-slot":`avatar`,className:H(`relative flex size-8 shrink-0 overflow-hidden rounded-full`,e),...t})}function FLe({className:e,...t}){return(0,S.jsx)(MLe,{"data-slot":`avatar-image`,className:H(`aspect-square size-full`,e),...t})}function ILe({className:e,...t}){return(0,S.jsx)(NLe,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center rounded-full bg-zinc-200 dark:bg-zinc-700 text-muted-foreground font-medium`,e),...t})}function LLe(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function RLe({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useCallback)(()=>{let t=!1,n=`${new URL(e).origin}/api/auth/get-session`;return fetch(n,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!t){let t=e?.user??null;a(t),s(!0),r?.(t)}}).catch(()=>{t||(s(!0),r?.(null))}),()=>{t=!0}},[e]);if((0,w.useEffect)(()=>c(),[c]),(0,w.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`manufact:session-changed`,e),()=>window.removeEventListener(`manufact:session-changed`,e)},[c]),!o)return null;if(!i)return(0,S.jsx)(S.Fragment,{children:n});let l=LLe(i.name,i.email),u=i.name??i.email??`User`;return(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,S.jsxs)(PLe,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,S.jsx)(FLe,{src:i.image??``,alt:u}),(0,S.jsx)(ILe,{className:`text-sm`,children:l})]})})}),(0,S.jsxs)($l,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,S.jsx)(nu,{className:`font-normal`,children:(0,S.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:u}),i.email&&i.email!==u&&(0,S.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:i.email})]})}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Xf,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})})]})]})}function zLe({count:e,isActive:t,size:n=`md`}){return e<=0?null:(0,S.jsx)(`span`,{className:H(t?`dark:bg-black`:`dark:bg-zinc-700`,`shrink-0 ml-1 bg-zinc-200 text-zinc-700 dark:text-zinc-300 rounded-full font-medium`,n===`sm`&&`text-[10px] px-1.5 py-0.5`,n===`md`&&`text-xs px-2 py-0.5`),children:e})}function BLe({serverConfig:e,additionalItems:t=[],showClients:n={cursor:!0,vsCode:!0,vsCodeInsiders:!0,claudeDesktop:!0,claudeCode:!0,geminiCli:!0,codexCli:!0},className:r=``,onSuccess:i,onError:a,trigger:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{ef.getInstance().capture(new Kd({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=bJ(p,m,h);window.location.href=e,i?.(`Cursor`)}catch(e){console.error(`Failed to generate Cursor deep link:`,e),a?.(e)}},v=()=>{g(`vscode`);try{let e=xJ(p,m,h);window.location.href=e,i?.(`VS Code`)}catch(e){console.error(`Failed to generate VS Code deep link:`,e),a?.(e)}},y=()=>{g(`vscode-insiders`);try{let e=SJ(p,m,h);window.location.href=e,i?.(`VS Code Insiders`)}catch(e){console.error(`Failed to generate VS Code Insiders deep link:`,e),a?.(e)}},b=()=>{g(`claude-desktop`);try{CJ(p,m,h),i?.(`Claude Desktop`)}catch(e){console.error(`Failed to download .mcpb file:`,e),a?.(e)}},x=()=>{g(`claude-code`),u(`claude-code`),c(!0)},C=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},T=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},E=async e=>{try{await dj(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},D=()=>{if(l===`claude-code`){let{command:e,envVars:t}=wJ(p,m,h),n=DJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Claude Code`}),(0,S.jsx)(wN,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,S.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=TJ(p,m,h),n=DJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Gemini CLI`}),(0,S.jsx)(wN,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Gemini CLI to load the new configuration.`})]})]})}if(l===`codex-cli`){let{config:e,envVars:t}=EJ(p,m,h);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Codex CLI`}),(0,S.jsxs)(wN,{children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),t.length>0&&(0,S.jsx)(`div`,{children:(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},O=(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center ${r}`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:O}),(0,S.jsxs)($l,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,S.jsxs)(eu,{onClick:async()=>{await e.onClick()},className:`flex items-center gap-2`,children:[e.icon,(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,S.jsx)(ru,{}),n.cursor&&(0,S.jsxs)(eu,{onClick:_,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,S.jsxs)(eu,{onClick:x,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,S.jsxs)(eu,{onClick:b,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,S.jsxs)(eu,{onClick:v,className:`flex items-center gap-2`,children:[(0,S.jsx)(OJ,{className:`h-4 w-4 text-blue-500`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,S.jsxs)(eu,{onClick:y,className:`flex items-center gap-2`,children:[(0,S.jsx)(OJ,{className:`h-4 w-4 text-teal-400`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,S.jsxs)(eu,{onClick:C,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,S.jsxs)(eu,{onClick:T,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,S.jsx)(yN,{open:s,onOpenChange:c,children:(0,S.jsx)(xN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:D()})})]})}function G9({className:e,state:t=`collapsed`,href:n=`https://mcp-use.com`}){let[r,i]=(0,w.useState)(!1),a=.2,o=.7,s=a+o+.6,c=a/s,l=(a+o)/s;return(0,S.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:H(`flex items-center transition-opacity -my-3`,t===`expanded`?`space-x-2`:``,e),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Lq.svg,{viewBox:`0 0 303 303`,initial:`rest`,animate:r?`hover`:`rest`,className:H(`text-foreground`,t===`expanded`?`size-[40px]`:`size-[20px]`),children:[(0,S.jsxs)(Lq.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:s,times:[0,c,l,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`path`,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`}),(0,S.jsx)(`circle`,{cx:`70.3`,cy:`232.3`,r:`50`}),(0,S.jsx)(`circle`,{cx:`232.3`,cy:`70.3`,r:`50`})]}),(0,S.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(VLe,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(HLe,{cx:70.3,cy:232.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(HLe,{cx:232.3,cy:70.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s})]})]})}),t===`expanded`&&(0,S.jsxs)(`div`,{className:`font-ubuntu flex-col items-start -space-y-1 mr-3 hidden xl:flex`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-medium`,children:`mcp-use`}),(0,S.jsx)(`span`,{className:`text-lg text-muted-foreground tracking-wide font-sans font-light`,children:`Inspector`})]})]})}function VLe({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,S.jsx)(Lq.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,i,a,o],ease:`easeInOut`}}}})}function HLe({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,S.jsx)(Lq.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:i,times:[a,o,s,c],ease:`easeInOut`}}}})}function K9({open:e,onOpenChange:t,serverUrl:n,serverName:r,serverId:i,headers:a,language:o}){let{prismStyle:s}=LP(),[c,l]=(0,w.useState)(!1),u=o===`typescript`?eTe(n,r,i,a):tTe(n,r,i,a),d=async()=>{await dj(u),l(!0),setTimeout(()=>l(!1),2e3)},f=o===`typescript`?`TypeScript`:`Python`;return(0,S.jsx)(yN,{open:e,onOpenChange:t,children:(0,S.jsxs)(xN,{className:`max-w-[90vw] max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(SN,{children:[(0,S.jsxs)(CN,{children:[`Add to `,f,` SDK`]}),(0,S.jsxs)(wN,{children:[`Copy the following code to integrate this server into your`,` `,f,` application using the mcp-use SDK.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 min-h-0`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Install the mcp-use package:`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:o===`typescript`?`npm install mcp-use`:`pip install mcp-use`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`Copy the following code into your `,f,` project:`]})]})]})]}),(0,S.jsxs)(`div`,{className:`relative w-full overflow-x-auto overflow-y-auto max-h-[60vh]`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:d,children:c?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(LV,{language:o,style:s,customStyle:{margin:0,padding:`1rem`,paddingRight:`3rem`,borderRadius:`0.5rem`,fontSize:`0.75rem`,background:`var(--muted)`,width:`100%`,maxWidth:`100%`,overflow:`auto`},wrapLines:!0,wrapLongLines:!0,PreTag:`div`,children:u})]})]})]})})}function ULe({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=FP();return(0,S.jsxs)(`button`,{style:{"--spread":`90deg`,"--shimmer-color":t||(l===`dark`?`#000000`:`#ffffff`),"--radius":i,"--speed":r,"--cut":n,"--bg":a||(l===`dark`?`rgba(255, 255, 255, 1)`:`rgba(0, 0, 0, 1)`)},className:H(`group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]`,`transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px`,`dark:text-white text-black dark:border-white/10 border-black/10`,o),ref:e,...c,children:[(0,S.jsx)(`div`,{className:H(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,S.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,S.jsx)(`div`,{className:`animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]`})})}),s,(0,S.jsx)(`div`,{className:H(`absolute inset-0 size-full`,`rounded-2xl px-4 py-1.5 text-sm font-medium`,`transform-gpu transition-all duration-300 ease-in-out`,`dark:shadow-[inset_0_-8px_10px_#0000001f] dark:group-hover:shadow-[inset_0_-6px_10px_#0000003f] dark:group-active:shadow-[inset_0_-10px_10px_#0000003f] shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]`)}),(0,S.jsx)(`div`,{className:H(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}ULe.displayName=`ShimmerButton`;function WLe({status:e}){let{color:t,ringColor:n,tooltip:r}=(e=>{switch(e){case`ready`:return{color:`bg-emerald-500`,ringColor:`ring-emerald-500`,tooltip:`Connected`};case`failed`:return{color:`bg-red-500`,ringColor:`ring-red-500`,tooltip:`Failed`};default:return{color:`bg-yellow-500`,ringColor:`ring-yellow-500`,tooltip:e}}})(e);return(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),(0,S.jsx)(`div`,{className:`relative w-2 h-2 rounded-full ${t}`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:r})})]})}function GLe({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:i=!1}){let a=Zj(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=t=>{let r=e.find(e=>e.id===t);if(!r||r.state!==`ready`){PM.error(`Server is not connected and cannot be inspected`);return}n(t)};return i?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsxs)(U,{variant:`ghost`,className:`h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5`,children:[t?(0,S.jsx)(Bq,{server:t,size:`md`}):(0,S.jsx)(_p,{className:`h-5 w-5`}),(0,S.jsx)(yf,{className:`h-4 w-4`})]})}),(0,S.jsxs)($l,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(nu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(ru,{}),e.length===0?(0,S.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,S.jsxs)(eu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Bq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:_j(e)}),(0,S.jsx)(WLe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(Jf,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(vp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]})}),(0,S.jsx)(zV,{open:o,onOpenChange:s,connection:c})]}):(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsxs)(ULe,{className:H(`min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200`,!t&&`pl-4`,t&&`pr-20`),children:[t&&(0,S.jsx)(Bq,{server:t,size:`md`,className:`mr-2`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?_j(t):`Select server to inspect`}),t&&(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:e=>{e.stopPropagation()},className:`w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]})}),t&&(0,S.jsxs)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{l(t),s(!0)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`View server info`,children:(0,S.jsx)(Jf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{r(t.id)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`Edit connection settings`,children:(0,S.jsx)(vp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]})]}),(0,S.jsxs)($l,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(nu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(ru,{}),e.length===0?(0,S.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,S.jsxs)(eu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Bq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:_j(e)}),(0,S.jsx)(WLe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(Jf,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(vp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]}),(0,S.jsx)(zV,{open:o,onOpenChange:s,connection:c})]})})}var KLe=[{id:`chat`,label:`Chat`,icon:ep,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Pp},{id:`prompts`,label:`Prompts`,icon:tp},{id:`resources`,label:`Resources`,icon:Hf},{id:`sampling`,label:`Sampling`,icon:Gf},{id:`elicitation`,label:`Elicitation`,icon:wp},{id:`notifications`,label:`Notifications`,icon:pf}];function qLe(e,t){return e===`tools`?t.tools.length:e===`prompts`?t.prompts.length:e===`resources`?t.resources.length:e===`sampling`?t.pendingSamplingRequests?.length||0:e===`elicitation`?t.pendingElicitationRequests?.length||0:e===`notifications`?t.unreadNotificationCount:0}function JLe(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}function YLe({collapsed:e,onToggle:t}){return(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:t,className:H(`shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer`,`text-muted-foreground hover:text-foreground`,`hover:bg-zinc-100 dark:hover:bg-zinc-800`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),"aria-label":e?`Expand tabs`:`Collapse tabs`,type:`button`,children:e?(0,S.jsx)(xf,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`}):(0,S.jsx)(bf,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:e?`Expand tabs`:`Collapse tabs`})})]})}function XLe(e){try{let t=new URL(e).hostname.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`0.0.0.0`}catch{return!1}}function ZLe(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function QLe(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}var q9={starting:`Starting tunnel…`,stopping:`Stopping tunnel…`,reconnecting:`Reconnecting…`};function $Le({tunnelUrl:e,isTunnelStarting:t,setTunnelUrl:n,setIsTunnelStarting:r,copied:i,setCopied:a,handleCopy:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(q9.starting);(0,w.useEffect)(()=>{if(!t){f(20);return}f(20);let e=setInterval(()=>f(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[t]),(0,w.useEffect)(()=>{if(!e)return;c(!0);let t=new URLSearchParams(window.location.search);if(t.has(`openTunnelPopover`)){t.delete(`openTunnelPopover`);let e=t.toString();window.history.replaceState({},``,`${window.location.pathname}${e?`?${e}`:``}`)}},[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/inspector/api/dev/info`);if(!t.ok||e)return;let r=await t.json();if(e)return;if(u(!!r.fromCli),r.tunnelUrl)n(new URL(r.tunnelUrl).origin);else{let e=QLe(r.mcpUrl??null);e&&n(e)}}catch{e||u(!1)}})(),()=>{e=!0}},[n]);let h=async e=>{let t=window.location.port||`3000`,i=`http://localhost:${t}/inspector/api/dev/info`,a=Date.now()+9e4;for(m(e?`Restarting with tunnel…`:`Restarting…`),await new Promise(e=>setTimeout(e,1500));Date.now()<a;){try{let r=await fetch(i,{cache:`no-store`});if(r.ok){let i=await r.json();if(!!i.tunnelUrl===e){let r=(i.tunnelUrl||i.mcpUrl||`http://localhost:${t}`).replace(/\/+$/,``)+`/mcp`;i.tunnelUrl?n(new URL(i.tunnelUrl).origin):n(null),sessionStorage.setItem(zM,JSON.stringify({url:r,name:`Local MCP Server`,transportType:`http`,connectionType:`Direct`})),PM.success(e?`Tunnel ready — reconnecting…`:`Tunnel stopped — reconnecting…`),m(q9.reconnecting);let a=new URL(window.location.href);a.searchParams.delete(`server`),a.searchParams.delete(`tunnelUrl`),a.searchParams.delete(`autoConnect`),e&&a.searchParams.set(`openTunnelPopover`,`1`),window.location.assign(a.toString());return}}}catch{}await new Promise(e=>setTimeout(e,1500))}PM.error(`Timeout waiting for server to restart`),r(!1)},g=async()=>{if(l===!1){PM.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}m(q9.starting),r(!0);let e=!1;try{let t=await fetch(`/inspector/api/dev/start-tunnel`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));PM.error(e.error||`Failed to start tunnel`),r(!1);return}await h(!0),e=!0}catch{PM.error(`Failed to start tunnel`),r(!1)}try{ef.getInstance().capture(new Hd({action:`start`,success:e})).catch(()=>{})}catch{}},_=async()=>{m(q9.stopping),r(!0);let t=!1;try{let e=await fetch(`/inspector/api/dev/stop-tunnel`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));PM.error(t.error||`Failed to stop tunnel`),r(!1);return}a(!1),c(!1),await h(!1),t=!0}catch{PM.error(`Failed to stop tunnel`),r(!1)}try{ef.getInstance().capture(new Hd({action:`stop`,success:t,tunnelUrl:e})).catch(()=>{})}catch{}};if(t)return(0,S.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-2 h-9 px-3 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait`,children:[(0,S.jsx)(Zf,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}),(0,S.jsxs)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,S.jsxs)(`span`,{className:`tabular-nums`,children:[d,`s`]})]})]});if(!e){let e=l===!0,t=l===null;return(0,S.jsxs)(`button`,{type:`button`,onClick:g,disabled:!e||t,title:l===!1?"Run `mcp-use dev` from your project to enable tunneling.":t?`Checking dev server…`:void 0,className:H(`flex items-center gap-2 h-9 px-3 border rounded-full transition-colors`,e&&!t?`bg-violet-50 dark:bg-violet-950/40 border-violet-200 dark:border-violet-800 hover:bg-violet-100 dark:hover:bg-violet-900/50 cursor-pointer`:`bg-violet-50/60 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800 cursor-not-allowed opacity-70`),children:[t?(0,S.jsx)(Zf,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}):(0,S.jsx)(Cf,{className:`size-4 text-violet-500 dark:text-violet-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}return(0,S.jsxs)(QJ,{open:s,onOpenChange:c,children:[(0,S.jsx)($J,{asChild:!0,children:(0,S.jsxs)(`button`,{className:`flex items-center gap-2 h-9 px-3 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer`,children:[(0,S.jsx)(Cf,{className:`size-4 text-purple-600 dark:text-purple-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300 hidden lg:inline`,children:`Tunnel`})]})}),(0,S.jsx)(eY,{className:`w-[calc(100vw-2rem)] sm:w-96 overflow-hidden`,align:`end`,children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,S.jsxs)(`a`,{href:`https://manufact.com/docs/tunneling`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Docs`,(0,S.jsx)(ff,{className:`size-3`})]})]}),(0,S.jsxs)(`button`,{onClick:o,className:`-mx-4 px-4 py-3 bg-muted hover:bg-accent transition-colors cursor-pointer flex items-center gap-3 w-[calc(100%+2rem)]`,children:[(0,S.jsxs)(`code`,{className:`flex-1 text-[10px] font-mono truncate text-left`,children:[e,`/mcp`]}),i?(0,S.jsx)(vf,{className:`size-3.5 text-green-600 shrink-0`}):(0,S.jsx)(jf,{className:`size-3.5 shrink-0 text-muted-foreground`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Enable`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`dev mode`}),` `,`from settings`]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`In`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`App & Connectors`}),` `,`click on`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`create`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,S.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,S.jsxs)(`button`,{onClick:_,className:`flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors cursor-pointer`,children:[(0,S.jsx)(Dp,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})})]})}function eRe({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,onCommandPaletteOpen:a,onOpenConnectionOptions:o,embedded:s=!1}){let{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,embeddedConfig:f}=Uq(),{theme:p,setTheme:m}=FP(),h=!!t&&(XLe(t.url)||ZLe(t.url)||!!c),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!0),[E,D]=(0,w.useState)(!1);if(f.singleTab)return null;let O=f.visibleTabs?KLe.filter(e=>e.id===`separator`||f.visibleTabs.includes(e.id)):KLe,k=async()=>{if(c)try{await dj(`${c}/mcp`),_(!0),PM.success(`Tunnel URL copied to clipboard`),setTimeout(()=>_(!1),2e3)}catch{PM.error(`Failed to copy URL`)}};return(0,S.jsxs)(`header`,{className:`w-full mx-auto`,children:[(0,S.jsxs)(`div`,{className:`flex lg:hidden flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[!s&&(0,S.jsx)(`div`,{className:`flex-1 flex justify-start`,children:(0,S.jsx)(GLe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o,mobileMode:!0})}),!s&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex justify-center`,children:(0,S.jsx)(`div`,{className:`scale-150`,children:(0,S.jsx)(G9,{state:`collapsed`})})}),!s&&(0,S.jsxs)(`div`,{className:`flex-1 flex justify-end items-center gap-2`,children:[t&&(()=>{let e=_j(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(BLe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>PM.success(`Opening in ${e}...`),onError:e=>PM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center p-2`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]})}),(0,S.jsx)(K9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(K9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)($Le,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,size:`sm`,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-3`,children:(0,S.jsx)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{ef.getInstance().capture(new Ud({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:(0,S.jsx)(fp,{className:`size-4`})})}),(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)($l,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(Yl,{children:[(0,S.jsxs)(Zl,{children:[p===`light`?(0,S.jsx)(Op,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(ip,{className:`size-4 mr-2`}):(0,S.jsx)(rp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)(Ql,{children:(0,S.jsxs)(Xl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(tu,{value:`light`,children:[(0,S.jsx)(Op,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(tu,{value:`dark`,children:[(0,S.jsx)(ip,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(tu,{value:`system`,children:[(0,S.jsx)(rp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(cLe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(_f,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]})]})]}),t&&(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsx)(V9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(H9,{className:`w-full justify-center`,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=qLe(e.id,t),i=JLe(e.id,r,C);return(0,S.jsx)(U9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:i,badge:(0,S.jsx)(zLe,{count:r,isActive:n===e.id,size:`sm`}),alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 flex-1 flex-row gap-2 relative`,C&&`pl-2`),children:(0,S.jsx)(`span`,{className:`sr-only`,children:e.label})},e.id)})})})})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center flex-wrap gap-2 md:space-x-6 space-x-2`,children:[!s&&(0,S.jsx)(GLe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o}),t&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(V9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(H9,{className:`overflow-x-auto`,collapsible:!0,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=qLe(e.id,t),i=r>0?`${e.label} (${r})`:e.label,a=JLe(e.id,r,C);return(0,S.jsx)(U9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:a,badge:(0,S.jsx)(zLe,{count:r,isActive:n===e.id}),alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 lg:[&>svg]:mr-2 relative`,C&&`pl-4`),title:i,children:(0,S.jsx)(`span`,{className:`items-center gap-2 hidden lg:flex`,children:e.label})},e.id)})})}),(0,S.jsx)(YLe,{collapsed:C,onToggle:()=>T(!C)})]})]}),!s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-4 flex-shrink-0`,children:[t&&(()=>{let e=_j(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(BLe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>PM.success(`Opening in ${e}...`),onError:e=>PM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]})}),(0,S.jsx)(K9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(K9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)($Le,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-4`,children:(0,S.jsxs)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{ef.getInstance().capture(new Ud({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:[(0,S.jsx)(fp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Deploy`})]})}),(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)($l,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(eu,{onClick:a,"data-testid":`command-palette-trigger-button`,children:[(0,S.jsx)(Af,{className:`size-4 mr-2`}),`Command Palette`,(0,S.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`⌘`,`K`]})]}),(0,S.jsxs)(Yl,{children:[(0,S.jsxs)(Zl,{children:[p===`light`?(0,S.jsx)(Op,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(ip,{className:`size-4 mr-2`}):(0,S.jsx)(rp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)(Ql,{children:(0,S.jsxs)(Xl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(tu,{value:`light`,children:[(0,S.jsx)(Op,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(tu,{value:`dark`,children:[(0,S.jsx)(ip,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(tu,{value:`system`,children:[(0,S.jsx)(rp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(cLe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(_f,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]}),f.chatApiUrl?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(RLe,{chatApiUrl:f.chatApiUrl,onUserResolved:e=>D(!!e),fallback:(0,S.jsx)(`span`,{className:`[@media(min-width:1400px)]:hidden`,children:(0,S.jsx)(G9,{state:`expanded`})})}),(0,S.jsx)(`span`,{className:`hidden [@media(min-width:1400px)]:block`,children:(0,S.jsx)(G9,{state:`expanded`})})]}):(0,S.jsx)(G9,{state:`expanded`})]})]})]})}function tRe({children:e}){let t=Zj(),n=Jj(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=uj(),l=(0,w.useCallback)((e,t,n,r,a)=>{i(e,{url:e,name:t,proxyConfig:n,transportType:r,preventAutoAuth:!0,useRedirectFlow:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},...a?{oauth:a}:{}})},[i]),u=(0,w.useCallback)(async(e,t)=>{try{await s(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),d=(0,w.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:f,setSelectedServerId:p,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:_,tunnelUrl:v,isEmbedded:y,embeddedConfig:b,setEmbeddedMode:x}=Uq(),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),O=Owe();(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search),t=e.get(`embedded`)===`true`,r=e.get(`embeddedConfig`);if(t){let e={};if(r)try{e=JSON.parse(r)}catch(e){console.error(`Failed to parse embeddedConfig:`,e)}x(!0,e),e.defaultTab&&h(e.defaultTab)}},[]),(0,w.useEffect)(()=>{_(new URLSearchParams(n.search).get(`tunnelUrl`))},[n.search,_]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(e)&&h(e)},[n.search,h]);let k=(0,w.useRef)(null),A=(0,w.useRef)(Date.now()),j=(0,w.useRef)(new Set),M=(0,w.useRef)(0);(0,w.useEffect)(()=>{let e=()=>{M.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,w.useEffect)(()=>{let e=()=>{try{let e=Math.round((Date.now()-A.current)/1e3);ef.getInstance().capture(new qd({durationSeconds:e,tabsVisited:j.current.size,toolsExecuted:M.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let N=(0,w.useCallback)(e=>{try{ef.getInstance().capture(new Gd({tab:e,previousTab:k.current})).catch(()=>{})}catch{}k.current=e,j.current.add(e),h(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[h,t,n.search]);(0,w.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;f&&g(f,`sampling`,t)},t=e=>{let t=e.detail.requestId;f&&g(f,`elicitation`,t)},n=e=>{let t=e.detail.toolName;f&&t?g(f,`tools`,t):f&&N(`tools`)};return window.addEventListener(`navigate-to-sampling`,e),window.addEventListener(`navigate-to-elicitation`,t),window.addEventListener(`navigate-to-tool-result`,n),()=>{window.removeEventListener(`navigate-to-sampling`,e),window.removeEventListener(`navigate-to-elicitation`,t),window.removeEventListener(`navigate-to-tool-result`,n)}},[f,N,g]);let P=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null),{isAutoConnecting:L}=hhe({connections:r,addConnection:l,removeConnection:a,configLoaded:c,embedded:y}),ee=(0,w.useCallback)(e=>{ef.getInstance().capture(new Bd({trigger:e})).catch(()=>{}),T(!0)},[]),te=e=>{let i=r.find(t=>t.id===e);if(!i||i.state!==`ready`){PM.error(`Server is not connected and cannot be inspected`);return}p(e);let a=new URLSearchParams(n.search),o=a.get(`tunnelUrl`),s=a.get(`tab`),c=new URLSearchParams;c.set(`server`,e),o&&c.set(`tunnelUrl`,o),s&&c.set(`tab`,s),t(`/?${c.toString()}`)},ne=(0,w.useCallback)(e=>{D(e)},[]),re=(0,w.useCallback)(e=>{if(!E)return;let t=pj(E)||r.find(e=>e.id===E);e.url===E?t&&hj(t,e)?d(E,{name:e.name||e.url}):u(E,{name:e.name,proxyConfig:e.proxyConfig,transportType:e.transportType,oauth:e.oauth}):(a(E),l(e.url,e.name,e.proxyConfig,e.transportType,e.oauth)),D(null),PM.success(`Connection settings updated`)},[E,r,a,l,d,u]),R=(e,i,a)=>{if(console.warn(`[Layout] handleCommandPaletteNavigate called:`,{tab:e,itemName:i,serverId:a}),a){let o=r.find(e=>e.id===a);if(console.warn(`[Layout] Server lookup:`,{serverId:a,serverFound:!!o,serverState:o?.state}),!o||o.state!==`ready`){console.warn(`[Layout] Server not ready, showing error`),PM.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),g(a,e,i);let s=new URLSearchParams(n.search),c=s.get(`tunnelUrl`),l=s.get(`tab`),u=new URLSearchParams;u.set(`server`,a),c&&u.set(`tunnelUrl`,c),e?u.set(`tab`,e):l&&u.set(`tab`,l);let d=`/?${u.toString()}`;console.warn(`[Layout] Navigating to:`,d),t(d)}else console.warn(`[Layout] No serverId, just updating tab to:`,e),N(e)},z=r.find(e=>e.id===f),B=z?z.tools.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ie=z?z.prompts.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ae=z?z.resources.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]);(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search),i=e.get(`server`);if(i&&(i.startsWith(`http://`)||i.startsWith(`https://`))&&!r.find(e=>e.id===i)){let n=new URLSearchParams(e);n.delete(`server`),n.set(`autoConnect`,i),t(`/?${n.toString()}`,{replace:!0});return}i!==f&&p(i)},[n.search,f,p,r,t]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`server`);if(!e)return;let i=r.find(t=>t.id===e);if(!i){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}if(i.state===`failed`){let e=setTimeout(()=>t(`/`),2e3);return()=>clearTimeout(e)}},[n.search,t,r]),(0,w.useEffect)(()=>{if(!y)return;let e=e=>{if(!e.data||typeof e.data!=`object`||e.data.type!==`mcp-inspector:connect_servers`)return;let t=e.data.servers;if(!Array.isArray(t)||t.length===0)return;let n=null;for(let e of t){if(!e.url||typeof e.url!=`string`)continue;let t=e.url,i=e.name??`Server`,a=e.transportType??`http`,o={...e.headers??{}};if(e.auth?.access_token){let t=e.auth.token_type||`bearer`;o.Authorization=`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.auth.access_token}`}let s={proxyAddress:`${window.location.origin}/inspector/api/proxy`,...Object.keys(o).length>0&&{headers:o}};r.find(e=>e.url===t)||l(t,i,s,a),n||=t}window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:servers_connected`,count:t.length},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[y,r,l]);let oe=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{if(!y||oe.current||f)return;let e=r.find(e=>e.state===`ready`);if(e){oe.current=!0,p(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[y,r,f,p,t,n.search]),Wq({onCommandPalette:()=>ee(`keyboard`),onToolsTab:()=>{z&&N(`tools`)},onPromptsTab:()=>{z&&N(`prompts`)},onResourcesTab:()=>{z&&N(`resources`)},onChatTab:()=>{z&&N(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{m===`tools`&&P.current?P.current.focusSearch():m===`prompts`&&F.current?F.current.focusSearch():m===`resources`&&I.current&&I.current.focusSearch()},onBlurSearch:()=>{m===`tools`&&P.current?P.current.blurSearch():m===`prompts`&&F.current?F.current.blurSearch():m===`resources`&&I.current&&I.current.blurSearch()}}),L)return(0,S.jsx)(`div`,{className:`h-screen bg-white dark:bg-zinc-900 flex items-center justify-center`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(zq,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})});let se=y&&b.singleTab,ce=y?{backgroundColor:b.backgroundColor||`#f3f3f3`,padding:se?`0`:b.padding||`0.5rem`}:{};return(0,S.jsx)(Od,{children:(0,S.jsxs)(`div`,{className:y?se?`h-screen flex flex-col`:`h-screen flex flex-col gap-2 sm:gap-4`:`h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4`,style:ce,children:[!se&&(0,S.jsx)(eRe,{connections:r,selectedServer:z,activeTab:m,onServerSelect:te,onTabChange:N,onCommandPaletteOpen:()=>ee(`button`),onOpenConnectionOptions:ne,embedded:y}),(0,S.jsx)(`main`,{className:se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:`flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto`,children:(0,S.jsx)(sLe,{selectedServer:z,activeTab:m,toolsSearchRef:P,promptsSearchRef:F,resourcesSearchRef:I,children:e})}),(0,S.jsx)(oTe,{isOpen:C,onOpenChange:T,tools:B,prompts:ie,resources:ae,savedRequests:O,connections:r,selectedServer:z,tunnelUrl:v,onNavigate:R,onServerSelect:te}),(0,S.jsx)(BV,{connection:E&&r.find(e=>e.id===E)||null,open:E!==null,onOpenChange:e=>{e||D(null)},onConnect:re})]})})}function J9(e){let t=a(()=>{throw Error(`Invalid url to pass to open(): ${e}`)},`abort`),n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(nRe).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}a(J9,`sanitizeUrl`);function nRe([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}a(nRe,`sanitizeParam`);var rRe=class e{static{a(this,`OAuthSessionStore`)}serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;scope;store;_cachedAuthServerUrl=null;_cachedMetadata=null;_refreshPromise=null;constructor(t,n,r){this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=e.hashString(t),this.clientName=n.clientName||`mcp-use`,this.clientUri=n.clientUri||(typeof window<`u`?window.location.origin:``),this.logoUri=n.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=J9(n.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.scope=n.scope,this.store=r}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}static hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri,...this.scope?{scope:this.scope}:{}}}async tokens(){let e=this.getKey(`tokens`),t=await this.store.get(e);if(t)try{let e=JSON.parse(t);if(e.access_token&&e.refresh_token)try{let t=JSON.parse(atob(e.access_token.split(`.`)[1]));if(t.exp&&Date.now()>=(t.exp-30)*1e3){console.log(`[tokens] Access token expiring soon, refreshing...`);let t=await this._dedupedRefresh(e);if(t)return console.log(`[tokens] Refreshed successfully`),t}}catch{}return e}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),await this.store.remove(e);return}}async saveTokens(e){await this.store.set(this.getKey(`tokens`),JSON.stringify(e)),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`))}async clientInformation(){let e=this.getKey(`client_info`),t=await this.store.get(e);if(t)try{let n=JSON.parse(t),r=Array.isArray(n.redirect_uris)?n.redirect_uris:[];if(!(r.length===0||r.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),await this.store.remove(e),await this.store.remove(this.getKey(`tokens`)),await this.store.remove(this.getKey(`last_auth_url`));return}return n}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),await this.store.remove(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);await this.store.set(t,JSON.stringify(e))}async saveCodeVerifier(e){await this.store.set(this.getKey(`code_verifier`),e)}async codeVerifier(){let e=this.getKey(`code_verifier`),t=await this.store.get(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async invalidateCredentials(e){switch(e){case`all`:await this.store.remove(this.getKey(`tokens`)),await this.store.remove(this.getKey(`client_info`)),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`));break;case`client`:await this.store.remove(this.getKey(`client_info`));break;case`tokens`:await this.store.remove(this.getKey(`tokens`));break;case`verifier`:await this.store.remove(this.getKey(`code_verifier`));break;default:break}}async storeAuthorizationState(e,t={}){let n=globalThis.crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${n}`,i=await this.store.get(this.getKey(`code_verifier`)),a={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,codeVerifier:i||void 0,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,...t.extraProviderOptions??{}},flowType:t.flowType,returnUrl:t.returnUrl};e.searchParams.set(`state`,n);let o=J9(e.toString());return await this.store.set(r,JSON.stringify(a)),await this.store.set(this.getKey(`last_auth_url`),o),o}async _refresh(e){try{if(!this._cachedAuthServerUrl||!this._cachedMetadata){let e=(await bk(this.serverUrl)).authorization_servers?.[0];if(!e)return null;let t=await Sk(e);if(!t)return null;this._cachedAuthServerUrl=e,this._cachedMetadata=t}let t=await this.clientInformation();if(!t)return null;let n=await Ck(this._cachedAuthServerUrl,{metadata:this._cachedMetadata,clientInformation:t,refreshToken:e.refresh_token});return await this.saveTokens(n),n}catch{return null}}async _dedupedRefresh(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=this._refresh(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async forceRefresh(){let e=await this.store.get(this.getKey(`tokens`));if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return t.refresh_token?this._dedupedRefresh(t):null}},iRe=class{static{a(this,`LocalStorageKVStore`)}get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}keys(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&e.push(n)}return e}};async function aRe(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}a(aRe,`serializeBody`);var oRe=class{static{a(this,`BrowserOAuthClientProvider`)}serverUrl;staticClientInfo;session;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;originalFetch;_lastOriginalResource=null;onPopupWindow;constructor(e,t={}){this.serverUrl=e,this.session=new rRe(e,t,new iRe),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.staticClientInfo=t.staticClientInfo,this.onPopupWindow=t.onPopupWindow}get storageKeyPrefix(){return this.session.storageKeyPrefix}get serverUrlHash(){return this.session.serverUrlHash}get clientName(){return this.session.clientName}get clientUri(){return this.session.clientUri}get logoUri(){return this.session.logoUri}get callbackUrl(){return this.session.callbackUrl}get scope(){return this.session.scope}getKey(e){return this.session.getKey(e)}installFetchInterceptor(){if(!this.oauthProxyUrl){console.warn(`[BrowserOAuthProvider] No OAuth proxy URL configured, skipping fetch interceptor installation`);return}if(!this.originalFetch)this.originalFetch=window.fetch;else{console.warn(`[BrowserOAuthProvider] Fetch interceptor already installed`);return}let e=this.oauthProxyUrl,t=this.connectionUrl,n=this.serverUrl,r=this.originalFetch;console.log(`[BrowserOAuthProvider] Installing fetch interceptor with proxy: ${e}`),window.fetch=async(i,a)=>{let o=typeof i==`string`?i:i instanceof URL?i.toString():i.url;if(!(o.includes(`/.well-known/`)||o.match(/\/(register|token|authorize)$/)))return await r(i,a);try{let t=new URL(o),n=new URL(e);if(t.origin===n.origin&&(t.pathname.startsWith(n.pathname)||o.includes(`/inspector/api/oauth`)))return await r(i,a)}catch{}try{let i=o.includes(`/.well-known/`),s=i?`${e}/metadata?url=${encodeURIComponent(o)}`:`${e}/proxy`;if(console.log(`[OAuth Proxy] Routing ${i?`metadata`:`request`} through: ${s}`),i){let e={...a?.headers?Object.fromEntries(new Headers(a.headers)):{}};t&&(e[`X-Connection-URL`]=t);let i=new URL(s);n&&i.searchParams.set(`mcp_url`,n);let o=await r(i.toString(),{...a,method:`GET`,headers:e});try{if((o.headers.get(`content-type`)||``).includes(`application/json`)){let e=await o.clone().json(),t=e&&typeof e==`object`&&typeof e._original_resource==`string`?e._original_resource:null;t&&(this._lastOriginalResource=t)}}catch{}return o}let c=a?.body?await aRe(a.body):void 0,l=await(await r(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:c})})).json();return new Response(JSON.stringify(l.body),{status:l.status,statusText:l.statusText,headers:new Headers(l.headers)})}catch(e){return console.error(`[OAuth Proxy] Request failed, falling back to direct fetch:`,e),await r(i,a)}}}restoreFetch(){this.originalFetch&&=(console.log(`[BrowserOAuthProvider] Restoring original fetch`),window.fetch=this.originalFetch,void 0)}get redirectUrl(){return this.session.redirectUrl}get clientMetadata(){return this.session.clientMetadata}tokens(){return this.session.tokens()}saveTokens(e){return this.session.saveTokens(e)}async clientInformation(){return this.staticClientInfo?this.staticClientInfo:this.session.clientInformation()}async saveClientInformation(e){if(!this.staticClientInfo)return this.session.saveClientInformation(e)}codeVerifier(){return this.session.codeVerifier()}saveCodeVerifier(e){return this.session.saveCodeVerifier(e)}invalidateCredentials(e){return this.session.invalidateCredentials(e)}async prepareAuthorizationUrl(e){return this.rewriteResourceIfLocalProxy(e),this.session.storeAuthorizationState(e,{extraProviderOptions:{oauthProxyUrl:this.oauthProxyUrl,connectionUrl:this.connectionUrl,...this.staticClientInfo?{staticClientInfo:this.staticClientInfo}:{},...this.scope?{scope:this.scope}:{}},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0})}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}rewriteResourceIfLocalProxy(e){let t=e.searchParams.get(`resource`),n=!!(t&&(t.includes(`/inspector/api/proxy`)||t.includes(`/api/proxy`)||t.includes(`localhost:3000`))),r=!!(t&&this.connectionUrl&&t===this.connectionUrl),i=!!(t&&(this._lastOriginalResource||this.serverUrl)&&(r||n)),a=this._lastOriginalResource||this.serverUrl;i&&a&&e.searchParams.set(`resource`,a)}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?J9(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}},Y9=null;function X9(){if(typeof window>`u`)return!1;let e=window.name;return typeof e==`string`&&e.startsWith(`mcp_auth_`)}a(X9,`isMcpAuthPopupWindow`);var sRe=`mcp_auth_callback`;function Z9(e,t){if(typeof BroadcastChannel>`u`)return;let n=null;try{n=new BroadcastChannel(sRe),n.postMessage(e?{type:`mcp_auth_callback`,success:!0}:{type:`mcp_auth_callback`,success:!1,error:t??`Unknown error`})}catch(e){console.warn(`[mcp-callback] Failed to broadcast auth callback over BroadcastChannel:`,e)}finally{n&&setTimeout(()=>{try{n?.close()}catch{}},0)}}a(Z9,`broadcastAuthCallback`);function Q9(e,t,n=`success`){if(!(typeof document>`u`))try{document.body.innerHTML=``;let r=document.createElement(`div`);r.style.fontFamily=`sans-serif`,r.style.padding=`20px`;let i=document.createElement(`h1`);i.textContent=e,r.appendChild(i);let a=document.createElement(`p`);n===`error`&&(a.style.color=`red`,a.style.backgroundColor=`#ffebeb`,a.style.border=`1px solid red`,a.style.padding=`10px`,a.style.borderRadius=`4px`),a.textContent=t,r.appendChild(a);let o=document.createElement(`p`);o.textContent=`You can close this window or `;let s=document.createElement(`a`);s.href=`#`,s.textContent=`click here to close`,s.onclick=e=>(e.preventDefault(),window.close(),!1),o.appendChild(s),o.appendChild(document.createTextNode(`.`)),r.appendChild(o),document.body.appendChild(r)}catch{}}a(Q9,`renderCloseWindowMessage`);function cRe(){return Y9||(Y9=lRe(),Y9)}a(cRe,`onMcpAuthorization`);async function lRe(){let e=new URLSearchParams(window.location.search),t=e.get(`code`),n=e.get(`state`),r=e.get(`error`),i=e.get(`error_description`),o=`[mcp-callback]`;console.log(`${o} Handling callback...`,{code:t,state:n,error:r,errorDescription:i});let s=null,c=null,l=null;try{if(!n)throw Error(`State parameter not found or invalid in callback query parameters.`);console.log(`[mcp-callback] Looking for state: ${n}`),console.log(`[mcp-callback] All localStorage keys:`,Object.keys(localStorage));let e=`mcp:auth:state_${n}`;if(localStorage.getItem(e))l=e,console.log(`[mcp-callback] Found state with default key: ${e}`);else{let e=`:state_${n}`;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n&&n.endsWith(e)){l=n,console.log(`[mcp-callback] Found state with dynamic key: ${n}`);break}}}if(!l){let e=Object.keys(localStorage).filter(e=>e.includes(`state`));throw console.log(`[mcp-callback] State keys in storage:`,e),Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`)}let u=localStorage.getItem(l);if(!u)throw Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(u)}catch{throw Error(`Failed to parse stored OAuth state.`)}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(l),Error(`OAuth state has expired. Please try initiating authentication again.`);if(r){console.log(`${o} OAuth error received: ${r} - ${i||`No description`}`);let e=c.flowType===`redirect`,t=window.opener&&!window.opener.closed,n=X9(),s=a(e=>{console.log(`${o} Returning to: ${e}`),localStorage.removeItem(l);let t=new URL(e);t.searchParams.set(`auth_error`,r),i&&t.searchParams.set(`auth_error_description`,i),window.location.href=t.toString()},`redirectWithError`);if(t){window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:`${r}${i?`: ${i}`:``}`},window.location.origin),localStorage.removeItem(l),window.close();return}if(c.returnUrl&&(e||!n)){s(c.returnUrl);return}if(n){Z9(!1,`${r}${i?`: ${i}`:``}`),localStorage.removeItem(l),Q9(`Authentication Error`,`${r}${i?`: ${i}`:``}`,`error`);try{window.close()}catch{}return}throw Error(`OAuth error: ${r}${i?` - ${i}`:``}`)}if(!t)throw Error(`Authorization code not found in callback query parameters.`);if(!c.providerOptions)throw Error(`Stored state is missing required provider options.`);let{serverUrl:d,...f}=c.providerOptions,p=f.connectionUrl,m=!!(p&&/run\.mcp-use\.com|mcp-use\.run/.test(p)),h=m?p:void 0,g=f.oauthProxyUrl,_=h;if(!g&&_)try{let e=new URL(window.location.href);if(e.pathname.includes(`/oauth/callback`)){let t=e.pathname.replace(/\/oauth\/callback.*$/,``);(!t||t===``)&&(/run\.mcp-use\.com|mcp-use\.run/.test(_)?console.log(`${o} Gateway connection detected; skipping default /inspector OAuth proxy inference`):(t=`/inspector`,console.log(`${o} Callback at root /oauth/callback, using /inspector as base path for OAuth proxy`))),t&&(g=`${e.origin}${t}/api/oauth`),console.log(`${o} Inferred OAuth proxy URL from callback: ${g}`)}}catch(e){console.warn(`${o} Could not infer OAuth proxy URL:`,e)}console.log(`${o} Re-instantiating provider for server: ${d}`),s=new oRe(d,{...f,oauthProxyUrl:g,connectionUrl:_});let v=`${f.storageKeyPrefix}_${c.serverUrlHash}_code_verifier`,y=c.codeVerifier||localStorage.getItem(v);if(y)localStorage.setItem(v,y),localStorage.setItem(s.getKey(`code_verifier`),y);else throw Error(`[${f.storageKeyPrefix}] Code verifier missing for OAuth state ${n}. Please restart authentication.`);g&&(console.log(`${o} Installing fetch interceptor for token exchange (proxy: ${g})`),s.installFetchInterceptor()),console.log(`${o} Calling SDK auth() to exchange code...`);let b=m&&_?_:d;console.log(`${o} Using SDK serverUrl: ${b} (connectionUrl: ${_||`none`})`);let x=await gk(s,{serverUrl:b,authorizationCode:t});if(x===`AUTHORIZED`){console.log(`${o} Authorization successful via SDK auth().`);let e=c.flowType===`redirect`,t=X9();if(e&&c.returnUrl)console.log(`${o} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(l),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${o} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:`mcp_auth_callback`,success:!0},window.location.origin),localStorage.removeItem(l),window.close();else if(t){console.log(`${o} Popup flow complete but opener was lost; broadcasting success and rendering close-window message.`),Z9(!0),localStorage.removeItem(l),Q9(`Authentication Successful!`,`You're authenticated. You can close this window and return to the app.`);try{window.close()}catch{}}else if(c.returnUrl)console.log(`${o} Popup flow without opener (top-level nav). Returning to: ${c.returnUrl}`),localStorage.removeItem(l),window.location.href=c.returnUrl;else{console.warn(`${o} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(l);let e=window.location.pathname.split(`/`).filter(Boolean),t=e.length>0&&e[e.length-1]===`callback`?`/`+e.slice(0,-2).join(`/`):`/`;window.location.href=t||`/`}}else throw console.warn(`${o} SDK auth() returned unexpected status: ${x}`),Error(`Unexpected result from authentication library: ${x}`)}catch(e){console.error(`${o} Error during OAuth callback handling:`,e);let t=e instanceof Error?e.message:String(e);window.opener&&!window.opener.closed?window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:t},window.location.origin):X9()&&Z9(!1,t);try{document.body.innerHTML=``;let n=document.createElement(`div`);n.style.fontFamily=`sans-serif`,n.style.padding=`20px`;let r=document.createElement(`h1`);r.textContent=`Authentication Error`,n.appendChild(r);let i=document.createElement(`p`);i.style.color=`red`,i.style.backgroundColor=`#ffebeb`,i.style.border=`1px solid red`,i.style.padding=`10px`,i.style.borderRadius=`4px`,i.textContent=t,n.appendChild(i);let a=document.createElement(`p`);a.textContent=`You can close this window or `;let o=document.createElement(`a`);if(o.href=`#`,o.textContent=`click here to close`,o.onclick=e=>(e.preventDefault(),window.close(),!1),a.appendChild(o),a.appendChild(document.createTextNode(`.`)),n.appendChild(a),e instanceof Error&&e.stack){let t=document.createElement(`pre`);t.style.fontSize=`0.8em`,t.style.color=`#555`,t.style.marginTop=`20px`,t.style.whiteSpace=`pre-wrap`,t.textContent=e.stack,n.appendChild(t)}document.body.appendChild(n)}catch(e){console.error(`${o} Could not display error in callback window:`,e)}l&&localStorage.removeItem(l),s&&localStorage.removeItem(s.getKey(`last_auth_url`))}}a(lRe,`doOnMcpAuthorization`);async function uRe(e,t=fetch){let n=e.replace(/\/$/,``),r=await t(n.endsWith(`/mcp`)?n:`${n}/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jsonrpc:`2.0`,method:`initialize`,id:1,params:{}})});if(r.status!==401)return{};let{resourceMetadataUrl:i,scope:a}=vk(r);return{resourceMetadataUrl:i,scope:a}}a(uRe,`probeAuthParams`);function dRe(){let[e,t]=(0,w.useState)(`processing`),[n,r]=(0,w.useState)(``);return(0,w.useEffect)(()=>{console.log(`[OAuthCallback] Component mounted, handling authorization...`),console.log(`[OAuthCallback] Current URL:`,window.location.href),cRe().then(()=>{console.log(`[OAuthCallback] Authorization successful`),t(`success`)}).catch(e=>{console.error(`[OAuthCallback] Authorization failed:`,e),t(`error`),r(e instanceof Error?e.message:String(e))})},[]),e===`processing`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(Zf,{className:`h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Completing authentication...`})]})}):e===`error`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-red-600 dark:text-red-400 mb-2`,children:`Authentication Error`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400 mb-4`,children:n}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 dark:text-zinc-500`,children:`You can close this window and try again.`})]})}):(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-green-600 dark:text-green-400 mb-2`,children:`Authentication Successful!`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Redirecting you back...`})]})})}var fRe={model:`stub-model`,stopReason:`endTurn`,role:`assistant`,content:{type:`text`,text:`positive`}};function pRe({requestId:e,serverName:t,onViewDetails:n,onApprove:r,onDeny:i}){return(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`strong`,{children:`Sampling Request Received`}),(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:[`New request from `,t]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`button`,{"data-testid":`sampling-toast-view-details`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),n()},children:`View Details`}),(0,S.jsx)(`button`,{"data-testid":`sampling-toast-approve`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),r(fRe)},children:`Approve`}),(0,S.jsx)(`button`,{"data-testid":`sampling-toast-deny`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),i()},children:`Deny`})]})]})}var $9=`preview-default`,mRe=`preview-bundle`;function hRe(e){if(!e)return{};try{let t=atob(e),n=JSON.parse(t);if(n&&typeof n==`object`)return n}catch{}return{}}function gRe(e,t){let n=`ui://widget/${t}`,r=e.find(e=>e.uri.startsWith(`${n}.`)&&e.uri.endsWith(`.html`));return r?r.uri:e.find(e=>e.name===t)?.uri}function _Re(){let e=globalThis.__mcpUsePreviewBundle;if(!e||typeof e!=`object`)return;let t=e;if(typeof t.resourceUri==`string`)return t}function vRe(){(0,w.useEffect)(()=>{let e=document.documentElement,t=document.body,n=e.style.margin,r=t.style.margin,i=t.style.overflow;return e.style.margin=`0`,t.style.margin=`0`,t.style.overflow=`hidden`,()=>{e.style.margin=n,t.style.margin=r,t.style.overflow=i}},[])}function yRe(e){(0,w.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{await document.fonts.ready}catch{}t||(await new Promise(e=>requestAnimationFrame(()=>e(void 0))),await new Promise(e=>requestAnimationFrame(()=>e(void 0))),!t&&document.body.setAttribute(`data-view-ready`,`true`))})(),()=>{t=!0,document.body.removeAttribute(`data-view-ready`)}},[e])}function bRe(e,t){(0,w.useEffect)(()=>{if(!e)return;let n=!1,r,i,a=e=>{n||(e&&(document.body.dataset.viewX=String(Math.round(e.left)),document.body.dataset.viewY=String(Math.round(e.top)),document.body.dataset.viewWidth=String(Math.round(e.width)),document.body.dataset.viewHeight=String(Math.round(e.height))),document.body.setAttribute(`data-view-ready`,`true`))};return(async()=>{try{await document.fonts.ready}catch{}if(n||(await new Promise(e=>requestAnimationFrame(()=>e(void 0))),await new Promise(e=>requestAnimationFrame(()=>e(void 0))),n))return;let e=t.current?.querySelector(`iframe`);if(!e){a(null);return}let o=()=>{r&&clearTimeout(r),r=setTimeout(()=>{n||(i?.disconnect(),a(e.getBoundingClientRect()))},250)};i=new ResizeObserver(o),i.observe(e),o()})(),()=>{n=!0,r&&clearTimeout(r),i?.disconnect(),document.body.removeAttribute(`data-view-ready`),delete document.body.dataset.viewX,delete document.body.dataset.viewY,delete document.body.dataset.viewWidth,delete document.body.dataset.viewHeight}},[e,t])}function xRe({view:e,bundle:t,widthOverride:n}){let[r,i]=(0,w.useState)(!1),a=(0,w.useRef)(null);vRe(),bRe(r,a);let o=(0,w.useMemo)(()=>async e=>{if(e===t.resourceUri)return t.resourceContents;throw Error(`Resource ${e} not in screenshot bundle`)},[t]);return(0,S.jsx)(`div`,{ref:a,style:{width:`100vw`,height:`100vh`},children:(0,S.jsx)(N7,{serverId:mRe,toolCallId:(0,w.useMemo)(()=>`preview-bundle-${e}-${Date.now().toString(36)}`,[e]),toolName:e,toolInput:t.toolInput,toolOutput:t.toolOutput,resourceUri:t.resourceUri,readResource:o,displayMode:`inline`,inlineWidthOverride:n,noWrapper:!0,chromeless:!0,onReady:()=>i(!0)})})}function SRe({view:e}){let[t]=OM(),n=(0,w.useMemo)(()=>hRe(t.get(`props`)),[t]),r=(0,w.useMemo)(()=>t.get(`server`)||`${window.location.origin}/mcp`,[t]),i=(0,w.useMemo)(()=>{let e=t.get(`headers`);if(e)try{let t=JSON.parse(atob(e));if(t&&typeof t==`object`)return t}catch{}},[t]),{servers:a,addServer:o,storageLoaded:s}=uj(),c=a.find(e=>e.id===$9);(0,w.useEffect)(()=>{s&&o($9,{url:r,name:`Preview`,...i?{headers:i}:{}})},[s,r,i,o]);let l=c?.state===`ready`,u=c?.state===`failed`,d=(0,w.useMemo)(()=>{if(l)return gRe(c.resources,e)},[l,c?.resources,e]),f=(0,w.useMemo)(()=>`preview-${e}-${Date.now().toString(36)}`,[e]),p=(0,w.useMemo)(()=>async e=>{if(!c?.readResource)throw Error(`Server not ready`);return c.readResource(e)},[c]),[m,h]=(0,w.useState)(!1);return yRe(m),vRe(),u?(0,S.jsxs)(`div`,{style:{padding:16,fontFamily:`monospace`,color:`#b00`},children:[`Failed to connect to MCP server at `,r,`.`]}):!l||!d?l&&!d?(0,S.jsxs)(`div`,{style:{padding:16,fontFamily:`monospace`,color:`#b00`},children:[`View "`,e,`" not found on `,r,`.`]}):(0,S.jsx)(`div`,{style:{width:`100vw`,height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontFamily:`monospace`,color:`var(--muted-foreground, #888)`},children:`Loading…`}):(0,S.jsx)(`div`,{style:{width:`100vw`,height:`100vh`},children:(0,S.jsx)(N7,{serverId:$9,toolCallId:f,toolName:e,toolInput:n.toolInput,toolOutput:n.toolOutput,resourceUri:d,readResource:p,displayMode:`fullscreen`,noWrapper:!0,chromeless:!0,onReady:()=>h(!0)})})}function CRe(){let e=Wpe(),[t]=OM(),n=e.view??``,r=(0,w.useMemo)(()=>_Re(),[]),i=(0,w.useMemo)(()=>{let e=t.get(`width`);if(!e)return;let n=parseInt(e,10);return Number.isFinite(n)&&n>0?n:void 0},[t]);return r?(0,S.jsx)(xRe,{view:n,bundle:r,widthOverride:i}):(0,S.jsx)(SRe,{view:n})}var wRe=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},TRe=w.createContext(void 0),ERe={setTheme:e=>{},themes:[]},DRe=()=>w.useContext(TRe)??ERe;w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return w.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${wRe.toString()})(${u})`}})});function ORe({...e}){let{theme:t=`system`}=DRe();return(0,S.jsx)(mhe,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function kRe({activeTabRef:e}){let{activeTab:t}=Uq();return(0,w.useEffect)(()=>{e.current=t},[t,e]),null}function ARe(){let e=(0,w.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,w.useMemo)(()=>n?void 0:new ape(`mcp-inspector-connections`),[n]),a=window.__MCP_PROXY_URL__,o=a?`${window.location.origin}${a}`:void 0;return(0,w.useEffect)(()=>{let e=t.get(`auth_error`);if(!e)return;let n=t.get(`auth_error_description`);PM.error(`OAuth authentication failed: ${n||e}`,{duration:1/0,closeButton:!0});let r=new URLSearchParams(t);r.delete(`auth_error`),r.delete(`auth_error_description`);let i=r.toString();window.history.replaceState({},``,`${window.location.pathname}${i?`?${i}`:``}`)},[]),(0,S.jsx)(Sge,{forcedTheme:r||void 0,children:(0,S.jsx)(dDe,{children:(0,S.jsx)(lj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}/inspector/oauth/callback`,defaultAutoProxyFallback:o?{enabled:!0,proxyAddress:o}:!1,clientInfo:{name:`mcp-use Inspector`,version:window.__INSPECTOR_VERSION__,websiteUrl:`https://mcp-use.com`,icons:[{src:`https://mcp-use.com/logo.png`}],capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},onServerAdded:(e,t)=>{console.log(`[Inspector] Server added:`,e,t.state)},onServerRemoved:e=>{console.log(`[Inspector] Server removed:`,e)},onServerStateChange:(e,t)=>{console.log(`[Inspector] Server state changed:`,e,t)},onSamplingRequest:(e,t,n,r,i)=>{let a=PM((0,S.jsx)(pRe,{requestId:e.id,serverName:n,onViewDetails:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),PM.dismiss(a)},onApprove:t=>{r(e.id,t),PM.success(`Sampling request approved`),PM.dismiss(a)},onDeny:()=>{i(e.id,`User denied from toast`),PM.dismiss(a)}}),{duration:1/0})},onElicitationRequest:(t,n,r,i,a)=>{if(e.current===`chat`)return;let o=t.request.mode||`form`,s=t.request.message,c=o===`url`&&`url`in t.request?t.request.url:void 0,l=PM((0,S.jsx)(C,{requestId:t.id,serverName:r,mode:o,message:s,url:c,onViewDetails:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),PM.dismiss(l)},onOpenUrl:o===`url`&&c?()=>{window.open(c,`_blank`),PM.dismiss(l)}:void 0,onCancel:()=>{a(t.id,`User cancelled from toast`),PM.dismiss(l)}}),{duration:1/0})},children:(0,S.jsxs)(Dwe,{children:[(0,S.jsx)(kRe,{activeTabRef:e}),(0,S.jsx)(Mme,{basename:`/inspector`,children:(0,S.jsxs)(ime,{children:[(0,S.jsx)(cM,{path:`/oauth/callback`,element:(0,S.jsx)(dRe,{})}),(0,S.jsx)(cM,{path:`/preview/:view`,element:(0,S.jsx)(CRe,{})}),(0,S.jsx)(cM,{path:`/`,element:(0,S.jsx)(tRe,{children:(0,S.jsx)(Ewe,{})})})]})}),(0,S.jsx)(ORe,{position:`top-center`})]})})})})}var jRe=document.getElementById(`root`);jRe?x.createRoot(jRe).render((0,S.jsx)(ARe,{})):console.error(`[inspector] Root element not found`);
|
|
847
|
+
`),e.document.close())}},[x]),Fe=(0,w.useCallback)(()=>{l&&(ne(``),ee(!0))},[l]),Ie=(0,w.useCallback)(()=>{if(!l)return;let e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:ke,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};ve([...F,e]),ef.getInstance().capture(new Vd({toolName:l.name,serverId:i})).catch(()=>{}),ee(!1),ne(``)},[l,te,ke,F,ve,i]),Le=(0,w.useCallback)(e=>{ve(F.filter(t=>t.id!==e)),d?.id===e&&f(null)},[F,ve,d]);return ae?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[se!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{se===`response`?ce(`detail`):(u(null),ce(`list`))},className:`p-0 h-8 w-8`,children:(0,S.jsx)(bf,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),ce(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Tools`}),se===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`button`,{onClick:()=>{ce(`response`)},className:se===`detail`?`text-foreground hover:underline`:se===`response`?`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`:`text-muted-foreground`,children:`Execute`})]}),se===`response`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Response`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(JK,{initial:!1,mode:`popLayout`,children:[se===`list`&&(0,S.jsxs)(Lq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(_Ie,{activeTab:N,isSearchExpanded:re,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>R(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(gIe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:z}):(0,S.jsx)($Fe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:z})]},`list`),se===`detail`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-10`,children:(0,S.jsx)(uIe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})},`detail`),se===`response`&&(0,S.jsx)(Lq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-20`,children:(0,S.jsx)(hIe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onRerunTool:Ae})},`response`)]})}),(0,S.jsx)(eIe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)(YIe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(QIe,{children:[(0,S.jsxs)($Ie,{children:[(0,S.jsx)(tLe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(nLe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(eLe,{children:[(0,S.jsx)(iLe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(rLe,{onClick:De,children:`Auto-fill`})]})]})})]}):(0,S.jsxs)(O9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(k9,{id:`left-panel`,defaultSize:`33%`,minSize:`20%`,collapsible:!0,className:`flex flex-col h-full relative`,panelRef:he,children:(0,S.jsxs)(O9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(k9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(_Ie,{activeTab:N,isSearchExpanded:re,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>R(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(gIe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:z}):(0,S.jsx)($Fe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:z})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(P9,{serverId:i})]})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`67%`,children:(0,S.jsxs)(O9,{orientation:`vertical`,children:[(0,S.jsx)(k9,{defaultSize:`40%`,collapsible:!0,panelRef:ge,children:(0,S.jsx)(uIe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onCancel:()=>{k&&k.abort()},onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})}),(0,S.jsx)(A9,{withHandle:!0}),(0,S.jsx)(k9,{defaultSize:`60%`,children:(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(hIe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onMaximize:_e,isMaximized:le,onRerunTool:Ae})})})]})}),(0,S.jsx)(eIe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)(YIe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(QIe,{children:[(0,S.jsxs)($Ie,{children:[(0,S.jsx)(tLe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(nLe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(eLe,{children:[(0,S.jsx)(iLe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(rLe,{onClick:De,children:`Auto-fill`})]})]})})]})}oLe.displayName=`ToolsTab`;function sLe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,children:a}){let{embeddedConfig:o}=Uq();if(!e&&o.forceConnected)return o.chatApiUrl?(0,S.jsx)(aPe,{connection:{id:`force-connected`,url:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!0,hideServerUrl:o.chatHideServerUrl??!0,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`):(0,S.jsx)(S.Fragment,{children:a});if(!e)return(0,S.jsx)(S.Fragment,{children:a});let s=e=>o.visibleTabs?o.visibleTabs.includes(e):!0;return(0,S.jsxs)(S.Fragment,{children:[s(`tools`)&&(0,S.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(oLe,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,refreshTools:e.refreshTools},`tools-${e.id}`)}),s(`prompts`)&&(0,S.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(BFe,{ref:r,prompts:e.prompts,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),serverId:e.id,isConnected:e.state===`ready`,refreshPrompts:e.refreshPrompts},`prompts-${e.id}`)}),s(`resources`)&&(0,S.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(qFe,{ref:i,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url||``,refreshResources:e.refreshResources},`resources-${e.id}`)}),s(`chat`)&&(0,S.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(aPe,{connection:e,isConnected:o.forceConnected||e.state===`ready`,prompts:e.prompts,serverId:e.id,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),readResource:e.readResource,useClientSide:!o.chatApiUrl,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??(o.chatApiUrl?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0),enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!!o.chatApiUrl,hideServerUrl:o.chatHideServerUrl??!!o.chatApiUrl,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,streamProtocol:o.chatStreamProtocol,credentials:o.chatCredentials},`chat-${e.id}`)}),s(`sampling`)&&(0,S.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(QFe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url},`sampling-${e.id}`)}),s(`elicitation`)&&(0,S.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(bFe,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),s(`notifications`)&&(0,S.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(wFe,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state===`ready`},`notifications-${e.id}`)}),![`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(t)&&(0,S.jsx)(S.Fragment,{children:a})]})}function cLe({className:e}){return(0,S.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentcolor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[(0,S.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,S.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var lLe=w.createContext(void 0);function uLe(){let e=w.use(lLe);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var dLe=w.createContext(void 0);function fLe(){return w.use(dLe)}function V9({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=w.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=w.useState(!1),h=w.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,S.jsx)(lLe,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:w.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,S.jsx)(`div`,{ref:e,className:H(`flex flex-col gap-2`,a),...c,children:t})})}V9.displayName=`Tabs`;function H9({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=uLe(),[l,u]=w.useState({width:0,left:0}),d=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useCallback(()=>{let e=d.current;if(!e)return;let t=e.querySelector(`div:first-child`);if(!t)return;let n=t.querySelector(`button[data-tab-value="${o}"]`);if(n&&o){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();u({width:r.width,left:r.left-e.left})}else u({width:0,left:0})},[o]),h=w.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);w.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),w.useEffect(()=>{let e=d.current;if(!e)return;f.current=new ResizeObserver(()=>{h()}),f.current.observe(e);let t=e.querySelector(`div:first-child`);return t&&t.querySelectorAll(`button[data-tab-value]`).forEach(e=>{f.current&&f.current.observe(e)}),()=>{f.current&&f.current.disconnect(),p.current&&clearTimeout(p.current)}},[h]),w.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=w.useRef(null);return w.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,S.jsx)(dLe,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,S.jsx)(`div`,{ref:d,className:H(`relative flex items-center bg-none gap-1`,r===`default`&&`p-1 rounded-full border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`border-b border-zinc-200 dark:border-zinc-700`,n),...a,children:(0,S.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,S.jsx)(`span`,{ref:g,className:H(`absolute transition-all duration-[250ms] ease-in-out z-0`,r===`default`&&`bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`bottom-0 h-0.5 bg-black dark:bg-white`)})]})})})}H9.displayName=`TabsList`;var pLe=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,S.jsx)(Od,{children:(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{children:e}),(0,S.jsx)(jd,{children:t})]})}),U9=w.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,badge:c,...l},u)=>{let{activeValue:d,handleValueChange:f,collapsed:p}=uLe(),m=fLe()?.variant||`default`,h=d===t,g=!p||h||s;return(0,S.jsx)(pLe,{title:a,collapsed:p&&!g,children:(0,S.jsxs)(`button`,{ref:u,disabled:r,onClick:()=>f(t),"data-tab-value":t,"data-tab-active":h,role:`tab`,"aria-selected":h?`true`:`false`,title:p&&!g&&a?a:void 0,className:H(`relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-[250ms] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,m===`default`&&`py-2.5`,m===`default`&&`rounded-md px-4`,m===`underline`&&`px-6 py-3 border-b-2 border-transparent`,h&&`text-foreground`,!h&&`text-muted-foreground hover:text-foreground`,n),...l,children:[i&&(0,S.jsx)(i,{className:H(`h-4 w-4 shrink-0 transition-all duration-[250ms] ease-in-out`,g&&`mr-2`,!g&&`mr-0!`)}),o&&(0,S.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2 h-2 bg-orange-500 dark:bg-orange-400 border-2 border-white dark:border-zinc-900 rounded-full transition-opacity duration-300 z-10 animate-status-pulse-orange`}),(0,S.jsx)(`span`,{className:H(`min-w-0 transition-all duration-[250ms] ease-in-out overflow-hidden`,g?`w-auto opacity-100`:`w-0 opacity-0`),children:e}),c]})})});U9.displayName=`TabsTrigger`;function mLe(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return(0,S.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=w.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>w.createContext(e));return function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,hLe(i,...t)]}function hLe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var gLe=i((e=>{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),_Le=i(((e,t)=>{t.exports=gLe()}))();function vLe(){return(0,_Le.useSyncExternalStore)(yLe,()=>!0,()=>!1)}function yLe(){return()=>{}}var W9=`Avatar`,[bLe,xLe]=mLe(W9),[SLe,CLe]=bLe(W9),wLe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=w.useState(`idle`);return(0,S.jsx)(SLe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,S.jsx)(EN.span,{...r,ref:t})})});wLe.displayName=W9;var TLe=`AvatarImage`,ELe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=CLe(TLe,n),s=ALe(r,a),c=$t(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ft(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,S.jsx)(EN.img,{...a,ref:t,src:r}):null});ELe.displayName=TLe;var DLe=`AvatarFallback`,OLe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=CLe(DLe,n),[o,s]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,S.jsx)(EN.span,{...i,ref:t}):null});OLe.displayName=DLe;function kLe(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function ALe(e,{referrerPolicy:t,crossOrigin:n}){let r=vLe(),i=w.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=w.useState(()=>kLe(a,e));return Ft(()=>{s(kLe(a,e))},[a,e]),Ft(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var jLe=wLe,MLe=ELe,NLe=OLe;function PLe({className:e,...t}){return(0,S.jsx)(jLe,{"data-slot":`avatar`,className:H(`relative flex size-8 shrink-0 overflow-hidden rounded-full`,e),...t})}function FLe({className:e,...t}){return(0,S.jsx)(MLe,{"data-slot":`avatar-image`,className:H(`aspect-square size-full`,e),...t})}function ILe({className:e,...t}){return(0,S.jsx)(NLe,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center rounded-full bg-zinc-200 dark:bg-zinc-700 text-muted-foreground font-medium`,e),...t})}function LLe(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function RLe({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useCallback)(()=>{let t=!1,n=`${new URL(e).origin}/api/auth/get-session`;return fetch(n,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!t){let t=e?.user??null;a(t),s(!0),r?.(t)}}).catch(()=>{t||(s(!0),r?.(null))}),()=>{t=!0}},[e]);if((0,w.useEffect)(()=>c(),[c]),(0,w.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`manufact:session-changed`,e),()=>window.removeEventListener(`manufact:session-changed`,e)},[c]),!o)return null;if(!i)return(0,S.jsx)(S.Fragment,{children:n});let l=LLe(i.name,i.email),u=i.name??i.email??`User`;return(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,S.jsxs)(PLe,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,S.jsx)(FLe,{src:i.image??``,alt:u}),(0,S.jsx)(ILe,{className:`text-sm`,children:l})]})})}),(0,S.jsxs)($l,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,S.jsx)(nu,{className:`font-normal`,children:(0,S.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:u}),i.email&&i.email!==u&&(0,S.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:i.email})]})}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Xf,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})})]})]})}function zLe({count:e,isActive:t,size:n=`md`}){return e<=0?null:(0,S.jsx)(`span`,{className:H(t?`dark:bg-black`:`dark:bg-zinc-700`,`shrink-0 ml-1 bg-zinc-200 text-zinc-700 dark:text-zinc-300 rounded-full font-medium`,n===`sm`&&`text-[10px] px-1.5 py-0.5`,n===`md`&&`text-xs px-2 py-0.5`),children:e})}function BLe({serverConfig:e,additionalItems:t=[],showClients:n={cursor:!0,vsCode:!0,vsCodeInsiders:!0,claudeDesktop:!0,claudeCode:!0,geminiCli:!0,codexCli:!0},className:r=``,onSuccess:i,onError:a,trigger:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{ef.getInstance().capture(new Kd({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=bJ(p,m,h);window.location.href=e,i?.(`Cursor`)}catch(e){console.error(`Failed to generate Cursor deep link:`,e),a?.(e)}},v=()=>{g(`vscode`);try{let e=xJ(p,m,h);window.location.href=e,i?.(`VS Code`)}catch(e){console.error(`Failed to generate VS Code deep link:`,e),a?.(e)}},y=()=>{g(`vscode-insiders`);try{let e=SJ(p,m,h);window.location.href=e,i?.(`VS Code Insiders`)}catch(e){console.error(`Failed to generate VS Code Insiders deep link:`,e),a?.(e)}},b=()=>{g(`claude-desktop`);try{CJ(p,m,h),i?.(`Claude Desktop`)}catch(e){console.error(`Failed to download .mcpb file:`,e),a?.(e)}},x=()=>{g(`claude-code`),u(`claude-code`),c(!0)},C=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},T=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},E=async e=>{try{await dj(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},D=()=>{if(l===`claude-code`){let{command:e,envVars:t}=wJ(p,m,h),n=DJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Claude Code`}),(0,S.jsx)(wN,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,S.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=TJ(p,m,h),n=DJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Gemini CLI`}),(0,S.jsx)(wN,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Gemini CLI to load the new configuration.`})]})]})}if(l===`codex-cli`){let{config:e,envVars:t}=EJ(p,m,h);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(SN,{children:[(0,S.jsx)(CN,{children:`Add to Codex CLI`}),(0,S.jsxs)(wN,{children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),t.length>0&&(0,S.jsx)(`div`,{children:(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},O=(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center ${r}`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:O}),(0,S.jsxs)($l,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,S.jsxs)(eu,{onClick:async()=>{await e.onClick()},className:`flex items-center gap-2`,children:[e.icon,(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,S.jsx)(ru,{}),n.cursor&&(0,S.jsxs)(eu,{onClick:_,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,S.jsxs)(eu,{onClick:x,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,S.jsxs)(eu,{onClick:b,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,S.jsxs)(eu,{onClick:v,className:`flex items-center gap-2`,children:[(0,S.jsx)(OJ,{className:`h-4 w-4 text-blue-500`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,S.jsxs)(eu,{onClick:y,className:`flex items-center gap-2`,children:[(0,S.jsx)(OJ,{className:`h-4 w-4 text-teal-400`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,S.jsxs)(eu,{onClick:C,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,S.jsxs)(eu,{onClick:T,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,S.jsx)(yN,{open:s,onOpenChange:c,children:(0,S.jsx)(xN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:D()})})]})}function G9({className:e,state:t=`collapsed`,href:n=`https://mcp-use.com`}){let[r,i]=(0,w.useState)(!1),a=.2,o=.7,s=a+o+.6,c=a/s,l=(a+o)/s;return(0,S.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:H(`flex items-center transition-opacity -my-3`,t===`expanded`?`space-x-2`:``,e),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Lq.svg,{viewBox:`0 0 303 303`,initial:`rest`,animate:r?`hover`:`rest`,className:H(`text-foreground`,t===`expanded`?`size-[40px]`:`size-[20px]`),children:[(0,S.jsxs)(Lq.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:s,times:[0,c,l,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`path`,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`}),(0,S.jsx)(`circle`,{cx:`70.3`,cy:`232.3`,r:`50`}),(0,S.jsx)(`circle`,{cx:`232.3`,cy:`70.3`,r:`50`})]}),(0,S.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(VLe,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(HLe,{cx:70.3,cy:232.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(HLe,{cx:232.3,cy:70.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s})]})]})}),t===`expanded`&&(0,S.jsxs)(`div`,{className:`font-ubuntu flex-col items-start -space-y-1 mr-3 hidden xl:flex`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-medium`,children:`mcp-use`}),(0,S.jsx)(`span`,{className:`text-lg text-muted-foreground tracking-wide font-sans font-light`,children:`Inspector`})]})]})}function VLe({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,S.jsx)(Lq.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,i,a,o],ease:`easeInOut`}}}})}function HLe({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,S.jsx)(Lq.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:i,times:[a,o,s,c],ease:`easeInOut`}}}})}function K9({open:e,onOpenChange:t,serverUrl:n,serverName:r,serverId:i,headers:a,language:o}){let{prismStyle:s}=LP(),[c,l]=(0,w.useState)(!1),u=o===`typescript`?eTe(n,r,i,a):tTe(n,r,i,a),d=async()=>{await dj(u),l(!0),setTimeout(()=>l(!1),2e3)},f=o===`typescript`?`TypeScript`:`Python`;return(0,S.jsx)(yN,{open:e,onOpenChange:t,children:(0,S.jsxs)(xN,{className:`max-w-[90vw] max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(SN,{children:[(0,S.jsxs)(CN,{children:[`Add to `,f,` SDK`]}),(0,S.jsxs)(wN,{children:[`Copy the following code to integrate this server into your`,` `,f,` application using the mcp-use SDK.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 min-h-0`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Install the mcp-use package:`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:o===`typescript`?`npm install mcp-use`:`pip install mcp-use`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`Copy the following code into your `,f,` project:`]})]})]})]}),(0,S.jsxs)(`div`,{className:`relative w-full overflow-x-auto overflow-y-auto max-h-[60vh]`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:d,children:c?(0,S.jsx)(vf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(jf,{className:`size-3.5`})})}),(0,S.jsx)(LV,{language:o,style:s,customStyle:{margin:0,padding:`1rem`,paddingRight:`3rem`,borderRadius:`0.5rem`,fontSize:`0.75rem`,background:`var(--muted)`,width:`100%`,maxWidth:`100%`,overflow:`auto`},wrapLines:!0,wrapLongLines:!0,PreTag:`div`,children:u})]})]})]})})}function ULe({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=FP();return(0,S.jsxs)(`button`,{style:{"--spread":`90deg`,"--shimmer-color":t||(l===`dark`?`#000000`:`#ffffff`),"--radius":i,"--speed":r,"--cut":n,"--bg":a||(l===`dark`?`rgba(255, 255, 255, 1)`:`rgba(0, 0, 0, 1)`)},className:H(`group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]`,`transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px`,`dark:text-white text-black dark:border-white/10 border-black/10`,o),ref:e,...c,children:[(0,S.jsx)(`div`,{className:H(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,S.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,S.jsx)(`div`,{className:`animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]`})})}),s,(0,S.jsx)(`div`,{className:H(`absolute inset-0 size-full`,`rounded-2xl px-4 py-1.5 text-sm font-medium`,`transform-gpu transition-all duration-300 ease-in-out`,`dark:shadow-[inset_0_-8px_10px_#0000001f] dark:group-hover:shadow-[inset_0_-6px_10px_#0000003f] dark:group-active:shadow-[inset_0_-10px_10px_#0000003f] shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]`)}),(0,S.jsx)(`div`,{className:H(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}ULe.displayName=`ShimmerButton`;function WLe({status:e}){let{color:t,ringColor:n,tooltip:r}=(e=>{switch(e){case`ready`:return{color:`bg-emerald-500`,ringColor:`ring-emerald-500`,tooltip:`Connected`};case`failed`:return{color:`bg-red-500`,ringColor:`ring-red-500`,tooltip:`Failed`};default:return{color:`bg-yellow-500`,ringColor:`ring-yellow-500`,tooltip:e}}})(e);return(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),(0,S.jsx)(`div`,{className:`relative w-2 h-2 rounded-full ${t}`})]})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:r})})]})}function GLe({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:i=!1}){let a=Zj(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=t=>{let r=e.find(e=>e.id===t);if(!r||r.state!==`ready`){PM.error(`Server is not connected and cannot be inspected`);return}n(t)};return i?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsxs)(U,{variant:`ghost`,className:`h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5`,children:[t?(0,S.jsx)(Bq,{server:t,size:`md`}):(0,S.jsx)(_p,{className:`h-5 w-5`}),(0,S.jsx)(yf,{className:`h-4 w-4`})]})}),(0,S.jsxs)($l,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(nu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(ru,{}),e.length===0?(0,S.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,S.jsxs)(eu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Bq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:_j(e)}),(0,S.jsx)(WLe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(Jf,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(vp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]})}),(0,S.jsx)(zV,{open:o,onOpenChange:s,connection:c})]}):(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsxs)(ULe,{className:H(`min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200`,!t&&`pl-4`,t&&`pr-20`),children:[t&&(0,S.jsx)(Bq,{server:t,size:`md`,className:`mr-2`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?_j(t):`Select server to inspect`}),t&&(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:e=>{e.stopPropagation()},className:`w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]})}),t&&(0,S.jsxs)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1`,children:[(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{l(t),s(!0)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`View server info`,children:(0,S.jsx)(Jf,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{r(t.id)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`Edit connection settings`,children:(0,S.jsx)(vp,{className:`h-4 w-4`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]})]}),(0,S.jsxs)($l,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(nu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(ru,{}),e.length===0?(0,S.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,S.jsxs)(eu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Bq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:_j(e)}),(0,S.jsx)(WLe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(Jf,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(vp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]}),(0,S.jsx)(zV,{open:o,onOpenChange:s,connection:c})]})})}var KLe=[{id:`chat`,label:`Chat`,icon:ep,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Pp},{id:`prompts`,label:`Prompts`,icon:tp},{id:`resources`,label:`Resources`,icon:Hf},{id:`sampling`,label:`Sampling`,icon:Gf},{id:`elicitation`,label:`Elicitation`,icon:wp},{id:`notifications`,label:`Notifications`,icon:pf}];function qLe(e,t){return e===`tools`?t.tools.length:e===`prompts`?t.prompts.length:e===`resources`?t.resources.length:e===`sampling`?t.pendingSamplingRequests?.length||0:e===`elicitation`?t.pendingElicitationRequests?.length||0:e===`notifications`?t.unreadNotificationCount:0}function JLe(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}function YLe({collapsed:e,onToggle:t}){return(0,S.jsxs)(kd,{children:[(0,S.jsx)(Ad,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:t,className:H(`shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer`,`text-muted-foreground hover:text-foreground`,`hover:bg-zinc-100 dark:hover:bg-zinc-800`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),"aria-label":e?`Expand tabs`:`Collapse tabs`,type:`button`,children:e?(0,S.jsx)(xf,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`}):(0,S.jsx)(bf,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`})})}),(0,S.jsx)(jd,{children:(0,S.jsx)(`p`,{children:e?`Expand tabs`:`Collapse tabs`})})]})}function XLe(e){try{let t=new URL(e).hostname.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`0.0.0.0`}catch{return!1}}function ZLe(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function QLe(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}var q9={starting:`Starting tunnel…`,stopping:`Stopping tunnel…`,reconnecting:`Reconnecting…`};function $Le({tunnelUrl:e,isTunnelStarting:t,setTunnelUrl:n,setIsTunnelStarting:r,copied:i,setCopied:a,handleCopy:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(q9.starting);(0,w.useEffect)(()=>{if(!t){f(20);return}f(20);let e=setInterval(()=>f(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[t]),(0,w.useEffect)(()=>{if(!e)return;c(!0);let t=new URLSearchParams(window.location.search);if(t.has(`openTunnelPopover`)){t.delete(`openTunnelPopover`);let e=t.toString();window.history.replaceState({},``,`${window.location.pathname}${e?`?${e}`:``}`)}},[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/inspector/api/dev/info`);if(!t.ok||e)return;let r=await t.json();if(e)return;if(u(!!r.fromCli),r.tunnelUrl)n(new URL(r.tunnelUrl).origin);else{let e=QLe(r.mcpUrl??null);e&&n(e)}}catch{e||u(!1)}})(),()=>{e=!0}},[n]);let h=async e=>{let t=window.location.port||`3000`,i=`http://localhost:${t}/inspector/api/dev/info`,a=Date.now()+9e4;for(m(e?`Restarting with tunnel…`:`Restarting…`),await new Promise(e=>setTimeout(e,1500));Date.now()<a;){try{let r=await fetch(i,{cache:`no-store`});if(r.ok){let i=await r.json();if(!!i.tunnelUrl===e){let r=(i.tunnelUrl||i.mcpUrl||`http://localhost:${t}`).replace(/\/+$/,``)+`/mcp`;i.tunnelUrl?n(new URL(i.tunnelUrl).origin):n(null),sessionStorage.setItem(zM,JSON.stringify({url:r,name:`Local MCP Server`,transportType:`http`,connectionType:`Direct`})),PM.success(e?`Tunnel ready — reconnecting…`:`Tunnel stopped — reconnecting…`),m(q9.reconnecting);let a=new URL(window.location.href);a.searchParams.delete(`server`),a.searchParams.delete(`tunnelUrl`),a.searchParams.delete(`autoConnect`),e&&a.searchParams.set(`openTunnelPopover`,`1`),window.location.assign(a.toString());return}}}catch{}await new Promise(e=>setTimeout(e,1500))}PM.error(`Timeout waiting for server to restart`),r(!1)},g=async()=>{if(l===!1){PM.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}m(q9.starting),r(!0);let e=!1;try{let t=await fetch(`/inspector/api/dev/start-tunnel`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));PM.error(e.error||`Failed to start tunnel`),r(!1);return}await h(!0),e=!0}catch{PM.error(`Failed to start tunnel`),r(!1)}try{ef.getInstance().capture(new Hd({action:`start`,success:e})).catch(()=>{})}catch{}},_=async()=>{m(q9.stopping),r(!0);let t=!1;try{let e=await fetch(`/inspector/api/dev/stop-tunnel`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));PM.error(t.error||`Failed to stop tunnel`),r(!1);return}a(!1),c(!1),await h(!1),t=!0}catch{PM.error(`Failed to stop tunnel`),r(!1)}try{ef.getInstance().capture(new Hd({action:`stop`,success:t,tunnelUrl:e})).catch(()=>{})}catch{}};if(t)return(0,S.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-2 h-9 px-3 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait`,children:[(0,S.jsx)(Zf,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}),(0,S.jsxs)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,S.jsxs)(`span`,{className:`tabular-nums`,children:[d,`s`]})]})]});if(!e){let e=l===!0,t=l===null;return(0,S.jsxs)(`button`,{type:`button`,onClick:g,disabled:!e||t,title:l===!1?"Run `mcp-use dev` from your project to enable tunneling.":t?`Checking dev server…`:void 0,className:H(`flex items-center gap-2 h-9 px-3 border rounded-full transition-colors`,e&&!t?`bg-violet-50 dark:bg-violet-950/40 border-violet-200 dark:border-violet-800 hover:bg-violet-100 dark:hover:bg-violet-900/50 cursor-pointer`:`bg-violet-50/60 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800 cursor-not-allowed opacity-70`),children:[t?(0,S.jsx)(Zf,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}):(0,S.jsx)(Cf,{className:`size-4 text-violet-500 dark:text-violet-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}return(0,S.jsxs)(QJ,{open:s,onOpenChange:c,children:[(0,S.jsx)($J,{asChild:!0,children:(0,S.jsxs)(`button`,{className:`flex items-center gap-2 h-9 px-3 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer`,children:[(0,S.jsx)(Cf,{className:`size-4 text-purple-600 dark:text-purple-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300 hidden lg:inline`,children:`Tunnel`})]})}),(0,S.jsx)(eY,{className:`w-[calc(100vw-2rem)] sm:w-96 overflow-hidden`,align:`end`,children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,S.jsxs)(`a`,{href:`https://manufact.com/docs/tunneling`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Docs`,(0,S.jsx)(ff,{className:`size-3`})]})]}),(0,S.jsxs)(`button`,{onClick:o,className:`-mx-4 px-4 py-3 bg-muted hover:bg-accent transition-colors cursor-pointer flex items-center gap-3 w-[calc(100%+2rem)]`,children:[(0,S.jsxs)(`code`,{className:`flex-1 text-[10px] font-mono truncate text-left`,children:[e,`/mcp`]}),i?(0,S.jsx)(vf,{className:`size-3.5 text-green-600 shrink-0`}):(0,S.jsx)(jf,{className:`size-3.5 shrink-0 text-muted-foreground`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Enable`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`dev mode`}),` `,`from settings`]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`In`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`App & Connectors`}),` `,`click on`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`create`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,S.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,S.jsxs)(`button`,{onClick:_,className:`flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors cursor-pointer`,children:[(0,S.jsx)(Dp,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})})]})}function eRe({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,onCommandPaletteOpen:a,onOpenConnectionOptions:o,embedded:s=!1}){let{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,embeddedConfig:f}=Uq(),{theme:p,setTheme:m}=FP(),h=!!t&&(XLe(t.url)||ZLe(t.url)||!!c),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!0),[E,D]=(0,w.useState)(!1);if(f.singleTab)return null;let O=f.visibleTabs?KLe.filter(e=>e.id===`separator`||f.visibleTabs.includes(e.id)):KLe,k=async()=>{if(c)try{await dj(`${c}/mcp`),_(!0),PM.success(`Tunnel URL copied to clipboard`),setTimeout(()=>_(!1),2e3)}catch{PM.error(`Failed to copy URL`)}};return(0,S.jsxs)(`header`,{className:`w-full mx-auto`,children:[(0,S.jsxs)(`div`,{className:`flex lg:hidden flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[!s&&(0,S.jsx)(`div`,{className:`flex-1 flex justify-start`,children:(0,S.jsx)(GLe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o,mobileMode:!0})}),!s&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex justify-center`,children:(0,S.jsx)(`div`,{className:`scale-150`,children:(0,S.jsx)(G9,{state:`collapsed`})})}),!s&&(0,S.jsxs)(`div`,{className:`flex-1 flex justify-end items-center gap-2`,children:[t&&(()=>{let e=_j(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(BLe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>PM.success(`Opening in ${e}...`),onError:e=>PM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center p-2`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]})}),(0,S.jsx)(K9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(K9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)($Le,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,size:`sm`,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-3`,children:(0,S.jsx)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{ef.getInstance().capture(new Ud({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:(0,S.jsx)(fp,{className:`size-4`})})}),(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)($l,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(Yl,{children:[(0,S.jsxs)(Zl,{children:[p===`light`?(0,S.jsx)(Op,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(ip,{className:`size-4 mr-2`}):(0,S.jsx)(rp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)(Ql,{children:(0,S.jsxs)(Xl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(tu,{value:`light`,children:[(0,S.jsx)(Op,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(tu,{value:`dark`,children:[(0,S.jsx)(ip,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(tu,{value:`system`,children:[(0,S.jsx)(rp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(cLe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(_f,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]})]})]}),t&&(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsx)(V9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(H9,{className:`w-full justify-center`,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=qLe(e.id,t),i=JLe(e.id,r,C);return(0,S.jsx)(U9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:i,badge:(0,S.jsx)(zLe,{count:r,isActive:n===e.id,size:`sm`}),alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 flex-1 flex-row gap-2 relative`,C&&`pl-2`),children:(0,S.jsx)(`span`,{className:`sr-only`,children:e.label})},e.id)})})})})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center flex-wrap gap-2 md:space-x-6 space-x-2`,children:[!s&&(0,S.jsx)(GLe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o}),t&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(V9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(H9,{className:`overflow-x-auto`,collapsible:!0,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=qLe(e.id,t),i=r>0?`${e.label} (${r})`:e.label,a=JLe(e.id,r,C);return(0,S.jsx)(U9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:a,badge:(0,S.jsx)(zLe,{count:r,isActive:n===e.id}),alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 lg:[&>svg]:mr-2 relative`,C&&`pl-4`),title:i,children:(0,S.jsx)(`span`,{className:`items-center gap-2 hidden lg:flex`,children:e.label})},e.id)})})}),(0,S.jsx)(YLe,{collapsed:C,onToggle:()=>T(!C)})]})]}),!s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-4 flex-shrink-0`,children:[t&&(()=>{let e=_j(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(BLe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>PM.success(`Opening in ${e}...`),onError:e=>PM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(lp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(yf,{className:`size-3`})]})]})}),(0,S.jsx)(K9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(K9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)($Le,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-4`,children:(0,S.jsxs)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{ef.getInstance().capture(new Ud({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:[(0,S.jsx)(fp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Deploy`})]})}),(0,S.jsxs)(ql,{children:[(0,S.jsx)(Jl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)($l,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(eu,{onClick:a,"data-testid":`command-palette-trigger-button`,children:[(0,S.jsx)(Af,{className:`size-4 mr-2`}),`Command Palette`,(0,S.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`⌘`,`K`]})]}),(0,S.jsxs)(Yl,{children:[(0,S.jsxs)(Zl,{children:[p===`light`?(0,S.jsx)(Op,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(ip,{className:`size-4 mr-2`}):(0,S.jsx)(rp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)(Ql,{children:(0,S.jsxs)(Xl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(tu,{value:`light`,children:[(0,S.jsx)(Op,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(tu,{value:`dark`,children:[(0,S.jsx)(ip,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(tu,{value:`system`,children:[(0,S.jsx)(rp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(ru,{}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(cLe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(eu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(_f,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]}),f.chatApiUrl?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(RLe,{chatApiUrl:f.chatApiUrl,onUserResolved:e=>D(!!e),fallback:(0,S.jsx)(`span`,{className:`[@media(min-width:1400px)]:hidden`,children:(0,S.jsx)(G9,{state:`expanded`})})}),(0,S.jsx)(`span`,{className:`hidden [@media(min-width:1400px)]:block`,children:(0,S.jsx)(G9,{state:`expanded`})})]}):(0,S.jsx)(G9,{state:`expanded`})]})]})]})}function tRe({children:e}){let t=Zj(),n=Jj(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=uj(),l=(0,w.useCallback)((e,t,n,r,a)=>{i(e,{url:e,name:t,proxyConfig:n,transportType:r,preventAutoAuth:!0,useRedirectFlow:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},...a?{oauth:a}:{}})},[i]),u=(0,w.useCallback)(async(e,t)=>{try{await s(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),d=(0,w.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:f,setSelectedServerId:p,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:_,tunnelUrl:v,isEmbedded:y,embeddedConfig:b,setEmbeddedMode:x}=Uq(),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),O=Owe();(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search),t=e.get(`embedded`)===`true`,r=e.get(`embeddedConfig`);if(t){let e={};if(r)try{e=JSON.parse(r)}catch(e){console.error(`Failed to parse embeddedConfig:`,e)}x(!0,e),e.defaultTab&&h(e.defaultTab)}},[]),(0,w.useEffect)(()=>{_(new URLSearchParams(n.search).get(`tunnelUrl`))},[n.search,_]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(e)&&h(e)},[n.search,h]);let k=(0,w.useRef)(null),A=(0,w.useRef)(Date.now()),j=(0,w.useRef)(new Set),M=(0,w.useRef)(0);(0,w.useEffect)(()=>{let e=()=>{M.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,w.useEffect)(()=>{let e=()=>{try{let e=Math.round((Date.now()-A.current)/1e3);ef.getInstance().capture(new qd({durationSeconds:e,tabsVisited:j.current.size,toolsExecuted:M.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let N=(0,w.useCallback)(e=>{try{ef.getInstance().capture(new Gd({tab:e,previousTab:k.current})).catch(()=>{})}catch{}k.current=e,j.current.add(e),h(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[h,t,n.search]);(0,w.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;f&&g(f,`sampling`,t)},t=e=>{let t=e.detail.requestId;f&&g(f,`elicitation`,t)},n=e=>{let t=e.detail.toolName;f&&t?g(f,`tools`,t):f&&N(`tools`)};return window.addEventListener(`navigate-to-sampling`,e),window.addEventListener(`navigate-to-elicitation`,t),window.addEventListener(`navigate-to-tool-result`,n),()=>{window.removeEventListener(`navigate-to-sampling`,e),window.removeEventListener(`navigate-to-elicitation`,t),window.removeEventListener(`navigate-to-tool-result`,n)}},[f,N,g]);let P=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null),{isAutoConnecting:L}=hhe({connections:r,addConnection:l,removeConnection:a,configLoaded:c,embedded:y}),ee=(0,w.useCallback)(e=>{ef.getInstance().capture(new Bd({trigger:e})).catch(()=>{}),T(!0)},[]),te=e=>{let i=r.find(t=>t.id===e);if(!i||i.state!==`ready`){PM.error(`Server is not connected and cannot be inspected`);return}p(e);let a=new URLSearchParams(n.search),o=a.get(`tunnelUrl`),s=a.get(`tab`),c=new URLSearchParams;c.set(`server`,e),o&&c.set(`tunnelUrl`,o),s&&c.set(`tab`,s),t(`/?${c.toString()}`)},ne=(0,w.useCallback)(e=>{D(e)},[]),re=(0,w.useCallback)(e=>{if(!E)return;let t=pj(E)||r.find(e=>e.id===E);e.url===E?t&&hj(t,e)?d(E,{name:e.name||e.url}):u(E,{name:e.name,proxyConfig:e.proxyConfig,transportType:e.transportType,oauth:e.oauth}):(a(E),l(e.url,e.name,e.proxyConfig,e.transportType,e.oauth)),D(null),PM.success(`Connection settings updated`)},[E,r,a,l,d,u]),R=(e,i,a)=>{if(console.warn(`[Layout] handleCommandPaletteNavigate called:`,{tab:e,itemName:i,serverId:a}),a){let o=r.find(e=>e.id===a);if(console.warn(`[Layout] Server lookup:`,{serverId:a,serverFound:!!o,serverState:o?.state}),!o||o.state!==`ready`){console.warn(`[Layout] Server not ready, showing error`),PM.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),g(a,e,i);let s=new URLSearchParams(n.search),c=s.get(`tunnelUrl`),l=s.get(`tab`),u=new URLSearchParams;u.set(`server`,a),c&&u.set(`tunnelUrl`,c),e?u.set(`tab`,e):l&&u.set(`tab`,l);let d=`/?${u.toString()}`;console.warn(`[Layout] Navigating to:`,d),t(d)}else console.warn(`[Layout] No serverId, just updating tab to:`,e),N(e)},z=r.find(e=>e.id===f),B=z?z.tools.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ie=z?z.prompts.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ae=z?z.resources.map(e=>({...e,_serverId:z.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]);(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search),i=e.get(`server`);if(i&&(i.startsWith(`http://`)||i.startsWith(`https://`))&&!r.find(e=>e.id===i)){let n=new URLSearchParams(e);n.delete(`server`),n.set(`autoConnect`,i),t(`/?${n.toString()}`,{replace:!0});return}i!==f&&p(i)},[n.search,f,p,r,t]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`server`);if(!e)return;let i=r.find(t=>t.id===e);if(!i){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}if(i.state===`failed`){let e=setTimeout(()=>t(`/`),2e3);return()=>clearTimeout(e)}},[n.search,t,r]),(0,w.useEffect)(()=>{if(!y)return;let e=e=>{if(!e.data||typeof e.data!=`object`||e.data.type!==`mcp-inspector:connect_servers`)return;let t=e.data.servers;if(!Array.isArray(t)||t.length===0)return;let n=null;for(let e of t){if(!e.url||typeof e.url!=`string`)continue;let t=e.url,i=e.name??`Server`,a=e.transportType??`http`,o={...e.headers??{}};if(e.auth?.access_token){let t=e.auth.token_type||`bearer`;o.Authorization=`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.auth.access_token}`}let s={proxyAddress:`${window.location.origin}/inspector/api/proxy`,...Object.keys(o).length>0&&{headers:o}};r.find(e=>e.url===t)||l(t,i,s,a),n||=t}window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:servers_connected`,count:t.length},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[y,r,l]);let oe=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{if(!y||oe.current||f)return;let e=r.find(e=>e.state===`ready`);if(e){oe.current=!0,p(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[y,r,f,p,t,n.search]),Wq({onCommandPalette:()=>ee(`keyboard`),onToolsTab:()=>{z&&N(`tools`)},onPromptsTab:()=>{z&&N(`prompts`)},onResourcesTab:()=>{z&&N(`resources`)},onChatTab:()=>{z&&N(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{m===`tools`&&P.current?P.current.focusSearch():m===`prompts`&&F.current?F.current.focusSearch():m===`resources`&&I.current&&I.current.focusSearch()},onBlurSearch:()=>{m===`tools`&&P.current?P.current.blurSearch():m===`prompts`&&F.current?F.current.blurSearch():m===`resources`&&I.current&&I.current.blurSearch()}}),L)return(0,S.jsx)(`div`,{className:`h-screen bg-white dark:bg-zinc-900 flex items-center justify-center`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(zq,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})});let se=y&&b.singleTab,ce=y?{backgroundColor:b.backgroundColor||`#f3f3f3`,padding:se?`0`:b.padding||`0.5rem`}:{};return(0,S.jsx)(Od,{children:(0,S.jsxs)(`div`,{className:y?se?`h-screen flex flex-col`:`h-screen flex flex-col gap-2 sm:gap-4`:`h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4`,style:ce,children:[!se&&(0,S.jsx)(eRe,{connections:r,selectedServer:z,activeTab:m,onServerSelect:te,onTabChange:N,onCommandPaletteOpen:()=>ee(`button`),onOpenConnectionOptions:ne,embedded:y}),(0,S.jsx)(`main`,{className:se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:`flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto`,children:(0,S.jsx)(sLe,{selectedServer:z,activeTab:m,toolsSearchRef:P,promptsSearchRef:F,resourcesSearchRef:I,children:e})}),(0,S.jsx)(oTe,{isOpen:C,onOpenChange:T,tools:B,prompts:ie,resources:ae,savedRequests:O,connections:r,selectedServer:z,tunnelUrl:v,onNavigate:R,onServerSelect:te}),(0,S.jsx)(BV,{connection:E&&r.find(e=>e.id===E)||null,open:E!==null,onOpenChange:e=>{e||D(null)},onConnect:re})]})})}function J9(e){let t=a(()=>{throw Error(`Invalid url to pass to open(): ${e}`)},`abort`),n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(nRe).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}a(J9,`sanitizeUrl`);function nRe([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}a(nRe,`sanitizeParam`);var rRe=class e{static{a(this,`OAuthSessionStore`)}serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;scope;store;_cachedAuthServerUrl=null;_cachedMetadata=null;_refreshPromise=null;constructor(t,n,r){this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=e.hashString(t),this.clientName=n.clientName||`mcp-use`,this.clientUri=n.clientUri||(typeof window<`u`?window.location.origin:``),this.logoUri=n.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=J9(n.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.scope=n.scope,this.store=r}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}static hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri,...this.scope?{scope:this.scope}:{}}}async tokens(){let e=this.getKey(`tokens`),t=await this.store.get(e);if(t)try{let e=JSON.parse(t);if(e.access_token&&e.refresh_token)try{let t=JSON.parse(atob(e.access_token.split(`.`)[1]));if(t.exp&&Date.now()>=(t.exp-30)*1e3){console.log(`[tokens] Access token expiring soon, refreshing...`);let t=await this._dedupedRefresh(e);if(t)return console.log(`[tokens] Refreshed successfully`),t}}catch{}return e}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),await this.store.remove(e);return}}async saveTokens(e){await this.store.set(this.getKey(`tokens`),JSON.stringify(e)),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`))}async clientInformation(){let e=this.getKey(`client_info`),t=await this.store.get(e);if(t)try{let n=JSON.parse(t),r=Array.isArray(n.redirect_uris)?n.redirect_uris:[];if(!(r.length===0||r.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),await this.store.remove(e),await this.store.remove(this.getKey(`tokens`)),await this.store.remove(this.getKey(`last_auth_url`));return}return n}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),await this.store.remove(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);await this.store.set(t,JSON.stringify(e))}async saveCodeVerifier(e){await this.store.set(this.getKey(`code_verifier`),e)}async codeVerifier(){let e=this.getKey(`code_verifier`),t=await this.store.get(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async invalidateCredentials(e){switch(e){case`all`:await this.store.remove(this.getKey(`tokens`)),await this.store.remove(this.getKey(`client_info`)),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`));break;case`client`:await this.store.remove(this.getKey(`client_info`));break;case`tokens`:await this.store.remove(this.getKey(`tokens`));break;case`verifier`:await this.store.remove(this.getKey(`code_verifier`));break;default:break}}async storeAuthorizationState(e,t={}){let n=globalThis.crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${n}`,i=await this.store.get(this.getKey(`code_verifier`)),a={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,codeVerifier:i||void 0,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,...t.extraProviderOptions??{}},flowType:t.flowType,returnUrl:t.returnUrl};e.searchParams.set(`state`,n);let o=J9(e.toString());return await this.store.set(r,JSON.stringify(a)),await this.store.set(this.getKey(`last_auth_url`),o),o}async _refresh(e){try{if(!this._cachedAuthServerUrl||!this._cachedMetadata){let e=(await bk(this.serverUrl)).authorization_servers?.[0];if(!e)return null;let t=await Sk(e);if(!t)return null;this._cachedAuthServerUrl=e,this._cachedMetadata=t}let t=await this.clientInformation();if(!t)return null;let n=await Ck(this._cachedAuthServerUrl,{metadata:this._cachedMetadata,clientInformation:t,refreshToken:e.refresh_token});return await this.saveTokens(n),n}catch{return null}}async _dedupedRefresh(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=this._refresh(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async forceRefresh(){let e=await this.store.get(this.getKey(`tokens`));if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return t.refresh_token?this._dedupedRefresh(t):null}},iRe=class{static{a(this,`LocalStorageKVStore`)}get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}keys(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&e.push(n)}return e}};async function aRe(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}a(aRe,`serializeBody`);var oRe=class{static{a(this,`BrowserOAuthClientProvider`)}serverUrl;staticClientInfo;session;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;originalFetch;_lastOriginalResource=null;onPopupWindow;constructor(e,t={}){this.serverUrl=e,this.session=new rRe(e,t,new iRe),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.staticClientInfo=t.staticClientInfo,this.onPopupWindow=t.onPopupWindow}get storageKeyPrefix(){return this.session.storageKeyPrefix}get serverUrlHash(){return this.session.serverUrlHash}get clientName(){return this.session.clientName}get clientUri(){return this.session.clientUri}get logoUri(){return this.session.logoUri}get callbackUrl(){return this.session.callbackUrl}get scope(){return this.session.scope}getKey(e){return this.session.getKey(e)}installFetchInterceptor(){if(!this.oauthProxyUrl){console.warn(`[BrowserOAuthProvider] No OAuth proxy URL configured, skipping fetch interceptor installation`);return}if(!this.originalFetch)this.originalFetch=window.fetch;else{console.warn(`[BrowserOAuthProvider] Fetch interceptor already installed`);return}let e=this.oauthProxyUrl,t=this.connectionUrl,n=this.serverUrl,r=this.originalFetch;console.log(`[BrowserOAuthProvider] Installing fetch interceptor with proxy: ${e}`),window.fetch=async(i,a)=>{let o=typeof i==`string`?i:i instanceof URL?i.toString():i.url;if(!(o.includes(`/.well-known/`)||o.match(/\/(register|token|authorize)$/)))return await r(i,a);try{let t=new URL(o),n=new URL(e);if(t.origin===n.origin&&(t.pathname.startsWith(n.pathname)||o.includes(`/inspector/api/oauth`)))return await r(i,a)}catch{}try{let i=o.includes(`/.well-known/`),s=i?`${e}/metadata?url=${encodeURIComponent(o)}`:`${e}/proxy`;if(console.log(`[OAuth Proxy] Routing ${i?`metadata`:`request`} through: ${s}`),i){let e={...a?.headers?Object.fromEntries(new Headers(a.headers)):{}};t&&(e[`X-Connection-URL`]=t);let i=new URL(s);n&&i.searchParams.set(`mcp_url`,n);let o=await r(i.toString(),{...a,method:`GET`,headers:e});try{if((o.headers.get(`content-type`)||``).includes(`application/json`)){let e=await o.clone().json(),t=e&&typeof e==`object`&&typeof e._original_resource==`string`?e._original_resource:null;t&&(this._lastOriginalResource=t)}}catch{}return o}let c=a?.body?await aRe(a.body):void 0,l=await(await r(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:c})})).json();return new Response(JSON.stringify(l.body),{status:l.status,statusText:l.statusText,headers:new Headers(l.headers)})}catch(e){return console.error(`[OAuth Proxy] Request failed, falling back to direct fetch:`,e),await r(i,a)}}}restoreFetch(){this.originalFetch&&=(console.log(`[BrowserOAuthProvider] Restoring original fetch`),window.fetch=this.originalFetch,void 0)}get redirectUrl(){return this.session.redirectUrl}get clientMetadata(){return this.session.clientMetadata}tokens(){return this.session.tokens()}saveTokens(e){return this.session.saveTokens(e)}async clientInformation(){return this.staticClientInfo?this.staticClientInfo:this.session.clientInformation()}async saveClientInformation(e){if(!this.staticClientInfo)return this.session.saveClientInformation(e)}codeVerifier(){return this.session.codeVerifier()}saveCodeVerifier(e){return this.session.saveCodeVerifier(e)}invalidateCredentials(e){return this.session.invalidateCredentials(e)}async prepareAuthorizationUrl(e){return this.rewriteResourceIfLocalProxy(e),this.session.storeAuthorizationState(e,{extraProviderOptions:{oauthProxyUrl:this.oauthProxyUrl,connectionUrl:this.connectionUrl,...this.staticClientInfo?{staticClientInfo:this.staticClientInfo}:{},...this.scope?{scope:this.scope}:{}},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0})}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}rewriteResourceIfLocalProxy(e){let t=e.searchParams.get(`resource`),n=!!(t&&(t.includes(`/inspector/api/proxy`)||t.includes(`/api/proxy`)||t.includes(`localhost:3000`))),r=!!(t&&this.connectionUrl&&t===this.connectionUrl),i=!!(t&&(this._lastOriginalResource||this.serverUrl)&&(r||n)),a=this._lastOriginalResource||this.serverUrl;i&&a&&e.searchParams.set(`resource`,a)}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?J9(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}},Y9=null;function X9(){if(typeof window>`u`)return!1;let e=window.name;return typeof e==`string`&&e.startsWith(`mcp_auth_`)}a(X9,`isMcpAuthPopupWindow`);var sRe=`mcp_auth_callback`;function Z9(e,t){if(typeof BroadcastChannel>`u`)return;let n=null;try{n=new BroadcastChannel(sRe),n.postMessage(e?{type:`mcp_auth_callback`,success:!0}:{type:`mcp_auth_callback`,success:!1,error:t??`Unknown error`})}catch(e){console.warn(`[mcp-callback] Failed to broadcast auth callback over BroadcastChannel:`,e)}finally{n&&setTimeout(()=>{try{n?.close()}catch{}},0)}}a(Z9,`broadcastAuthCallback`);function Q9(e,t,n=`success`){if(!(typeof document>`u`))try{document.body.innerHTML=``;let r=document.createElement(`div`);r.style.fontFamily=`sans-serif`,r.style.padding=`20px`;let i=document.createElement(`h1`);i.textContent=e,r.appendChild(i);let a=document.createElement(`p`);n===`error`&&(a.style.color=`red`,a.style.backgroundColor=`#ffebeb`,a.style.border=`1px solid red`,a.style.padding=`10px`,a.style.borderRadius=`4px`),a.textContent=t,r.appendChild(a);let o=document.createElement(`p`);o.textContent=`You can close this window or `;let s=document.createElement(`a`);s.href=`#`,s.textContent=`click here to close`,s.onclick=e=>(e.preventDefault(),window.close(),!1),o.appendChild(s),o.appendChild(document.createTextNode(`.`)),r.appendChild(o),document.body.appendChild(r)}catch{}}a(Q9,`renderCloseWindowMessage`);function cRe(){return Y9||(Y9=lRe(),Y9)}a(cRe,`onMcpAuthorization`);async function lRe(){let e=new URLSearchParams(window.location.search),t=e.get(`code`),n=e.get(`state`),r=e.get(`error`),i=e.get(`error_description`),o=`[mcp-callback]`;console.log(`${o} Handling callback...`,{code:t,state:n,error:r,errorDescription:i});let s=null,c=null,l=null;try{if(!n)throw Error(`State parameter not found or invalid in callback query parameters.`);console.log(`[mcp-callback] Looking for state: ${n}`),console.log(`[mcp-callback] All localStorage keys:`,Object.keys(localStorage));let e=`mcp:auth:state_${n}`;if(localStorage.getItem(e))l=e,console.log(`[mcp-callback] Found state with default key: ${e}`);else{let e=`:state_${n}`;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n&&n.endsWith(e)){l=n,console.log(`[mcp-callback] Found state with dynamic key: ${n}`);break}}}if(!l){let e=Object.keys(localStorage).filter(e=>e.includes(`state`));throw console.log(`[mcp-callback] State keys in storage:`,e),Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`)}let u=localStorage.getItem(l);if(!u)throw Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(u)}catch{throw Error(`Failed to parse stored OAuth state.`)}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(l),Error(`OAuth state has expired. Please try initiating authentication again.`);if(r){console.log(`${o} OAuth error received: ${r} - ${i||`No description`}`);let e=c.flowType===`redirect`,t=window.opener&&!window.opener.closed,n=X9(),s=a(e=>{console.log(`${o} Returning to: ${e}`),localStorage.removeItem(l);let t=new URL(e);t.searchParams.set(`auth_error`,r),i&&t.searchParams.set(`auth_error_description`,i),window.location.href=t.toString()},`redirectWithError`);if(t){window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:`${r}${i?`: ${i}`:``}`},window.location.origin),localStorage.removeItem(l),window.close();return}if(c.returnUrl&&(e||!n)){s(c.returnUrl);return}if(n){Z9(!1,`${r}${i?`: ${i}`:``}`),localStorage.removeItem(l),Q9(`Authentication Error`,`${r}${i?`: ${i}`:``}`,`error`);try{window.close()}catch{}return}throw Error(`OAuth error: ${r}${i?` - ${i}`:``}`)}if(!t)throw Error(`Authorization code not found in callback query parameters.`);if(!c.providerOptions)throw Error(`Stored state is missing required provider options.`);let{serverUrl:d,...f}=c.providerOptions,p=f.connectionUrl,m=!!(p&&/run\.mcp-use\.com|mcp-use\.run/.test(p)),h=m?p:void 0,g=f.oauthProxyUrl,_=h;if(!g&&_)try{let e=new URL(window.location.href);if(e.pathname.includes(`/oauth/callback`)){let t=e.pathname.replace(/\/oauth\/callback.*$/,``);(!t||t===``)&&(/run\.mcp-use\.com|mcp-use\.run/.test(_)?console.log(`${o} Gateway connection detected; skipping default /inspector OAuth proxy inference`):(t=`/inspector`,console.log(`${o} Callback at root /oauth/callback, using /inspector as base path for OAuth proxy`))),t&&(g=`${e.origin}${t}/api/oauth`),console.log(`${o} Inferred OAuth proxy URL from callback: ${g}`)}}catch(e){console.warn(`${o} Could not infer OAuth proxy URL:`,e)}console.log(`${o} Re-instantiating provider for server: ${d}`),s=new oRe(d,{...f,oauthProxyUrl:g,connectionUrl:_});let v=`${f.storageKeyPrefix}_${c.serverUrlHash}_code_verifier`,y=c.codeVerifier||localStorage.getItem(v);if(y)localStorage.setItem(v,y),localStorage.setItem(s.getKey(`code_verifier`),y);else throw Error(`[${f.storageKeyPrefix}] Code verifier missing for OAuth state ${n}. Please restart authentication.`);g&&(console.log(`${o} Installing fetch interceptor for token exchange (proxy: ${g})`),s.installFetchInterceptor()),console.log(`${o} Calling SDK auth() to exchange code...`);let b=m&&_?_:d;console.log(`${o} Using SDK serverUrl: ${b} (connectionUrl: ${_||`none`})`);let x=await gk(s,{serverUrl:b,authorizationCode:t});if(x===`AUTHORIZED`){console.log(`${o} Authorization successful via SDK auth().`);let e=c.flowType===`redirect`,t=X9();if(e&&c.returnUrl)console.log(`${o} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(l),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${o} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:`mcp_auth_callback`,success:!0},window.location.origin),localStorage.removeItem(l),window.close();else if(t){console.log(`${o} Popup flow complete but opener was lost; broadcasting success and rendering close-window message.`),Z9(!0),localStorage.removeItem(l),Q9(`Authentication Successful!`,`You're authenticated. You can close this window and return to the app.`);try{window.close()}catch{}}else if(c.returnUrl)console.log(`${o} Popup flow without opener (top-level nav). Returning to: ${c.returnUrl}`),localStorage.removeItem(l),window.location.href=c.returnUrl;else{console.warn(`${o} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(l);let e=window.location.pathname.split(`/`).filter(Boolean),t=e.length>0&&e[e.length-1]===`callback`?`/`+e.slice(0,-2).join(`/`):`/`;window.location.href=t||`/`}}else throw console.warn(`${o} SDK auth() returned unexpected status: ${x}`),Error(`Unexpected result from authentication library: ${x}`)}catch(e){console.error(`${o} Error during OAuth callback handling:`,e);let t=e instanceof Error?e.message:String(e);window.opener&&!window.opener.closed?window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:t},window.location.origin):X9()&&Z9(!1,t);try{document.body.innerHTML=``;let n=document.createElement(`div`);n.style.fontFamily=`sans-serif`,n.style.padding=`20px`;let r=document.createElement(`h1`);r.textContent=`Authentication Error`,n.appendChild(r);let i=document.createElement(`p`);i.style.color=`red`,i.style.backgroundColor=`#ffebeb`,i.style.border=`1px solid red`,i.style.padding=`10px`,i.style.borderRadius=`4px`,i.textContent=t,n.appendChild(i);let a=document.createElement(`p`);a.textContent=`You can close this window or `;let o=document.createElement(`a`);if(o.href=`#`,o.textContent=`click here to close`,o.onclick=e=>(e.preventDefault(),window.close(),!1),a.appendChild(o),a.appendChild(document.createTextNode(`.`)),n.appendChild(a),e instanceof Error&&e.stack){let t=document.createElement(`pre`);t.style.fontSize=`0.8em`,t.style.color=`#555`,t.style.marginTop=`20px`,t.style.whiteSpace=`pre-wrap`,t.textContent=e.stack,n.appendChild(t)}document.body.appendChild(n)}catch(e){console.error(`${o} Could not display error in callback window:`,e)}l&&localStorage.removeItem(l),s&&localStorage.removeItem(s.getKey(`last_auth_url`))}}a(lRe,`doOnMcpAuthorization`);async function uRe(e,t=fetch){let n=e.replace(/\/$/,``),r=await t(n.endsWith(`/mcp`)?n:`${n}/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jsonrpc:`2.0`,method:`initialize`,id:1,params:{}})});if(r.status!==401)return{};let{resourceMetadataUrl:i,scope:a}=vk(r);return{resourceMetadataUrl:i,scope:a}}a(uRe,`probeAuthParams`);function dRe(){let[e,t]=(0,w.useState)(`processing`),[n,r]=(0,w.useState)(``);return(0,w.useEffect)(()=>{console.log(`[OAuthCallback] Component mounted, handling authorization...`),console.log(`[OAuthCallback] Current URL:`,window.location.href),cRe().then(()=>{console.log(`[OAuthCallback] Authorization successful`),t(`success`)}).catch(e=>{console.error(`[OAuthCallback] Authorization failed:`,e),t(`error`),r(e instanceof Error?e.message:String(e))})},[]),e===`processing`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(Zf,{className:`h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Completing authentication...`})]})}):e===`error`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-red-600 dark:text-red-400 mb-2`,children:`Authentication Error`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400 mb-4`,children:n}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 dark:text-zinc-500`,children:`You can close this window and try again.`})]})}):(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-green-600 dark:text-green-400 mb-2`,children:`Authentication Successful!`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Redirecting you back...`})]})})}var fRe={model:`stub-model`,stopReason:`endTurn`,role:`assistant`,content:{type:`text`,text:`positive`}};function pRe({requestId:e,serverName:t,onViewDetails:n,onApprove:r,onDeny:i}){return(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`strong`,{children:`Sampling Request Received`}),(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:[`New request from `,t]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`button`,{"data-testid":`sampling-toast-view-details`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),n()},children:`View Details`}),(0,S.jsx)(`button`,{"data-testid":`sampling-toast-approve`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),r(fRe)},children:`Approve`}),(0,S.jsx)(`button`,{"data-testid":`sampling-toast-deny`,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:e=>{e.stopPropagation(),i()},children:`Deny`})]})]})}var $9=`preview-default`,mRe=`preview-bundle`;function hRe(e){if(!e)return{};try{let t=atob(e),n=JSON.parse(t);if(n&&typeof n==`object`)return n}catch{}return{}}function gRe(e,t){let n=`ui://widget/${t}`,r=e.find(e=>e.uri.startsWith(`${n}.`)&&e.uri.endsWith(`.html`));return r?r.uri:e.find(e=>e.name===t)?.uri}function _Re(){let e=globalThis.__mcpUsePreviewBundle;if(!e||typeof e!=`object`)return;let t=e;if(typeof t.resourceUri==`string`)return t}function vRe(){(0,w.useEffect)(()=>{let e=document.documentElement,t=document.body,n=e.style.margin,r=t.style.margin,i=t.style.overflow;return e.style.margin=`0`,t.style.margin=`0`,t.style.overflow=`hidden`,()=>{e.style.margin=n,t.style.margin=r,t.style.overflow=i}},[])}function yRe(e){(0,w.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{await document.fonts.ready}catch{}t||(await new Promise(e=>requestAnimationFrame(()=>e(void 0))),await new Promise(e=>requestAnimationFrame(()=>e(void 0))),!t&&document.body.setAttribute(`data-view-ready`,`true`))})(),()=>{t=!0,document.body.removeAttribute(`data-view-ready`)}},[e])}function bRe(e,t){(0,w.useEffect)(()=>{if(!e)return;let n=!1,r,i,a=e=>{n||(e&&(document.body.dataset.viewX=String(Math.round(e.left)),document.body.dataset.viewY=String(Math.round(e.top)),document.body.dataset.viewWidth=String(Math.round(e.width)),document.body.dataset.viewHeight=String(Math.round(e.height))),document.body.setAttribute(`data-view-ready`,`true`))};return(async()=>{try{await document.fonts.ready}catch{}if(n||(await new Promise(e=>requestAnimationFrame(()=>e(void 0))),await new Promise(e=>requestAnimationFrame(()=>e(void 0))),n))return;let e=t.current?.querySelector(`iframe`);if(!e){a(null);return}let o=()=>{r&&clearTimeout(r),r=setTimeout(()=>{n||(i?.disconnect(),a(e.getBoundingClientRect()))},250)};i=new ResizeObserver(o),i.observe(e),o()})(),()=>{n=!0,r&&clearTimeout(r),i?.disconnect(),document.body.removeAttribute(`data-view-ready`),delete document.body.dataset.viewX,delete document.body.dataset.viewY,delete document.body.dataset.viewWidth,delete document.body.dataset.viewHeight}},[e,t])}function xRe({view:e,bundle:t,widthOverride:n}){let[r,i]=(0,w.useState)(!1),a=(0,w.useRef)(null);vRe(),bRe(r,a);let o=(0,w.useMemo)(()=>async e=>{if(e===t.resourceUri)return t.resourceContents;throw Error(`Resource ${e} not in screenshot bundle`)},[t]);return(0,S.jsx)(`div`,{ref:a,style:{width:`100vw`,height:`100vh`},children:(0,S.jsx)(N7,{serverId:mRe,toolCallId:(0,w.useMemo)(()=>`preview-bundle-${e}-${Date.now().toString(36)}`,[e]),toolName:e,toolInput:t.toolInput,toolOutput:t.toolOutput,resourceUri:t.resourceUri,readResource:o,displayMode:`inline`,inlineWidthOverride:n,noWrapper:!0,chromeless:!0,onReady:()=>i(!0)})})}function SRe({view:e}){let[t]=OM(),n=(0,w.useMemo)(()=>hRe(t.get(`props`)),[t]),r=(0,w.useMemo)(()=>t.get(`server`)||`${window.location.origin}/mcp`,[t]),i=(0,w.useMemo)(()=>{let e=t.get(`headers`);if(e)try{let t=JSON.parse(atob(e));if(t&&typeof t==`object`)return t}catch{}},[t]),{servers:a,addServer:o,storageLoaded:s}=uj(),c=a.find(e=>e.id===$9);(0,w.useEffect)(()=>{s&&o($9,{url:r,name:`Preview`,...i?{headers:i}:{}})},[s,r,i,o]);let l=c?.state===`ready`,u=c?.state===`failed`,d=(0,w.useMemo)(()=>{if(l)return gRe(c.resources,e)},[l,c?.resources,e]),f=(0,w.useMemo)(()=>`preview-${e}-${Date.now().toString(36)}`,[e]),p=(0,w.useMemo)(()=>async e=>{if(!c?.readResource)throw Error(`Server not ready`);return c.readResource(e)},[c]),[m,h]=(0,w.useState)(!1);return yRe(m),vRe(),u?(0,S.jsxs)(`div`,{style:{padding:16,fontFamily:`monospace`,color:`#b00`},children:[`Failed to connect to MCP server at `,r,`.`]}):!l||!d?l&&!d?(0,S.jsxs)(`div`,{style:{padding:16,fontFamily:`monospace`,color:`#b00`},children:[`View "`,e,`" not found on `,r,`.`]}):(0,S.jsx)(`div`,{style:{width:`100vw`,height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontFamily:`monospace`,color:`var(--muted-foreground, #888)`},children:`Loading…`}):(0,S.jsx)(`div`,{style:{width:`100vw`,height:`100vh`},children:(0,S.jsx)(N7,{serverId:$9,toolCallId:f,toolName:e,toolInput:n.toolInput,toolOutput:n.toolOutput,resourceUri:d,readResource:p,displayMode:`fullscreen`,noWrapper:!0,chromeless:!0,onReady:()=>h(!0)})})}function CRe(){let e=Wpe(),[t]=OM(),n=e.view??``,r=(0,w.useMemo)(()=>_Re(),[]),i=(0,w.useMemo)(()=>{let e=t.get(`width`);if(!e)return;let n=parseInt(e,10);return Number.isFinite(n)&&n>0?n:void 0},[t]);return r?(0,S.jsx)(xRe,{view:n,bundle:r,widthOverride:i}):(0,S.jsx)(SRe,{view:n})}var wRe=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},TRe=w.createContext(void 0),ERe={setTheme:e=>{},themes:[]},DRe=()=>w.useContext(TRe)??ERe;w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return w.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${wRe.toString()})(${u})`}})});function ORe({...e}){let{theme:t=`system`}=DRe();return(0,S.jsx)(mhe,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function kRe({activeTabRef:e}){let{activeTab:t}=Uq();return(0,w.useEffect)(()=>{e.current=t},[t,e]),null}function ARe(){let e=(0,w.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,w.useMemo)(()=>n?void 0:new ape(`mcp-inspector-connections`),[n]),a=window.__MCP_PROXY_URL__,o=a?`${window.location.origin}${a}`:void 0;return(0,w.useEffect)(()=>{let e=t.get(`auth_error`);if(!e)return;let n=t.get(`auth_error_description`);PM.error(`OAuth authentication failed: ${n||e}`,{duration:1/0,closeButton:!0});let r=new URLSearchParams(t);r.delete(`auth_error`),r.delete(`auth_error_description`);let i=r.toString();window.history.replaceState({},``,`${window.location.pathname}${i?`?${i}`:``}`)},[]),(0,S.jsx)(Sge,{forcedTheme:r||void 0,children:(0,S.jsx)(uDe,{children:(0,S.jsx)(lj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}/inspector/oauth/callback`,defaultAutoProxyFallback:o?{enabled:!0,proxyAddress:o}:!1,clientInfo:{name:`mcp-use Inspector`,version:window.__INSPECTOR_VERSION__,websiteUrl:`https://mcp-use.com`,icons:[{src:`https://mcp-use.com/logo.png`}],capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},onServerAdded:(e,t)=>{console.log(`[Inspector] Server added:`,e,t.state)},onServerRemoved:e=>{console.log(`[Inspector] Server removed:`,e)},onServerStateChange:(e,t)=>{console.log(`[Inspector] Server state changed:`,e,t)},onSamplingRequest:(e,t,n,r,i)=>{let a=PM((0,S.jsx)(pRe,{requestId:e.id,serverName:n,onViewDetails:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),PM.dismiss(a)},onApprove:t=>{r(e.id,t),PM.success(`Sampling request approved`),PM.dismiss(a)},onDeny:()=>{i(e.id,`User denied from toast`),PM.dismiss(a)}}),{duration:1/0})},onElicitationRequest:(t,n,r,i,a)=>{if(e.current===`chat`)return;let o=t.request.mode||`form`,s=t.request.message,c=o===`url`&&`url`in t.request?t.request.url:void 0,l=PM((0,S.jsx)(C,{requestId:t.id,serverName:r,mode:o,message:s,url:c,onViewDetails:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),PM.dismiss(l)},onOpenUrl:o===`url`&&c?()=>{window.open(c,`_blank`),PM.dismiss(l)}:void 0,onCancel:()=>{a(t.id,`User cancelled from toast`),PM.dismiss(l)}}),{duration:1/0})},children:(0,S.jsxs)(Dwe,{children:[(0,S.jsx)(kRe,{activeTabRef:e}),(0,S.jsx)(Mme,{basename:`/inspector`,children:(0,S.jsxs)(ime,{children:[(0,S.jsx)(cM,{path:`/oauth/callback`,element:(0,S.jsx)(dRe,{})}),(0,S.jsx)(cM,{path:`/preview/:view`,element:(0,S.jsx)(CRe,{})}),(0,S.jsx)(cM,{path:`/`,element:(0,S.jsx)(tRe,{children:(0,S.jsx)(Ewe,{})})})]})}),(0,S.jsx)(ORe,{position:`top-center`})]})})})})}var jRe=document.getElementById(`root`);jRe?x.createRoot(jRe).render((0,S.jsx)(ARe,{})):console.error(`[inspector] Root element not found`);
|