@mcpc-tech/unplugin-dev-inspector-mcp 0.0.18 → 0.0.20

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/README.md CHANGED
@@ -1,24 +1,13 @@
1
- ---
2
- title: Inspect Web Mcp
3
- emoji: 😻
4
- colorFrom: purple
5
- colorTo: red
6
- sdk: gradio
7
- sdk_version: 5.49.1
8
- app_file: app.py
9
- pinned: false
10
- short_description: AI-powered web debugging with visual element inspection
11
- tags:
12
- - building-mcp-track-creative
13
- - mcp-in-action-track-creative
14
- ---
1
+ <p align="center">
2
+ <img src="./assets/logo.svg" alt="DevInspector Logo" width="200" height="200" />
3
+ </p>
15
4
 
16
5
  # @mcpc-tech/unplugin-dev-inspector-mcp
17
6
 
18
7
  [![npm version](https://img.shields.io/npm/v/@mcpc-tech/unplugin-dev-inspector-mcp.svg)](https://www.npmjs.com/package/@mcpc-tech/unplugin-dev-inspector-mcp)
19
8
  [![npm downloads](https://img.shields.io/npm/dm/@mcpc-tech/unplugin-dev-inspector-mcp.svg)](https://www.npmjs.com/package/@mcpc-tech/unplugin-dev-inspector-mcp)
20
9
 
21
- **AI-powered visual debugging for React & Vue via MCP and ACP.**
10
+ **AI-powered visual debugging for React, Vue, Svelte, SolidJS, Preact & Next.js via MCP and ACP.**
22
11
 
23
12
  DevInspector connects your web app directly to your AI agent. Click any element to instantly send its source code, style, and network context to the AI for analysis and fixing.
24
13
 
@@ -29,6 +18,7 @@ Works with any MCP-compatible AI client. Supports ACP agents: **Claude Code**, *
29
18
  - [Demo Video](#-demo-video)
30
19
  - [Key Features](#-key-features)
31
20
  - [Quick Start](#-quick-start)
21
+ - [Framework Support](#framework-support)
32
22
  - [Configuration](#-configuration)
33
23
  - [How It Works](#-what-it-does)
34
24
  - [Workflow Modes](#-two-workflow-modes)
@@ -88,12 +78,49 @@ yarn add -D @mcpc-tech/unplugin-dev-inspector-mcp
88
78
 
89
79
  Add DevInspector to your project:
90
80
 
81
+ ### ⚡ Automated Setup (Recommended)
82
+
83
+ Run the setup command to automatically configure your `vite.config.ts`, `webpack.config.js`, or `next.config.js`:
84
+
85
+ ```bash
86
+ npx @mcpc-tech/unplugin-dev-inspector-mcp setup
87
+ ```
88
+
89
+ **Options:**
90
+ - `--dry-run` - Preview changes without applying them
91
+ - `--config <path>` - Specify config file path (auto-detect by default)
92
+ - `--bundler <type>` - Specify bundler type: vite, webpack, nextjs
93
+ - `--no-backup` - Skip creating backup files
94
+ - `--help` - Show help message
95
+
96
+ **Examples:**
97
+ ```bash
98
+ # Preview changes before applying
99
+ npx @mcpc-tech/unplugin-dev-inspector-mcp setup --dry-run
100
+
101
+ # Setup specific config file
102
+ npx @mcpc-tech/unplugin-dev-inspector-mcp setup --config vite.config.ts
103
+
104
+ # Setup for specific bundler
105
+ npx @mcpc-tech/unplugin-dev-inspector-mcp setup --bundler vite
106
+ ```
107
+
108
+ This will:
109
+ - Detect your bundler configuration
110
+ - Add the necessary import
111
+ - Add the plugin to your configuration
112
+ - Create a backup of your config file
113
+
114
+ ### Manual Configuration
115
+
116
+ If you prefer to configure it manually:
117
+
91
118
  ### Vite
92
119
 
93
120
  ```diff
94
121
  // vite.config.ts
95
122
  +import DevInspector from '@mcpc-tech/unplugin-dev-inspector-mcp';
96
- import react from '@vitejs/plugin-react'; // or vue()
123
+ import react from '@vitejs/plugin-react'; // or vue(), svelte(), solid(), preact()
97
124
 
98
125
  export default {
99
126
  plugins: [
@@ -102,12 +129,12 @@ Add DevInspector to your project:
102
129
  showInspectorBar: true, // Default: true. Set to false to hide the UI.
103
130
  + autoOpenBrowser: false, // Default: false. Automatically open browser when server starts.
104
131
  }),
105
- react(), // or vue()
132
+ react(), // or vue(), svelte(), solid(), preact()
106
133
  ],
107
134
  };
108
135
  ```
109
136
 
110
- > ⚠️ **Plugin order matters:** Place `DevInspector.vite()` **before** `react()`, `vue()`, or `preact()`. Otherwise source locations may show `unknown:0:0`.
137
+ > ⚠️ **Plugin order matters:** Place `DevInspector.vite()` **before** `react()`, `vue()`, `svelte()`, `solid()`, or `preact()`. Otherwise source locations may show `unknown:0:0`.
111
138
 
112
139
  #### For Non-HTML Projects (Miniapps, Library Bundles)
113
140
 
@@ -201,6 +228,22 @@ export default function RootLayout({ children }) {
201
228
 
202
229
  > 💡 **Note:** Webpack and Next.js use a standalone server on port 8888. Run `next dev --webpack` for Webpack mode (Next.js 16+ defaults to Turbopack).
203
230
 
231
+ ## Framework Support
232
+
233
+ ### ✅ Fully Supported
234
+
235
+ - **React** - `.jsx` and `.tsx` files (Vite, Webpack, Next.js)
236
+ - **Vue** - `.vue` single-file components (Vite, Webpack)
237
+ - **Svelte** - `.svelte` components (Vite, Webpack)
238
+ - **SolidJS** - `.jsx` and `.tsx` files (Vite, Webpack)
239
+ - **Preact** - `.jsx` and `.tsx` files (Vite, Webpack)
240
+ - **Next.js** - React with Webpack mode
241
+
242
+ ### 🚧 In Progress
243
+
244
+ - **Angular** - Support coming soon
245
+
246
+
204
247
 
205
248
  ## Configuration
206
249
 
@@ -6932,7 +6932,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
6932
6932
  `)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(Ntn);if(r&&!n){let t=r[2];if(!t||z7.test(t))return e;if(Ytn(e)%2==1)return`${e}\``}return e},Ztn=e=>{let t=e.match(Ptn);if(t){let n=t[2];if(!n||z7.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},Qtn=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
6933
6933
  `,t)!==-1&&!e.endsWith(`
6934
6934
  `)?`${e}
6935
- $$`:`${e}$$`},$tn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},enn=e=>{if(V7(e)||ztn.test(e))return e;let t=e.match(Atn);if(t){let n=t[2];if(!n||z7.test(n))return e;if($tn(e)%2==1)return`${e}***`}return e},tnn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=Btn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=enn(t),t=Vtn(t),t=Htn(t),t=Wtn(t),t=qtn(t),t=Xtn(t),t=Ztn(t),t=Qtn(t),t)},nnn={harden:[fhe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:XSe,katex:[Ay,{errorColor:`var(--color-muted-foreground)`}]},rnn={gfm:[hEe,{}],math:[DEe,{singleDollarTextMath:!1}],cjkFriendly:[kCe,{}],cjkFriendlyGfmStrikethrough:[jCe,{}]},inn=(0,_.createContext)([`github-light`,`github-dark`]),ann=(0,_.createContext)(void 0),onn=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),snn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?tnn(e.trim()):e,[e,t]);return(0,S.jsx)(she,{...n,children:r})},(e,t)=>e.content===t.content);snn.displayName=`Block`;var cnn=[`github-light`,`github-dark`],lnn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(nnn),remarkPlugins:i=Object.values(rnn),className:a,shikiTheme:o=cnn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=snn,parseMarkdownIntoBlocksFn:m=Etn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===Ay:e===Ay)&&Promise.resolve().then(()=>p(xen(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(inn.Provider,{value:o,children:(0,S.jsx)(ann.Provider,{value:s,children:(0,S.jsx)(onn.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...xtn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);lnn.displayName=`Streamdown`;let unn=(0,_.createContext)(null),dnn=()=>{let e=(0,_.useContext)(unn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},fnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(unn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Ui,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),pnn=(e,t)=>e||t===0?(0,S.jsx)(Bce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),mnn=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=dnn();return(0,S.jsx)(Wi,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)($r,{className:`size-4`}),pnn(r,a),(0,S.jsx)(ei,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),hnn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Gi,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(lnn,{...n,children:t})}));fnn.displayName=`Reasoning`,mnn.displayName=`ReasoningTrigger`,hnn.displayName=`ReasoningContent`,(0,_.createContext)(null);let gnn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(lnn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);gnn.displayName=`MessageResponse`;let _nn=(0,_.createContext)({code:``}),vnn={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function ynn(e,t,n=!1){let r=n?[vnn]:[];return await Promise.all([hXe(e,{lang:t,theme:`one-light`,transformers:r}),hXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(ynn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(_nn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},bnn=({className:e,...t})=>(0,S.jsx)(Ui,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),xnn=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(si,{className:`size-4`}),"input-available":(0,S.jsx)(ci,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(ci,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ii,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ii,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(oi,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(oi,{className:`size-4 text-orange-600`})}[e],t[e]]})},Snn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Wi,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(bi,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),xnn(r)]}),(0,S.jsx)(ei,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),Cnn=({className:e,...t})=>(0,S.jsx)(Gi,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),wnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),Tnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function Enn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function Dnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function Onn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let knn=(0,_.createContext)(null),Ann=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(knn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Ui,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(Enn,{className:nt(`shadow-none`,e),children:n})})}),jnn=({className:e,...t})=>(0,S.jsx)(Dnn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),Mnn=e=>(0,S.jsx)(Gi,{asChild:!0,children:(0,S.jsx)(Onn,{"data-slot":`plan-content`,...e})}),Nnn=({className:e,...t})=>(0,S.jsx)(Wi,{asChild:!0,children:(0,S.jsxs)(ki,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(ni,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Pnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Fnn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(gnn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(fnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(mnn,{}),(0,S.jsx)(hnn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(Ann,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(jnn,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(Nnn,{className:`mb-2`})]})}),(0,S.jsx)(Mnn,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(Pnn(e)){let r=e.input,i=r.toolName,a=e.state,o=a===`output-available`||a===`output-error`;return(0,S.jsxs)(bnn,{defaultOpen:o,children:[(0,S.jsx)(Snn,{title:i.length>20?`${i.slice(0,20)}...`:i,type:i,state:a}),(0,S.jsxs)(Cnn,{children:[e.input!==void 0&&(0,S.jsx)(wnn,{input:r}),o&&(0,S.jsx)(Tnn,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let Inn=({messages:e,status:t,selectedAgent:n})=>{let r=nd.find(e=>e.name===(n||rd))||nd[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,S.jsxs)(tle,{className:`w-full h-full`,children:[(0,S.jsx)(nle,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,S.jsxs)(S.Fragment,{children:[e.map(e=>(0,S.jsxs)(Rle,{className:`items-start`,from:e.role,children:[(0,S.jsx)(zle,{children:e.parts.map((n,r)=>Fnn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Ble,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,S.jsxs)(Rle,{className:`items-start`,from:`assistant`,children:[(0,S.jsx)(zle,{children:(0,S.jsx)(Hle,{size:16})}),(0,S.jsx)(Ble,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,S.jsx)(rle,{})]})};function Lnn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Rnn({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let znn=`AI_SELECTED_AGENT`,Bnn=e=>{let[t,n]=(0,_.useState)(e);return(0,_.useEffect)(()=>{typeof window<`u`&&cd().then(e=>{if(e&&e!==rd)n(e);else{let e=localStorage.getItem(znn);e&&n(e)}})},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(znn,e):localStorage.removeItem(znn))}}},Vnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{}})=>{let[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(`none`),[b,x]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!0),{agent:D,setAgent:O}=Bnn(rd),[k,A]=(0,_.useState)(!1),j=nd.find(e=>e.name===D)||nd[0],{elementRef:M,isDragging:N,handleMouseDown:P}=Rnn(),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(``),ee=Lnn(L,i,50),[te,z]=(0,_.useState)(``),B=(0,_.useRef)(``),ne=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ee,t=B.current;if(e.length<t.length||!e.startsWith(t)){z(e),B.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&z(n),B.current=e}},[ee]);let re=(0,_.useRef)(null),ie=(0,_.useRef)(null),ae=(0,_.useRef)(null),oe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){R(``),g(null),ae.current=null,oe.current=!1,z(``),B.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Uce(e),{displayText:n,toolCall:r}=Gce(e,t||ae.current);R(n||``),t&&(ae.current=t),r?(ie.current&&=(clearTimeout(ie.current),null),g(r),oe.current=!0):oe.current=!1},[a]),(0,_.useEffect)(()=>{te!==ne.current&&(oe.current||g(null),ne.current=te)},[te]),(0,_.useEffect)(()=>{d&&re.current&&re.current.focus()},[d]),(0,_.useEffect)(()=>{if(!i&&C){x(!1),w(!1),E(!1);let e=setTimeout(()=>{E(!0)},2e3);return()=>clearTimeout(e)}},[i,C]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;I({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;I({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let se=e=>{e.preventDefault(),p.trim()&&(ie.current&&=(clearTimeout(ie.current),null),g(null),R(``),z(``),I(null),ae.current=null,B.current=``,x(!0),w(!0),n(p,D),m(``),f(!0),y(`chat`))},ce=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se(e)),e.key===`Escape`&&(f(!1),re.current?.blur())},le=o===`error`,ue=a.length>0,de=d&&!b,fe=(!d||b)&&(i||ue||F);return(0,S.jsxs)(`div`,{ref:M,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,d?`w-[450px]`:fe?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,N?`cursor-grabbing`:`cursor-grab`),onMouseDown:P,onMouseEnter:()=>{N||(i||C?(f(!0),y(`chat`)):T&&f(!0))},onMouseLeave:()=>{!p.trim()&&!C&&!N&&(f(!1),y(`none`)),E(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,d?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,v===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,le&&!d&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,de?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(gi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(gi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):F?F.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(vi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):F.status===`completed`?(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):le?(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:F&&F.status===`in-progress`&&F.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,F.currentStep.index,`/`,F.currentStep.total,`: `,F.currentStep.title]})]}):F?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:F.message}):h?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:h})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!te?(0,S.jsx)(Bce,{duration:2,spread:2,children:o===`submitted`&&j?.command===`npx`?`Starting ${j.name}... This may take a moment.`:`Thinking...`}):te||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,de?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector`,children:(0,S.jsx)(li,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,v===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(ui,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:se,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>A(!k),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:nd.find(e=>e.name===D)?.meta?.icon,alt:D,className:`w-3.5 h-3.5`})}),k&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>A(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:nd.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{O(e.name),A(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,D===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:re,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:ce,placeholder:`Ask ${D}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||C)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,v===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:v===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(ti,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,v===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(_i,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!p.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,p.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(Qr,{className:`w-3.5 h-3.5`})})]})]})]}),v!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[v===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ta,{items:l,onRemove:u})}),v===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Inn,{messages:a,status:o,selectedAgent:D})})]})})]})};var Hnn=`vercel.ai.error`,Unn=Symbol.for(Hnn),Wnn,Gnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Wnn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Hnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Wnn=Unn;var W7=Gnn;function Knn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var qnn=`AI_InvalidArgumentError`,Jnn=`vercel.ai.error.${qnn}`,Ynn=Symbol.for(Jnn),Xnn,Znn=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:qnn,message:e,cause:t}),this[Xnn]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,Jnn)}};Xnn=Ynn;var Qnn=`AI_JSONParseError`,$nn=`vercel.ai.error.${Qnn}`,ern=Symbol.for($nn),trn,nrn=class extends W7{constructor({text:e,cause:t}){super({name:Qnn,message:`JSON parsing failed: Text: ${e}.
6935
+ $$`:`${e}$$`},$tn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},enn=e=>{if(V7(e)||ztn.test(e))return e;let t=e.match(Atn);if(t){let n=t[2];if(!n||z7.test(n))return e;if($tn(e)%2==1)return`${e}***`}return e},tnn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=Btn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=enn(t),t=Vtn(t),t=Htn(t),t=Wtn(t),t=qtn(t),t=Xtn(t),t=Ztn(t),t=Qtn(t),t)},nnn={harden:[fhe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:XSe,katex:[Ay,{errorColor:`var(--color-muted-foreground)`}]},rnn={gfm:[hEe,{}],math:[DEe,{singleDollarTextMath:!1}],cjkFriendly:[kCe,{}],cjkFriendlyGfmStrikethrough:[jCe,{}]},inn=(0,_.createContext)([`github-light`,`github-dark`]),ann=(0,_.createContext)(void 0),onn=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),snn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?tnn(e.trim()):e,[e,t]);return(0,S.jsx)(she,{...n,children:r})},(e,t)=>e.content===t.content);snn.displayName=`Block`;var cnn=[`github-light`,`github-dark`],lnn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(nnn),remarkPlugins:i=Object.values(rnn),className:a,shikiTheme:o=cnn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=snn,parseMarkdownIntoBlocksFn:m=Etn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===Ay:e===Ay)&&Promise.resolve().then(()=>p(xen(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(inn.Provider,{value:o,children:(0,S.jsx)(ann.Provider,{value:s,children:(0,S.jsx)(onn.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...xtn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);lnn.displayName=`Streamdown`;let unn=(0,_.createContext)(null),dnn=()=>{let e=(0,_.useContext)(unn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},fnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(unn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Ui,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),pnn=(e,t)=>e||t===0?(0,S.jsx)(Bce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),mnn=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=dnn();return(0,S.jsx)(Wi,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)($r,{className:`size-4`}),pnn(r,a),(0,S.jsx)(ei,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),hnn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Gi,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(lnn,{...n,children:t})}));fnn.displayName=`Reasoning`,mnn.displayName=`ReasoningTrigger`,hnn.displayName=`ReasoningContent`,(0,_.createContext)(null);let gnn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(lnn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);gnn.displayName=`MessageResponse`;let _nn=(0,_.createContext)({code:``}),vnn={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function ynn(e,t,n=!1){let r=n?[vnn]:[];return await Promise.all([hXe(e,{lang:t,theme:`one-light`,transformers:r}),hXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(ynn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(_nn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},bnn=({className:e,...t})=>(0,S.jsx)(Ui,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),xnn=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(si,{className:`size-4`}),"input-available":(0,S.jsx)(ci,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(ci,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ii,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ii,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(oi,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(oi,{className:`size-4 text-orange-600`})}[e],t[e]]})},Snn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Wi,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(bi,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),xnn(r)]}),(0,S.jsx)(ei,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),Cnn=({className:e,...t})=>(0,S.jsx)(Gi,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),wnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),Tnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function Enn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function Dnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function Onn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let knn=(0,_.createContext)(null),Ann=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(knn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Ui,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(Enn,{className:nt(`shadow-none`,e),children:n})})}),jnn=({className:e,...t})=>(0,S.jsx)(Dnn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),Mnn=e=>(0,S.jsx)(Gi,{asChild:!0,children:(0,S.jsx)(Onn,{"data-slot":`plan-content`,...e})}),Nnn=({className:e,...t})=>(0,S.jsx)(Wi,{asChild:!0,children:(0,S.jsxs)(ki,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(ni,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Pnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Fnn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(gnn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(fnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(mnn,{}),(0,S.jsx)(hnn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(Ann,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(jnn,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(Nnn,{className:`mb-2`})]})}),(0,S.jsx)(Mnn,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(Pnn(e)){let r=e=>(e=e.replace(`acp-ai-sdk-tools`,``),e),i=e.input,a=r(i.toolName),o=e.state,s=o===`output-available`||o===`output-error`;return(0,S.jsxs)(bnn,{defaultOpen:s,children:[(0,S.jsx)(Snn,{title:r(a.length>20?`${a.slice(0,20)}...`:a),type:a,state:o}),(0,S.jsxs)(Cnn,{children:[e.input!==void 0&&(0,S.jsx)(wnn,{input:i}),s&&(0,S.jsx)(Tnn,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let Inn=({messages:e,status:t,selectedAgent:n})=>{let r=nd.find(e=>e.name===(n||rd))||nd[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,S.jsxs)(tle,{className:`w-full h-full`,children:[(0,S.jsx)(nle,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,S.jsxs)(S.Fragment,{children:[e.map(e=>(0,S.jsxs)(Rle,{className:`items-start`,from:e.role,children:[(0,S.jsx)(zle,{children:e.parts.map((n,r)=>Fnn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Ble,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,S.jsxs)(Rle,{className:`items-start`,from:`assistant`,children:[(0,S.jsx)(zle,{children:(0,S.jsx)(Hle,{size:16})}),(0,S.jsx)(Ble,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,S.jsx)(rle,{})]})};function Lnn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Rnn({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let znn=`AI_SELECTED_AGENT`,Bnn=e=>{let[t,n]=(0,_.useState)(e);return(0,_.useEffect)(()=>{typeof window<`u`&&cd().then(e=>{if(e&&e!==rd)n(e);else{let e=localStorage.getItem(znn);e&&n(e)}})},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(znn,e):localStorage.removeItem(znn))}}},Vnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{}})=>{let[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(`none`),[b,x]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!0),{agent:D,setAgent:O}=Bnn(rd),[k,A]=(0,_.useState)(!1),j=nd.find(e=>e.name===D)||nd[0],{elementRef:M,isDragging:N,handleMouseDown:P}=Rnn(),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(``),ee=Lnn(L,i,50),[te,z]=(0,_.useState)(``),B=(0,_.useRef)(``),ne=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ee,t=B.current;if(e.length<t.length||!e.startsWith(t)){z(e),B.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&z(n),B.current=e}},[ee]);let re=(0,_.useRef)(null),ie=(0,_.useRef)(null),ae=(0,_.useRef)(null),oe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){R(``),g(null),ae.current=null,oe.current=!1,z(``),B.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Uce(e),{displayText:n,toolCall:r}=Gce(e,t||ae.current);R(n||``),t&&(ae.current=t),r?(ie.current&&=(clearTimeout(ie.current),null),g(r),oe.current=!0):oe.current=!1},[a]),(0,_.useEffect)(()=>{te!==ne.current&&(oe.current||g(null),ne.current=te)},[te]),(0,_.useEffect)(()=>{d&&re.current&&re.current.focus()},[d]),(0,_.useEffect)(()=>{if(!i&&C){x(!1),w(!1),E(!1);let e=setTimeout(()=>{E(!0)},2e3);return()=>clearTimeout(e)}},[i,C]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;I({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;I({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let se=e=>{e.preventDefault(),p.trim()&&(ie.current&&=(clearTimeout(ie.current),null),g(null),R(``),z(``),I(null),ae.current=null,B.current=``,x(!0),w(!0),n(p,D),m(``),f(!0),y(`chat`))},ce=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se(e)),e.key===`Escape`&&(f(!1),re.current?.blur())},le=o===`error`,ue=a.length>0,de=d&&!b,fe=(!d||b)&&(i||ue||F);return(0,S.jsxs)(`div`,{ref:M,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,d?`w-[450px]`:fe?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,N?`cursor-grabbing`:`cursor-grab`),onMouseDown:P,onMouseEnter:()=>{N||(i||C?(f(!0),y(`chat`)):T&&f(!0))},onMouseLeave:()=>{!p.trim()&&!C&&!N&&(f(!1),y(`none`)),E(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,d?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,v===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,le&&!d&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,de?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(gi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(gi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):F?F.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(vi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):F.status===`completed`?(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):le?(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:F&&F.status===`in-progress`&&F.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,F.currentStep.index,`/`,F.currentStep.total,`: `,F.currentStep.title]})]}):F?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:F.message}):h?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:h})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!te?(0,S.jsx)(Bce,{duration:2,spread:2,children:o===`submitted`&&j?.command===`npx`?`Starting ${j.name}... This may take a moment.`:`Thinking...`}):te||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,de?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector`,children:(0,S.jsx)(li,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,v===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(ui,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:se,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>A(!k),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:nd.find(e=>e.name===D)?.meta?.icon,alt:D,className:`w-3.5 h-3.5`})}),k&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>A(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:nd.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{O(e.name),A(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,D===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:re,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:ce,placeholder:`Ask ${D}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||C)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,v===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:v===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(ti,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,v===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(_i,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!p.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,p.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(Qr,{className:`w-3.5 h-3.5`})})]})]})]}),v!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[v===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ta,{items:l,onRemove:u})}),v===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Inn,{messages:a,status:o,selectedAgent:D})})]})})]})};var Hnn=`vercel.ai.error`,Unn=Symbol.for(Hnn),Wnn,Gnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Wnn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Hnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Wnn=Unn;var W7=Gnn;function Knn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var qnn=`AI_InvalidArgumentError`,Jnn=`vercel.ai.error.${qnn}`,Ynn=Symbol.for(Jnn),Xnn,Znn=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:qnn,message:e,cause:t}),this[Xnn]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,Jnn)}};Xnn=Ynn;var Qnn=`AI_JSONParseError`,$nn=`vercel.ai.error.${Qnn}`,ern=Symbol.for($nn),trn,nrn=class extends W7{constructor({text:e,cause:t}){super({name:Qnn,message:`JSON parsing failed: Text: ${e}.
6936
6936
  Error message: ${Knn(t)}`,cause:t}),this[trn]=!0,this.text=e}static isInstance(e){return W7.hasMarker(e,$nn)}};trn=ern;var rrn=`AI_TypeValidationError`,irn=`vercel.ai.error.${rrn}`,arn=Symbol.for(irn),orn,srn=class e extends W7{constructor({value:e,cause:t}){super({name:rrn,message:`Type validation failed: Value: ${JSON.stringify(e)}.
6937
6937
  Error message: ${Knn(t)}`,cause:t}),this[orn]=!0,this.value=e}static isInstance(e){return W7.hasMarker(e,irn)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};orn=arn;var G7=srn,crn=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Tl({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};Object.freeze({status:`aborted`});function K7(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}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 q7=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let lrn={};function J7(e){return e&&Object.assign(lrn,e),lrn}function urn(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 drn(e,t){return typeof t==`bigint`?t.toString():t}function frn(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function prn(e){return e==null}function mrn(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function hrn(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Y7(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function X7(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z7(e){return JSON.stringify(e)}let grn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Q7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let _rn=frn(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function $7(e){if(Q7(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Q7(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let vrn=new Set([`string`,`number`,`symbol`]);function e9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t9(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function n9(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 yrn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let brn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xrn(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Srn(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Crn(e,t){if(!$7(t))throw Error(`Invalid input to extend: expected a plain object`);return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return X7(this,`shape`,n),n},checks:[]})}function wrn(e,t){return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return X7(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function Trn(e,t,n){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 t9(t,{...t._zod.def,shape:i,checks:[]})}function Ern(e,t,n){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 t9(t,{...t._zod.def,shape:i,checks:[]})}function r9(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function i9(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function a9(e){return typeof e==`string`?e:e?.message}function o9(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=a9(e.inst?._zod.def?.error?.(e))??a9(t?.error?.(e))??a9(n.customError?.(e))??a9(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Drn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function s9(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let Orn=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),Object.defineProperty(e,`message`,{get(){return JSON.stringify(t,drn,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},krn=K7(`$ZodError`,Orn),Arn=K7(`$ZodError`,Orn,{Parent:Error});function jrn(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 Mrn(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}let Nrn=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 q7;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw grn(t,i?.callee),t}return o.value},Prn=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=>o9(e,a,J7())));throw grn(t,i?.callee),t}return o.value},Frn=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 q7;return a.issues.length?{success:!1,error:new(e??krn)(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Irn=Frn(Arn),Lrn=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=>o9(e,i,J7())))}:{success:!0,data:a.value}},Rrn=Lrn(Arn),zrn=/^[cC][^\s-]{8,}$/,Brn=/^[0-9a-z]+$/,Vrn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hrn=/^[0-9a-vA-V]{20}$/,Urn=/^[A-Za-z0-9]{27}$/,Wrn=/^[a-zA-Z0-9_-]{21}$/,Grn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Krn=/^([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})$/,qrn=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)$/,Jrn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Yrn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Xrn=/^(?:(?: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])$/,Zrn=/^(([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})$/,Qrn=/^((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])$/,$rn=/^(([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])$/,ein=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tin=/^[A-Za-z0-9_-]*$/,nin=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,rin=/^\+(?:[0-9]){6,14}[0-9]$/,iin=`(?:(?:\\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])))`,ain=RegExp(`^${iin}$`);function oin(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 sin(e){return RegExp(`^${oin(e)}$`)}function cin(e){let t=oin({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${iin}T(?:${r})$`)}let lin=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},uin=/^\d+$/,din=/^-?\d+(?:\.\d+)?/i,fin=/true|false/i,pin=/null/i,min=/^[^A-Z]*$/,hin=/^[^a-z]*$/,c9=K7(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gin={number:`number`,bigint:`bigint`,object:`date`},_in=K7(`$ZodCheckLessThan`,(e,t)=>{c9.init(e,t);let n=gin[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:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vin=K7(`$ZodCheckGreaterThan`,(e,t)=>{c9.init(e,t);let n=gin[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:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yin=K7(`$ZodCheckMultipleOf`,(e,t)=>{c9.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):hrn(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})}}),bin=K7(`$ZodCheckNumberFormat`,(e,t)=>{c9.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=brn[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=uin)}),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`,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,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,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,inst:e})}}),xin=K7(`$ZodCheckMaxLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!prn(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=Drn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sin=K7(`$ZodCheckMinLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!prn(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=Drn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cin=K7(`$ZodCheckLengthEquals`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!prn(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=Drn(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})}}),l9=K7(`$ZodCheckStringFormat`,(e,t)=>{var n,r;c9.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=()=>{})}),win=K7(`$ZodCheckRegex`,(e,t)=>{l9.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})}}),Tin=K7(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=min,l9.init(e,t)}),Ein=K7(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hin,l9.init(e,t)}),Din=K7(`$ZodCheckIncludes`,(e,t)=>{c9.init(e,t);let n=e9(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})}}),Oin=K7(`$ZodCheckStartsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`^${e9(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})}}),kin=K7(`$ZodCheckEndsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`.*${e9(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})}}),Ain=K7(`$ZodCheckOverwrite`,(e,t)=>{c9.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var jin=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(`
6938
6938
  `).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(`