@mcpc-tech/unplugin-dev-inspector-mcp 0.0.4 → 0.0.5
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/client/dist/inspector.iife.js +1 -1
- package/dist/index.cjs +35 -34
- package/dist/index.js +35 -34
- package/package.json +1 -1
|
@@ -213,7 +213,7 @@ ${t}
|
|
|
213
213
|
3. Update status with 'update_inspection_status':
|
|
214
214
|
- "in-progress" with progress details while investigating
|
|
215
215
|
- "completed" with findings when done
|
|
216
|
-
- "failed" if unresolvable`)}function hte(e){let{code:t}=e;if(!t||typeof t!=`string`)return _d(`Error: Missing or invalid "code" parameter. Please provide JavaScript code to execute.`);try{let e=Function(t)(),n;if(e===void 0)n=`(undefined)`;else if(e===null)n=`(null)`;else if(typeof e==`object`)try{n=JSON.stringify(e,null,2)}catch{n=`[Object: ${Object.prototype.toString.call(e)}]`}else n=String(e);return _d(`${n}`)}catch(e){let t=e instanceof Error?e.message:String(e),n=e instanceof Error?e.stack:``;return _d(`## Error\n\`\`\`\n${t}\n\`\`\`\n\n${n?`## Stack Trace\n\`\`\`\n${n}\n\`\`\`\n`:``}\n## Suggestions\n- Check syntax errors\n- Verify element selectors exist\n- Ensure code returns a value\n- Check browser console for additional errors`)}}function gte(e){let{inspectionId:t,status:n,progress:r,message:i}=e,a=t||sessionStorage.getItem(fd)||``;if(!a)try{let e=localStorage.getItem(dd),t=(e?JSON.parse(e):[]).find(e=>e.status===`in-progress`);if(t)a=t.id,sessionStorage.setItem(fd,a);else return _d(`Error: No active inspection item found. Please use 'list_inspections' to see the queue, then provide the inspectionId parameter.`)}catch{return _d(`Error: No active inspection item`)}if(n===`deleted`)try{let e=localStorage.getItem(dd),t=(e?JSON.parse(e):[]).filter(e=>e.id!==a);return localStorage.setItem(dd,JSON.stringify(t)),sessionStorage.removeItem(fd),window.dispatchEvent(new CustomEvent(`inspection-deleted`,{detail:{inspectionId:a}})),_d(`Inspection ${a} deleted successfully.`)}catch{return _d(`Error: Failed to delete inspection`)}if(r&&window.dispatchEvent(new CustomEvent(`plan-progress-reported`,{detail:{plan:{steps:r.steps},inspectionId:a,timestamp:new Date().toISOString()}})),n===`completed`||n===`failed`){sessionStorage.removeItem(fd);let e=i||(n===`completed`?`Task completed`:`Task failed`);return window.dispatchEvent(new CustomEvent(`inspection-result-received`,{detail:{status:n,result:{message:e},inspectionId:a}})),_d(`Inspection marked as ${n}.`)}else n===`in-progress`&&i&&!r&&window.dispatchEvent(new CustomEvent(`inspection-status-updated`,{detail:{status:`in-progress`,message:i,inspectionId:a}}));return _d(`Status updated`)}function _te(){let e=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(e.current)return;let t=ed(new fl({name:`inspector`,version:`0.1.0`},{capabilities:{tools:{}}}),`inspector`);async function n(){return gd(`New inspect request started`),pte(),new Promise((e,t)=>{pd=e,md=t,setTimeout(()=>{md===t&&(hd(),t(Error(`Timeout: No element selected`)))},6e5)})}function r(e){if(!pd)return;let{sourceInfo:t,description:n,inspectionId:r}=e.detail;sessionStorage.setItem(fd,r),pd(mte(t,n)),hd()}function i(){sessionStorage.removeItem(fd),gd(`Inspector cancelled by user`)}let a=[{event:`element-inspected`,handler:r},{event:`inspector-cancelled`,handler:i}];a.forEach(({event:e,handler:t})=>{window.addEventListener(e,t)}),t.registerTools([{...td.list_inspections,implementation:yd},{...td.capture_element_context,implementation:n},{...td.update_inspection_status,implementation:gte},{...td.execute_page_script,implementation:hte}]);let o=new dte(new URL(`/__mcp__/sse?clientType=inspector`,cd()));return t.connect(o).then(()=>{e.current=t}).catch(e=>{console.error(`MCP connection error:`,e)}),()=>{a.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)}),o.close?.()}},[]),e.current}let bd=(0,_.createContext)(void 0),xd=()=>{let e=(0,_.useContext)(bd);if(!e)throw Error(`useInspectorTheme must be used within an InspectorThemeProvider`);return e},vte=({children:e})=>{let[t,n]=(0,_.useState)(`system`),[r,i]=(0,_.useState)(()=>typeof window>`u`?`light`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return(0,_.useEffect)(()=>{if(t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{i(e.matches?`dark`:`light`)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}else i(t)},[t]),(0,_.useEffect)(()=>{let e=window.document.documentElement;e.classList.remove(`light`,`dark`),e.classList.add(r)},[r]),(0,S.jsx)(bd.Provider,{value:{theme:t,setTheme:n,resolvedTheme:r},children:e})};var Sd=p(vt(),1);function Cd(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}let wd=e=>{switch(e){case`success`:return Ed;case`info`:return Od;case`warning`:return Dd;case`error`:return kd;default:return null}},Td=Array(12).fill(0),yte=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},Td.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ed=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Dd=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Od=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),kd=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Ad=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),jd=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Md=1,Nd=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Md++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(bte(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Md++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Pd=(e,t)=>{let n=t?.id||Md++;return Nd.addToast({title:e,...t,id:n}),n},bte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Fd=Pd;Object.assign(Fd,{success:Nd.success,info:Nd.info,warning:Nd.warning,error:Nd.error,custom:Nd.custom,message:Nd.message,promise:Nd.promise,dismiss:Nd.dismiss,loading:Nd.loading},{getHistory:()=>Nd.toasts,getToasts:()=>Nd.getActiveToasts()}),Cd(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Id(e){return e.label!==void 0}let Ld=4e3;function Rd(...e){return e.filter(Boolean).join(` `)}function zd(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}let Bd=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:l,toasts:u,expanded:d,removeToast:f,defaultRichColors:p,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:v,className:y=``,descriptionClassName:b=``,duration:x,position:S,gap:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`}=e,[O,k]=_.useState(null),[A,j]=_.useState(null),[M,N]=_.useState(!1),[P,F]=_.useState(!1),[I,L]=_.useState(!1),[R,ee]=_.useState(!1),[te,z]=_.useState(!1),[B,ne]=_.useState(0),[re,ie]=_.useState(0),ae=_.useRef(n.duration||x||Ld),oe=_.useRef(null),se=_.useRef(null),ce=l===0,le=l+1<=o,ue=n.type,de=n.dismissible!==!1,fe=n.className||``,pe=n.descriptionClassName||``,me=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),he=_.useMemo(()=>n.closeButton??m,[n.closeButton,m]),ge=_.useMemo(()=>n.duration||x||Ld,[n.duration,x]),_e=_.useRef(0),ve=_.useRef(0),ye=_.useRef(0),be=_.useRef(null),[xe,Se]=S.split(`-`),Ce=_.useMemo(()=>s.reduce((e,t,n)=>n>=me?e:e+t.height,0),[s,me]),we=jd(),Te=n.invert||t,Ee=ue===`loading`;ve.current=_.useMemo(()=>me*C+Ce,[me,Ce]),_.useEffect(()=>{ae.current=ge},[ge]),_.useEffect(()=>{N(!0)},[]),_.useEffect(()=>{let e=se.current;if(e){let t=e.getBoundingClientRect().height;return ie(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!M)return;let e=se.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ie(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[M,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let De=_.useCallback(()=>{F(!0),ne(ve.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{f(n)},200)},[n,f,a,ve]);_.useEffect(()=>{if(n.promise&&ue===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return d||i||we?(()=>{if(ye.current<_e.current){let e=new Date().getTime()-_e.current;ae.current-=e}ye.current=new Date().getTime()})():ae.current!==1/0&&(_e.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),De()},ae.current)),()=>clearTimeout(e)},[d,i,n,ue,we,De]),_.useEffect(()=>{n.delete&&(De(),n.onDismiss==null||n.onDismiss.call(n,n))},[De,n.delete]);function Oe(){return E?.loading?_.createElement(`div`,{className:Rd(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ue===`loading`},E.loading):_.createElement(yte,{className:Rd(T?.loader,n?.classNames?.loader),visible:ue===`loading`})}let ke=n.icon||E?.[ue]||wd(ue);return _.createElement(`li`,{tabIndex:0,ref:se,className:Rd(y,fe,T?.toast,n?.classNames?.toast,T?.default,T?.[ue],n?.classNames?.[ue]),"data-sonner-toast":``,"data-rich-colors":n.richColors??p,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":M,"data-promise":!!n.promise,"data-swiped":te,"data-removed":P,"data-visible":le,"data-y-position":xe,"data-x-position":Se,"data-index":l,"data-front":ce,"data-swiping":I,"data-dismissible":de,"data-type":ue,"data-invert":Te,"data-swipe-out":R,"data-swipe-direction":A,"data-expanded":!!(d||w&&M),"data-testid":n.testId,style:{"--index":l,"--toasts-before":l,"--z-index":u.length-l,"--offset":`${P?B:ve.current}px`,"--initial-height":w?`auto`:`${re}px`,...h,...n.style},onDragEnd:()=>{L(!1),k(null),be.current=null},onPointerDown:e=>{e.button!==2&&(Ee||!de||(oe.current=new Date,ne(ve.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(L(!0),be.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(R||!de)return;be.current=null;let e=Number(se.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(se.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-oe.current?.getTime(),i=O===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=45||a>.11){ne(ve.current),n.onDismiss==null||n.onDismiss.call(n,n),j(O===`x`?e>0?`right`:`left`:t>0?`down`:`up`),De(),ee(!0);return}else{var o,s;(o=se.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=se.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}z(!1),L(!1),k(null)},onPointerMove:t=>{var n,r;if(!be.current||!de||window.getSelection()?.toString().length>0)return;let i=t.clientY-be.current.y,a=t.clientX-be.current.x,o=e.swipeDirections??zd(S);!O&&(Math.abs(a)>1||Math.abs(i)>1)&&k(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},l=e=>1/(1.5+Math.abs(e)/20);if(O===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*l(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(O===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*l(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&z(!0),(n=se.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=se.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},he&&!n.jsx&&ue!==`loading`?_.createElement(`button`,{"aria-label":D,"data-disabled":Ee,"data-close-button":!0,onClick:Ee||!de?()=>{}:()=>{De(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Rd(T?.closeButton,n?.classNames?.closeButton)},E?.close??Ad):null,(ue||n.icon||n.promise)&&n.icon!==null&&(E?.[ue]!==null||n.icon)?_.createElement(`div`,{"data-icon":``,className:Rd(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Oe():null,n.type===`loading`?null:ke):null,_.createElement(`div`,{"data-content":``,className:Rd(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Rd(T?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Rd(b,pe,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),_.isValidElement(n.cancel)?n.cancel:n.cancel&&Id(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Id(n.cancel)&&de&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),De())},className:Rd(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,_.isValidElement(n.action)?n.action:n.action&&Id(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||v,onClick:e=>{Id(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&De())},className:Rd(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Vd(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function xte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?`16px`:`24px`;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}let Hd=_.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:l,offset:u,mobileOffset:d,theme:f=`light`,richColors:p,duration:m,style:h,visibleToasts:g=3,toastOptions:v,dir:y=Vd(),gap:b=14,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=_.useState([]),T=_.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=_.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(f===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f),F=_.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=_.useRef(null),R=_.useRef(!1),ee=_.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Nd.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return _.useEffect(()=>Nd.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Sd.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),_.useEffect(()=>{if(f!==`system`){P(f);return}if(f===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[f]),_.useEffect(()=>{C.length<=1&&A(!1)},[C]),_.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),_.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?_.createElement(`ol`,{key:t,dir:y===`auto`?Vd():y,tabIndex:-1,ref:F,className:l,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`356px`,"--gap":`${b}px`,...h,...xte(u,d)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>_.createElement(Bd,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:p,duration:v?.duration??m,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:g,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ee,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),Ste=({...e})=>{let{theme:t=`system`}=xd(),n=Gd();return(0,S.jsx)(Hd,{theme:t,className:`toaster group`,icons:{success:(0,S.jsx)(ri,{className:`size-4`}),info:(0,S.jsx)(li,{className:`size-4`}),warning:(0,S.jsx)(gi,{className:`size-4`}),error:(0,S.jsx)(fi,{className:`size-4`}),loading:(0,S.jsx)(ui,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},container:n,...e})},Ud=(0,_.createContext)(null),Wd=()=>(0,_.useContext)(Ud),Gd=Wd,Kd=`inspector-inspection-items`;function qd(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(Kd);return e?JSON.parse(e):[]}catch{return[]}});return(0,_.useEffect)(()=>{function e(e){let{plan:n,inspectionId:r}=e.detail;t(e=>e.map(e=>e.id===r?{...e,status:`in-progress`,progress:n}:e))}function n(e){let{status:n,result:r,inspectionId:i}=e.detail;t(e=>e.map(e=>e.id===i?{...e,status:n,result:r?.message||r,progress:void 0}:e))}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,n),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,n)}},[]),(0,_.useEffect)(()=>{try{localStorage.setItem(Kd,JSON.stringify(e))}catch{console.warn(`Failed to save inspections to localStorage`)}},[e]),{inspections:e,setInspections:t}}var Cte=`/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
|
|
216
|
+
- "failed" if unresolvable`)}function hte(e){let{code:t}=e;if(!t||typeof t!=`string`)return _d(`Error: Missing or invalid "code" parameter. Please provide JavaScript code to execute.`);try{let e=Function(t)(),n;if(e===void 0)n=`(undefined)`;else if(e===null)n=`(null)`;else if(typeof e==`object`)try{n=JSON.stringify(e,null,2)}catch{n=`[Object: ${Object.prototype.toString.call(e)}]`}else n=String(e);return _d(`${n}`)}catch(e){let t=e instanceof Error?e.message:String(e),n=e instanceof Error?e.stack:``;return _d(`## Error\n\`\`\`\n${t}\n\`\`\`\n\n${n?`## Stack Trace\n\`\`\`\n${n}\n\`\`\`\n`:``}\n## Suggestions\n- Check syntax errors\n- Verify element selectors exist\n- Ensure code returns a value\n- Check browser console for additional errors`)}}function gte(e){let{inspectionId:t,status:n,progress:r,message:i}=e,a=t||sessionStorage.getItem(fd)||``;if(!a)try{let e=localStorage.getItem(dd),t=(e?JSON.parse(e):[]).find(e=>e.status===`in-progress`);if(t)a=t.id,sessionStorage.setItem(fd,a);else return _d(`Error: No active inspection item found. Please use 'list_inspections' to see the queue, then provide the inspectionId parameter.`)}catch{return _d(`Error: No active inspection item`)}if(n===`deleted`)try{let e=localStorage.getItem(dd),t=(e?JSON.parse(e):[]).filter(e=>e.id!==a);return localStorage.setItem(dd,JSON.stringify(t)),sessionStorage.removeItem(fd),window.dispatchEvent(new CustomEvent(`inspection-deleted`,{detail:{inspectionId:a}})),_d(`Inspection ${a} deleted successfully.`)}catch{return _d(`Error: Failed to delete inspection`)}if(r&&window.dispatchEvent(new CustomEvent(`plan-progress-reported`,{detail:{plan:{steps:r.steps},inspectionId:a,timestamp:new Date().toISOString()}})),n===`completed`||n===`failed`){sessionStorage.removeItem(fd);let e=i||(n===`completed`?`Task completed`:`Task failed`);return window.dispatchEvent(new CustomEvent(`inspection-result-received`,{detail:{status:n,result:{message:e},inspectionId:a}})),_d(`Inspection marked as ${n}.`)}else n===`in-progress`&&i&&!r&&window.dispatchEvent(new CustomEvent(`inspection-status-updated`,{detail:{status:`in-progress`,message:i,inspectionId:a}}));return _d(`Status updated`)}function _te(){let e=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(e.current)return;let t=ed(new fl({name:`inspector`,version:`0.1.0`},{capabilities:{tools:{}}}),`inspector`);async function n(){return gd(`New inspect request started`),pte(),new Promise((e,t)=>{pd=e,md=t,setTimeout(()=>{md===t&&(hd(),t(Error(`Timeout: No element selected`)))},6e5)})}function r(e){if(!pd)return;let{sourceInfo:t,description:n,inspectionId:r}=e.detail;sessionStorage.setItem(fd,r),pd(mte(t,n)),hd()}function i(){sessionStorage.removeItem(fd),gd(`Inspector cancelled by user`)}let a=[{event:`element-inspected`,handler:r},{event:`inspector-cancelled`,handler:i}];a.forEach(({event:e,handler:t})=>{window.addEventListener(e,t)}),t.registerTools([{...td.list_inspections,implementation:yd},{...td.capture_element_context,implementation:n},{...td.update_inspection_status,implementation:gte},{...td.execute_page_script,implementation:hte}]);let o=new dte(new URL(`/__mcp__/sse?clientId=inspector`,cd()));return t.connect(o).then(()=>{e.current=t}).catch(e=>{console.error(`MCP connection error:`,e)}),()=>{a.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)}),o.close?.()}},[]),e.current}let bd=(0,_.createContext)(void 0),xd=()=>{let e=(0,_.useContext)(bd);if(!e)throw Error(`useInspectorTheme must be used within an InspectorThemeProvider`);return e},vte=({children:e})=>{let[t,n]=(0,_.useState)(`system`),[r,i]=(0,_.useState)(()=>typeof window>`u`?`light`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return(0,_.useEffect)(()=>{if(t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{i(e.matches?`dark`:`light`)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}else i(t)},[t]),(0,_.useEffect)(()=>{let e=window.document.documentElement;e.classList.remove(`light`,`dark`),e.classList.add(r)},[r]),(0,S.jsx)(bd.Provider,{value:{theme:t,setTheme:n,resolvedTheme:r},children:e})};var Sd=p(vt(),1);function Cd(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}let wd=e=>{switch(e){case`success`:return Ed;case`info`:return Od;case`warning`:return Dd;case`error`:return kd;default:return null}},Td=Array(12).fill(0),yte=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},Td.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ed=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),Dd=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Od=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),kd=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Ad=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),jd=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},Md=1,Nd=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:Md++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(bte(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||Md++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Pd=(e,t)=>{let n=t?.id||Md++;return Nd.addToast({title:e,...t,id:n}),n},bte=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Fd=Pd;Object.assign(Fd,{success:Nd.success,info:Nd.info,warning:Nd.warning,error:Nd.error,custom:Nd.custom,message:Nd.message,promise:Nd.promise,dismiss:Nd.dismiss,loading:Nd.loading},{getHistory:()=>Nd.toasts,getToasts:()=>Nd.getActiveToasts()}),Cd(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Id(e){return e.label!==void 0}let Ld=4e3;function Rd(...e){return e.filter(Boolean).join(` `)}function zd(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}let Bd=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:l,toasts:u,expanded:d,removeToast:f,defaultRichColors:p,closeButton:m,style:h,cancelButtonStyle:g,actionButtonStyle:v,className:y=``,descriptionClassName:b=``,duration:x,position:S,gap:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`}=e,[O,k]=_.useState(null),[A,j]=_.useState(null),[M,N]=_.useState(!1),[P,F]=_.useState(!1),[I,L]=_.useState(!1),[R,ee]=_.useState(!1),[te,z]=_.useState(!1),[B,ne]=_.useState(0),[re,ie]=_.useState(0),ae=_.useRef(n.duration||x||Ld),oe=_.useRef(null),se=_.useRef(null),ce=l===0,le=l+1<=o,ue=n.type,de=n.dismissible!==!1,fe=n.className||``,pe=n.descriptionClassName||``,me=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),he=_.useMemo(()=>n.closeButton??m,[n.closeButton,m]),ge=_.useMemo(()=>n.duration||x||Ld,[n.duration,x]),_e=_.useRef(0),ve=_.useRef(0),ye=_.useRef(0),be=_.useRef(null),[xe,Se]=S.split(`-`),Ce=_.useMemo(()=>s.reduce((e,t,n)=>n>=me?e:e+t.height,0),[s,me]),we=jd(),Te=n.invert||t,Ee=ue===`loading`;ve.current=_.useMemo(()=>me*C+Ce,[me,Ce]),_.useEffect(()=>{ae.current=ge},[ge]),_.useEffect(()=>{N(!0)},[]),_.useEffect(()=>{let e=se.current;if(e){let t=e.getBoundingClientRect().height;return ie(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!M)return;let e=se.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ie(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[M,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let De=_.useCallback(()=>{F(!0),ne(ve.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{f(n)},200)},[n,f,a,ve]);_.useEffect(()=>{if(n.promise&&ue===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return d||i||we?(()=>{if(ye.current<_e.current){let e=new Date().getTime()-_e.current;ae.current-=e}ye.current=new Date().getTime()})():ae.current!==1/0&&(_e.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),De()},ae.current)),()=>clearTimeout(e)},[d,i,n,ue,we,De]),_.useEffect(()=>{n.delete&&(De(),n.onDismiss==null||n.onDismiss.call(n,n))},[De,n.delete]);function Oe(){return E?.loading?_.createElement(`div`,{className:Rd(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ue===`loading`},E.loading):_.createElement(yte,{className:Rd(T?.loader,n?.classNames?.loader),visible:ue===`loading`})}let ke=n.icon||E?.[ue]||wd(ue);return _.createElement(`li`,{tabIndex:0,ref:se,className:Rd(y,fe,T?.toast,n?.classNames?.toast,T?.default,T?.[ue],n?.classNames?.[ue]),"data-sonner-toast":``,"data-rich-colors":n.richColors??p,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":M,"data-promise":!!n.promise,"data-swiped":te,"data-removed":P,"data-visible":le,"data-y-position":xe,"data-x-position":Se,"data-index":l,"data-front":ce,"data-swiping":I,"data-dismissible":de,"data-type":ue,"data-invert":Te,"data-swipe-out":R,"data-swipe-direction":A,"data-expanded":!!(d||w&&M),"data-testid":n.testId,style:{"--index":l,"--toasts-before":l,"--z-index":u.length-l,"--offset":`${P?B:ve.current}px`,"--initial-height":w?`auto`:`${re}px`,...h,...n.style},onDragEnd:()=>{L(!1),k(null),be.current=null},onPointerDown:e=>{e.button!==2&&(Ee||!de||(oe.current=new Date,ne(ve.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(L(!0),be.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(R||!de)return;be.current=null;let e=Number(se.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(se.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-oe.current?.getTime(),i=O===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=45||a>.11){ne(ve.current),n.onDismiss==null||n.onDismiss.call(n,n),j(O===`x`?e>0?`right`:`left`:t>0?`down`:`up`),De(),ee(!0);return}else{var o,s;(o=se.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=se.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}z(!1),L(!1),k(null)},onPointerMove:t=>{var n,r;if(!be.current||!de||window.getSelection()?.toString().length>0)return;let i=t.clientY-be.current.y,a=t.clientX-be.current.x,o=e.swipeDirections??zd(S);!O&&(Math.abs(a)>1||Math.abs(i)>1)&&k(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},l=e=>1/(1.5+Math.abs(e)/20);if(O===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*l(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(O===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*l(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&z(!0),(n=se.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=se.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},he&&!n.jsx&&ue!==`loading`?_.createElement(`button`,{"aria-label":D,"data-disabled":Ee,"data-close-button":!0,onClick:Ee||!de?()=>{}:()=>{De(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Rd(T?.closeButton,n?.classNames?.closeButton)},E?.close??Ad):null,(ue||n.icon||n.promise)&&n.icon!==null&&(E?.[ue]!==null||n.icon)?_.createElement(`div`,{"data-icon":``,className:Rd(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Oe():null,n.type===`loading`?null:ke):null,_.createElement(`div`,{"data-content":``,className:Rd(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Rd(T?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Rd(b,pe,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),_.isValidElement(n.cancel)?n.cancel:n.cancel&&Id(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||g,onClick:e=>{Id(n.cancel)&&de&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),De())},className:Rd(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,_.isValidElement(n.action)?n.action:n.action&&Id(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||v,onClick:e=>{Id(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&De())},className:Rd(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Vd(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function xte(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?`16px`:`24px`;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}let Hd=_.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:l,offset:u,mobileOffset:d,theme:f=`light`,richColors:p,duration:m,style:h,visibleToasts:g=3,toastOptions:v,dir:y=Vd(),gap:b=14,icons:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=_.useState([]),T=_.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=_.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(f===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f),F=_.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=_.useRef(null),R=_.useRef(!1),ee=_.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||Nd.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return _.useEffect(()=>Nd.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Sd.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[C]),_.useEffect(()=>{if(f!==`system`){P(f);return}if(f===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[f]),_.useEffect(()=>{C.length<=1&&A(!1)},[C]),_.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;A(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),_.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,R.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?_.createElement(`ol`,{key:t,dir:y===`auto`?Vd():y,tabIndex:-1,ref:F,className:l,"data-sonner-toaster":!0,"data-sonner-theme":N,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`356px`,"--gap":`${b}px`,...h,...xte(u,d)},onBlur:e=>{R.current&&!e.currentTarget.contains(e.relatedTarget)&&(R.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||R.current||(R.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>_.createElement(Bd,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:p,duration:v?.duration??m,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:g,closeButton:v?.closeButton??s,interacting:j,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ee,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:O,expandByDefault:o,gap:b,expanded:k,swipeDirections:e.swipeDirections}))):null}))}),Ste=({...e})=>{let{theme:t=`system`}=xd(),n=Gd();return(0,S.jsx)(Hd,{theme:t,className:`toaster group`,icons:{success:(0,S.jsx)(ri,{className:`size-4`}),info:(0,S.jsx)(li,{className:`size-4`}),warning:(0,S.jsx)(gi,{className:`size-4`}),error:(0,S.jsx)(fi,{className:`size-4`}),loading:(0,S.jsx)(ui,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},container:n,...e})},Ud=(0,_.createContext)(null),Wd=()=>(0,_.useContext)(Ud),Gd=Wd,Kd=`inspector-inspection-items`;function qd(){let[e,t]=(0,_.useState)(()=>{try{let e=localStorage.getItem(Kd);return e?JSON.parse(e):[]}catch{return[]}});return(0,_.useEffect)(()=>{function e(e){let{plan:n,inspectionId:r}=e.detail;t(e=>e.map(e=>e.id===r?{...e,status:`in-progress`,progress:n}:e))}function n(e){let{status:n,result:r,inspectionId:i}=e.detail;t(e=>e.map(e=>e.id===i?{...e,status:n,result:r?.message||r,progress:void 0}:e))}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,n),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,n)}},[]),(0,_.useEffect)(()=>{try{localStorage.setItem(Kd,JSON.stringify(e))}catch{console.warn(`Failed to save inspections to localStorage`)}},[e]),{inspections:e,setInspections:t}}var Cte=`/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
|
|
217
217
|
@layer properties {
|
|
218
218
|
@supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
|
|
219
219
|
*, :before, :after, ::backdrop {
|
package/dist/index.cjs
CHANGED
|
@@ -86863,14 +86863,14 @@ You MUST ask the user for confirmation before navigating to any URL.`,
|
|
|
86863
86863
|
//#endregion
|
|
86864
86864
|
//#region src/middleware/connection-manager.ts
|
|
86865
86865
|
/**
|
|
86866
|
-
* Manages MCP transport connections between Watcher (VS Code) and Inspector (Browser).
|
|
86867
|
-
*
|
|
86866
|
+
* Manages MCP transport connections between Watcher (VS Code/ACP) and Inspector (Browser).
|
|
86867
|
+
* Each clientId can have only one active connection at a time.
|
|
86868
86868
|
*/
|
|
86869
86869
|
var ConnectionManager = class {
|
|
86870
86870
|
transports = {};
|
|
86871
86871
|
latestInspectorSessionId = null;
|
|
86872
|
-
chromeWatcherSessionIds = /* @__PURE__ */ new Set();
|
|
86873
86872
|
boundPuppets = /* @__PURE__ */ new Map();
|
|
86873
|
+
watchersByClientId = /* @__PURE__ */ new Map();
|
|
86874
86874
|
getTransport(sessionId) {
|
|
86875
86875
|
return this.transports[sessionId];
|
|
86876
86876
|
}
|
|
@@ -86880,19 +86880,22 @@ var ConnectionManager = class {
|
|
|
86880
86880
|
}
|
|
86881
86881
|
removeTransport(sessionId) {
|
|
86882
86882
|
delete this.transports[sessionId];
|
|
86883
|
-
|
|
86884
|
-
|
|
86883
|
+
for (const [_clientId, sessionIds] of this.watchersByClientId) if (sessionIds.has(sessionId)) {
|
|
86884
|
+
sessionIds.delete(sessionId);
|
|
86885
86885
|
const boundPuppet = this.boundPuppets.get(sessionId);
|
|
86886
86886
|
if (boundPuppet) boundPuppet.unbindPuppet();
|
|
86887
86887
|
this.boundPuppets.delete(sessionId);
|
|
86888
86888
|
}
|
|
86889
86889
|
}
|
|
86890
86890
|
/**
|
|
86891
|
-
* Clean up previous
|
|
86891
|
+
* Clean up previous watcher connections for the same clientId.
|
|
86892
|
+
* Ensures only one connection per clientId is active.
|
|
86892
86893
|
*/
|
|
86893
|
-
|
|
86894
|
+
cleanupPreviousWatchers(clientId, newSessionId) {
|
|
86895
|
+
const sessionIds = this.watchersByClientId.get(clientId);
|
|
86896
|
+
if (!sessionIds) return;
|
|
86894
86897
|
const sessionsToRemove = [];
|
|
86895
|
-
for (const existingSessionId of
|
|
86898
|
+
for (const existingSessionId of sessionIds) {
|
|
86896
86899
|
if (existingSessionId === newSessionId) continue;
|
|
86897
86900
|
const boundPuppet = this.boundPuppets.get(existingSessionId);
|
|
86898
86901
|
if (boundPuppet) boundPuppet.unbindPuppet();
|
|
@@ -86906,7 +86909,7 @@ var ConnectionManager = class {
|
|
|
86906
86909
|
}
|
|
86907
86910
|
sessionsToRemove.push(existingSessionId);
|
|
86908
86911
|
}
|
|
86909
|
-
for (const sessionId of sessionsToRemove)
|
|
86912
|
+
for (const sessionId of sessionsToRemove) sessionIds.delete(sessionId);
|
|
86910
86913
|
}
|
|
86911
86914
|
handleInspectorConnection(sessionId) {
|
|
86912
86915
|
this.latestInspectorSessionId = sessionId;
|
|
@@ -86915,7 +86918,7 @@ var ConnectionManager = class {
|
|
|
86915
86918
|
rebindWatchersToInspector(inspectorSessionId) {
|
|
86916
86919
|
const inspectorTransport = this.transports[inspectorSessionId];
|
|
86917
86920
|
if (!inspectorTransport) return;
|
|
86918
|
-
for (const
|
|
86921
|
+
for (const [_clientId, sessionIds] of this.watchersByClientId) for (const watcherSessionId of sessionIds) {
|
|
86919
86922
|
const watcherTransport = this.transports[watcherSessionId];
|
|
86920
86923
|
if (!watcherTransport) continue;
|
|
86921
86924
|
const previousBound = this.boundPuppets.get(watcherSessionId);
|
|
@@ -86924,21 +86927,24 @@ var ConnectionManager = class {
|
|
|
86924
86927
|
this.boundPuppets.set(watcherSessionId, newBound);
|
|
86925
86928
|
}
|
|
86926
86929
|
}
|
|
86927
|
-
|
|
86928
|
-
|
|
86929
|
-
|
|
86930
|
-
|
|
86931
|
-
|
|
86932
|
-
|
|
86933
|
-
|
|
86934
|
-
|
|
86935
|
-
|
|
86936
|
-
|
|
86937
|
-
|
|
86930
|
+
/**
|
|
86931
|
+
* Handle watcher connection.
|
|
86932
|
+
* @param sessionId - unique session ID
|
|
86933
|
+
* @param clientId - who is connecting (vscode, acp, cursor, etc.)
|
|
86934
|
+
* @param puppetId - who to control (inspector)
|
|
86935
|
+
* @param transport - the transport instance
|
|
86936
|
+
*/
|
|
86937
|
+
handleWatcherConnection(sessionId, clientId, puppetId, transport) {
|
|
86938
|
+
this.cleanupPreviousWatchers(clientId, sessionId);
|
|
86939
|
+
if (!this.watchersByClientId.has(clientId)) this.watchersByClientId.set(clientId, /* @__PURE__ */ new Set());
|
|
86940
|
+
this.watchersByClientId.get(clientId).add(sessionId);
|
|
86941
|
+
if (puppetId === "inspector" && this.latestInspectorSessionId) {
|
|
86942
|
+
const inspectorTransport = this.transports[this.latestInspectorSessionId];
|
|
86943
|
+
if (inspectorTransport) {
|
|
86944
|
+
const boundTransport = bindPuppet(transport, inspectorTransport);
|
|
86945
|
+
this.boundPuppets.set(sessionId, boundTransport);
|
|
86946
|
+
return boundTransport;
|
|
86938
86947
|
}
|
|
86939
|
-
} else {
|
|
86940
|
-
const targetTransport = this.transports[puppetId];
|
|
86941
|
-
if (targetTransport) return bindPuppet(transport, targetTransport);
|
|
86942
86948
|
}
|
|
86943
86949
|
return null;
|
|
86944
86950
|
}
|
|
@@ -87102,16 +87108,11 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
|
|
|
87102
87108
|
const url$1 = new URL(req.url ?? "", `http://${host}:${port}`);
|
|
87103
87109
|
const transport = new __modelcontextprotocol_sdk_server_sse_js.SSEServerTransport("/__mcp__/messages", res);
|
|
87104
87110
|
const sessionId = transport.sessionId;
|
|
87105
|
-
const
|
|
87111
|
+
const clientId = url$1.searchParams.get("clientId");
|
|
87106
87112
|
const puppetId = url$1.searchParams.get("puppetId");
|
|
87107
|
-
const clientType = url$1.searchParams.get("clientType");
|
|
87108
87113
|
connectionManager.registerTransport(sessionId, transport);
|
|
87109
|
-
if (
|
|
87110
|
-
if (
|
|
87111
|
-
if (puppetId) {
|
|
87112
|
-
connectionManager.handleWatcherConnection(sessionId, puppetId, transport);
|
|
87113
|
-
transport.__puppetId = puppetId;
|
|
87114
|
-
}
|
|
87114
|
+
if (clientId === "inspector") connectionManager.handleInspectorConnection(sessionId);
|
|
87115
|
+
if (clientId && clientId !== "inspector" && puppetId) connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
|
|
87115
87116
|
await mcpServer.connect(transport);
|
|
87116
87117
|
} catch (error$1) {
|
|
87117
87118
|
console.error("Error establishing SSE connection:", error$1);
|
|
@@ -87910,7 +87911,7 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
87910
87911
|
cwd: cwd$1,
|
|
87911
87912
|
mcpServers: [{
|
|
87912
87913
|
command: mcpRemote.command,
|
|
87913
|
-
args: [...mcpRemote.args, `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}/__mcp__/sse?puppetId=
|
|
87914
|
+
args: [...mcpRemote.args, `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}/__mcp__/sse?clientId=acp&puppetId=inspector`],
|
|
87914
87915
|
env: [],
|
|
87915
87916
|
name: "inspect"
|
|
87916
87917
|
}]
|
|
@@ -88371,7 +88372,7 @@ if (import.meta.env.DEV) {
|
|
|
88371
88372
|
host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
|
|
88372
88373
|
port: options.port ?? server.config.server.port ?? 5173
|
|
88373
88374
|
};
|
|
88374
|
-
const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?puppetId=
|
|
88375
|
+
const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?clientId=vscode&puppetId=inspector`;
|
|
88375
88376
|
console.log(`[dev-inspector] 📡 MCP: ${sseUrl}\n`);
|
|
88376
88377
|
await setupMcpMiddleware(server.middlewares, serverContext);
|
|
88377
88378
|
setupAcpMiddleware(server.middlewares, serverContext, {
|
package/dist/index.js
CHANGED
|
@@ -86855,14 +86855,14 @@ You MUST ask the user for confirmation before navigating to any URL.`,
|
|
|
86855
86855
|
//#endregion
|
|
86856
86856
|
//#region src/middleware/connection-manager.ts
|
|
86857
86857
|
/**
|
|
86858
|
-
* Manages MCP transport connections between Watcher (VS Code) and Inspector (Browser).
|
|
86859
|
-
*
|
|
86858
|
+
* Manages MCP transport connections between Watcher (VS Code/ACP) and Inspector (Browser).
|
|
86859
|
+
* Each clientId can have only one active connection at a time.
|
|
86860
86860
|
*/
|
|
86861
86861
|
var ConnectionManager = class {
|
|
86862
86862
|
transports = {};
|
|
86863
86863
|
latestInspectorSessionId = null;
|
|
86864
|
-
chromeWatcherSessionIds = /* @__PURE__ */ new Set();
|
|
86865
86864
|
boundPuppets = /* @__PURE__ */ new Map();
|
|
86865
|
+
watchersByClientId = /* @__PURE__ */ new Map();
|
|
86866
86866
|
getTransport(sessionId) {
|
|
86867
86867
|
return this.transports[sessionId];
|
|
86868
86868
|
}
|
|
@@ -86872,19 +86872,22 @@ var ConnectionManager = class {
|
|
|
86872
86872
|
}
|
|
86873
86873
|
removeTransport(sessionId) {
|
|
86874
86874
|
delete this.transports[sessionId];
|
|
86875
|
-
|
|
86876
|
-
|
|
86875
|
+
for (const [_clientId, sessionIds] of this.watchersByClientId) if (sessionIds.has(sessionId)) {
|
|
86876
|
+
sessionIds.delete(sessionId);
|
|
86877
86877
|
const boundPuppet = this.boundPuppets.get(sessionId);
|
|
86878
86878
|
if (boundPuppet) boundPuppet.unbindPuppet();
|
|
86879
86879
|
this.boundPuppets.delete(sessionId);
|
|
86880
86880
|
}
|
|
86881
86881
|
}
|
|
86882
86882
|
/**
|
|
86883
|
-
* Clean up previous
|
|
86883
|
+
* Clean up previous watcher connections for the same clientId.
|
|
86884
|
+
* Ensures only one connection per clientId is active.
|
|
86884
86885
|
*/
|
|
86885
|
-
|
|
86886
|
+
cleanupPreviousWatchers(clientId, newSessionId) {
|
|
86887
|
+
const sessionIds = this.watchersByClientId.get(clientId);
|
|
86888
|
+
if (!sessionIds) return;
|
|
86886
86889
|
const sessionsToRemove = [];
|
|
86887
|
-
for (const existingSessionId of
|
|
86890
|
+
for (const existingSessionId of sessionIds) {
|
|
86888
86891
|
if (existingSessionId === newSessionId) continue;
|
|
86889
86892
|
const boundPuppet = this.boundPuppets.get(existingSessionId);
|
|
86890
86893
|
if (boundPuppet) boundPuppet.unbindPuppet();
|
|
@@ -86898,7 +86901,7 @@ var ConnectionManager = class {
|
|
|
86898
86901
|
}
|
|
86899
86902
|
sessionsToRemove.push(existingSessionId);
|
|
86900
86903
|
}
|
|
86901
|
-
for (const sessionId of sessionsToRemove)
|
|
86904
|
+
for (const sessionId of sessionsToRemove) sessionIds.delete(sessionId);
|
|
86902
86905
|
}
|
|
86903
86906
|
handleInspectorConnection(sessionId) {
|
|
86904
86907
|
this.latestInspectorSessionId = sessionId;
|
|
@@ -86907,7 +86910,7 @@ var ConnectionManager = class {
|
|
|
86907
86910
|
rebindWatchersToInspector(inspectorSessionId) {
|
|
86908
86911
|
const inspectorTransport = this.transports[inspectorSessionId];
|
|
86909
86912
|
if (!inspectorTransport) return;
|
|
86910
|
-
for (const
|
|
86913
|
+
for (const [_clientId, sessionIds] of this.watchersByClientId) for (const watcherSessionId of sessionIds) {
|
|
86911
86914
|
const watcherTransport = this.transports[watcherSessionId];
|
|
86912
86915
|
if (!watcherTransport) continue;
|
|
86913
86916
|
const previousBound = this.boundPuppets.get(watcherSessionId);
|
|
@@ -86916,21 +86919,24 @@ var ConnectionManager = class {
|
|
|
86916
86919
|
this.boundPuppets.set(watcherSessionId, newBound);
|
|
86917
86920
|
}
|
|
86918
86921
|
}
|
|
86919
|
-
|
|
86920
|
-
|
|
86921
|
-
|
|
86922
|
-
|
|
86923
|
-
|
|
86924
|
-
|
|
86925
|
-
|
|
86926
|
-
|
|
86927
|
-
|
|
86928
|
-
|
|
86929
|
-
|
|
86922
|
+
/**
|
|
86923
|
+
* Handle watcher connection.
|
|
86924
|
+
* @param sessionId - unique session ID
|
|
86925
|
+
* @param clientId - who is connecting (vscode, acp, cursor, etc.)
|
|
86926
|
+
* @param puppetId - who to control (inspector)
|
|
86927
|
+
* @param transport - the transport instance
|
|
86928
|
+
*/
|
|
86929
|
+
handleWatcherConnection(sessionId, clientId, puppetId, transport) {
|
|
86930
|
+
this.cleanupPreviousWatchers(clientId, sessionId);
|
|
86931
|
+
if (!this.watchersByClientId.has(clientId)) this.watchersByClientId.set(clientId, /* @__PURE__ */ new Set());
|
|
86932
|
+
this.watchersByClientId.get(clientId).add(sessionId);
|
|
86933
|
+
if (puppetId === "inspector" && this.latestInspectorSessionId) {
|
|
86934
|
+
const inspectorTransport = this.transports[this.latestInspectorSessionId];
|
|
86935
|
+
if (inspectorTransport) {
|
|
86936
|
+
const boundTransport = bindPuppet(transport, inspectorTransport);
|
|
86937
|
+
this.boundPuppets.set(sessionId, boundTransport);
|
|
86938
|
+
return boundTransport;
|
|
86930
86939
|
}
|
|
86931
|
-
} else {
|
|
86932
|
-
const targetTransport = this.transports[puppetId];
|
|
86933
|
-
if (targetTransport) return bindPuppet(transport, targetTransport);
|
|
86934
86940
|
}
|
|
86935
86941
|
return null;
|
|
86936
86942
|
}
|
|
@@ -87094,16 +87100,11 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
|
|
|
87094
87100
|
const url = new URL(req.url ?? "", `http://${host}:${port}`);
|
|
87095
87101
|
const transport = new SSEServerTransport("/__mcp__/messages", res);
|
|
87096
87102
|
const sessionId = transport.sessionId;
|
|
87097
|
-
const
|
|
87103
|
+
const clientId = url.searchParams.get("clientId");
|
|
87098
87104
|
const puppetId = url.searchParams.get("puppetId");
|
|
87099
|
-
const clientType = url.searchParams.get("clientType");
|
|
87100
87105
|
connectionManager.registerTransport(sessionId, transport);
|
|
87101
|
-
if (
|
|
87102
|
-
if (
|
|
87103
|
-
if (puppetId) {
|
|
87104
|
-
connectionManager.handleWatcherConnection(sessionId, puppetId, transport);
|
|
87105
|
-
transport.__puppetId = puppetId;
|
|
87106
|
-
}
|
|
87106
|
+
if (clientId === "inspector") connectionManager.handleInspectorConnection(sessionId);
|
|
87107
|
+
if (clientId && clientId !== "inspector" && puppetId) connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
|
|
87107
87108
|
await mcpServer.connect(transport);
|
|
87108
87109
|
} catch (error$1) {
|
|
87109
87110
|
console.error("Error establishing SSE connection:", error$1);
|
|
@@ -87902,7 +87903,7 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
87902
87903
|
cwd: cwd$1,
|
|
87903
87904
|
mcpServers: [{
|
|
87904
87905
|
command: mcpRemote.command,
|
|
87905
|
-
args: [...mcpRemote.args, `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}/__mcp__/sse?puppetId=
|
|
87906
|
+
args: [...mcpRemote.args, `http://${serverContext?.host || "localhost"}:${serverContext?.port || 5173}/__mcp__/sse?clientId=acp&puppetId=inspector`],
|
|
87906
87907
|
env: [],
|
|
87907
87908
|
name: "inspect"
|
|
87908
87909
|
}]
|
|
@@ -88363,7 +88364,7 @@ if (import.meta.env.DEV) {
|
|
|
88363
88364
|
host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
|
|
88364
88365
|
port: options.port ?? server.config.server.port ?? 5173
|
|
88365
88366
|
};
|
|
88366
|
-
const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?puppetId=
|
|
88367
|
+
const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse?clientId=vscode&puppetId=inspector`;
|
|
88367
88368
|
console.log(`[dev-inspector] 📡 MCP: ${sseUrl}\n`);
|
|
88368
88369
|
await setupMcpMiddleware(server.middlewares, serverContext);
|
|
88369
88370
|
setupAcpMiddleware(server.middlewares, serverContext, {
|
package/package.json
CHANGED