@visulima/dev-toolbar 1.0.0-alpha.4 → 1.0.0-alpha.40
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/CHANGELOG.md +321 -0
- package/LICENSE.md +137 -5
- package/README.md +75 -18
- package/bin/mcp.js +29 -0
- package/dist/apps/a11y/index.d.ts +3 -2
- package/dist/apps/a11y/index.js +21 -2
- package/dist/apps/annotations/index.d.ts +4 -0
- package/dist/apps/annotations/index.js +18 -0
- package/dist/apps/assets/index.d.ts +4 -0
- package/dist/apps/assets/index.js +16 -0
- package/dist/apps/inspector/index.d.ts +3 -2
- package/dist/apps/inspector/index.js +30 -1
- package/dist/apps/module-graph/index.d.ts +3 -2
- package/dist/apps/module-graph/index.js +20 -1
- package/dist/apps/performance/index.d.ts +3 -2
- package/dist/apps/performance/index.js +17 -1
- package/dist/apps/seo/index.d.ts +3 -2
- package/dist/apps/seo/index.js +17 -1
- package/dist/apps/settings/index.d.ts +3 -2
- package/dist/apps/settings/index.js +17 -1
- package/dist/apps/tailwind/index.d.ts +3 -2
- package/dist/apps/tailwind/index.js +5 -5
- package/dist/apps/timeline/index.d.ts +3 -2
- package/dist/apps/timeline/index.js +18 -1
- package/dist/apps/vite-config/index.d.ts +3 -2
- package/dist/apps/vite-config/index.js +16 -1
- package/dist/client/overlay.d.ts +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +133 -8
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +1 -0
- package/dist/packem_chunks/inject-source.js +7 -1
- package/dist/packem_shared/Alert-CZq7C43v.js +1 -0
- package/dist/packem_shared/Badge-PpblpNWg.js +1 -0
- package/dist/packem_shared/Button-CAKvtfij.js +1 -0
- package/dist/packem_shared/Card-BSy2oRiS.js +1 -0
- package/dist/packem_shared/Icon-0XYV-4AL.js +1 -0
- package/dist/packem_shared/Input-Dc1WiT01.js +1 -0
- package/dist/packem_shared/Label-BZh8XxUb.js +1 -0
- package/dist/packem_shared/Popover-DuiU8EPg.js +1 -0
- package/dist/packem_shared/Progress-C90LC--2.js +1 -0
- package/dist/packem_shared/Select-CwD-d0pi.js +1 -0
- package/dist/packem_shared/Separator-PSjfhX_W.js +1 -0
- package/dist/packem_shared/Skeleton-BAFrGUR1.js +1 -0
- package/dist/packem_shared/Switch-Wpsp5M3p.js +1 -0
- package/dist/packem_shared/Tabs-BdNFQd3c.js +1 -0
- package/dist/packem_shared/Textarea-DP9gpte-.js +1 -0
- package/dist/packem_shared/Tooltip-DVeuszoY.js +1 -0
- package/dist/packem_shared/annotation-settings-DlLZO5Zp.js +1 -0
- package/dist/packem_shared/annotation-store-CXMIg0dM.js +1 -0
- package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
- package/dist/packem_shared/clsx-CtZWcPHt.js +1 -0
- package/dist/packem_shared/createClientRPCContext-80V9c3Qu.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-CzejbqD2.js +1 -0
- package/dist/packem_shared/createServerRPCContext-C30tqEfQ.js +1 -0
- package/dist/packem_shared/getGlobalHook-GRSqUNJ3.js +1 -0
- package/dist/packem_shared/getTimelineStore-BT5sImVb.js +1 -0
- package/dist/packem_shared/global-api.d-DeaCvII9.d.ts +546 -0
- package/dist/packem_shared/loadSettings-C0pUyx9j.js +1 -0
- package/dist/packem_shared/server.d-ZkcY0pge.d.ts +39 -0
- package/dist/packem_shared/sharedToolbarStylesheet-DNABzHAf.js +2 -0
- package/dist/packem_shared/store-Dqy0FbGw.js +1 -0
- package/dist/packem_shared/use-theme-DIqZkPAe.js +1 -0
- package/dist/toolbar/index.d.ts +152 -49
- package/dist/toolbar/index.js +3 -3
- package/dist/ui/index.d.ts +382 -17
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +183 -141
- package/dist/vite-plugin.js +5 -2
- package/package.json +41 -22
- package/dist/apps/a11y/a11y-app.d.ts +0 -5
- package/dist/apps/a11y/a11y-store.d.ts +0 -42
- package/dist/apps/a11y/a11y-tooltip.d.ts +0 -11
- package/dist/apps/inspector/inspector-app.d.ts +0 -12
- package/dist/apps/module-graph/module-graph-app.d.ts +0 -5
- package/dist/apps/more/index.d.ts +0 -3
- package/dist/apps/more/index.js +0 -2
- package/dist/apps/more/more-app.d.ts +0 -5
- package/dist/apps/performance/performance-app.d.ts +0 -5
- package/dist/apps/performance/performance-tooltip.d.ts +0 -5
- package/dist/apps/seo/seo-app.d.ts +0 -5
- package/dist/apps/settings/settings-app.d.ts +0 -4
- package/dist/apps/tailwind/tailwind-app.d.ts +0 -5
- package/dist/apps/timeline/timeline-app.d.ts +0 -5
- package/dist/apps/vite-config/vite-config-app.d.ts +0 -5
- package/dist/hooks/create-hook.d.ts +0 -12
- package/dist/hooks/events.d.ts +0 -7
- package/dist/hooks/global-hook.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -6
- package/dist/packem_shared/Alert-H-x1JuZ0.js +0 -1
- package/dist/packem_shared/Badge-C30mDKKG.js +0 -1
- package/dist/packem_shared/Button-DODNCTPZ.js +0 -1
- package/dist/packem_shared/Card-DdI7Wn3t.js +0 -1
- package/dist/packem_shared/Icon-DWFLZkwW.js +0 -1
- package/dist/packem_shared/Input-GfbOwAkK.js +0 -1
- package/dist/packem_shared/Label-Bzi47aUf.js +0 -1
- package/dist/packem_shared/Popover-CLt7YhUF.js +0 -1
- package/dist/packem_shared/Progress-vGfFpxRn.js +0 -1
- package/dist/packem_shared/Separator-DQGeJPQg.js +0 -1
- package/dist/packem_shared/Skeleton-BYXau6jM.js +0 -1
- package/dist/packem_shared/Switch-BeC78S_T.js +0 -1
- package/dist/packem_shared/Tabs-CXERaeAp.js +0 -1
- package/dist/packem_shared/Textarea-DvbSX13V.js +0 -1
- package/dist/packem_shared/Tooltip-tlBN-NdK.js +0 -1
- package/dist/packem_shared/cn-DWLJYh3h.js +0 -1
- package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +0 -1
- package/dist/packem_shared/createServerRPCContext-CEm1Ymkn.js +0 -1
- package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +0 -1
- package/dist/packem_shared/loadSettings-hvjR4fcS.js +0 -1
- package/dist/packem_shared/setupGlobalHook-CCf9Logv.js +0 -1
- package/dist/packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js +0 -2
- package/dist/packem_shared/store-DaUtLjf3.js +0 -1
- package/dist/packem_shared/use-theme-BOw3dPpY.js +0 -1
- package/dist/performance/monitor.d.ts +0 -116
- package/dist/rpc/client.d.ts +0 -9
- package/dist/rpc/functions/module-graph.d.ts +0 -17
- package/dist/rpc/functions/open-in-editor.d.ts +0 -16
- package/dist/rpc/functions/tailwind-config.d.ts +0 -15
- package/dist/rpc/functions/vite-config.d.ts +0 -9
- package/dist/rpc/server.d.ts +0 -15
- package/dist/timeline/capture.d.ts +0 -8
- package/dist/timeline/index.d.ts +0 -8
- package/dist/timeline/store.d.ts +0 -42
- package/dist/toolbar/app-manager.d.ts +0 -104
- package/dist/toolbar/components/app-button.d.ts +0 -19
- package/dist/toolbar/components/app-canvas.d.ts +0 -12
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -12
- package/dist/toolbar/components/first-visit-hint.d.ts +0 -16
- package/dist/toolbar/components/index.d.ts +0 -4
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -22
- package/dist/toolbar/components/toolbar-bar.d.ts +0 -14
- package/dist/toolbar/components/toolbar-container.d.ts +0 -55
- package/dist/toolbar/components/vite-overlay-button.d.ts +0 -14
- package/dist/toolbar/context/index.d.ts +0 -2
- package/dist/toolbar/context/toolbar-context.d.ts +0 -107
- package/dist/toolbar/global-api.d.ts +0 -24
- package/dist/toolbar/helpers.d.ts +0 -8
- package/dist/toolbar/hooks/index.d.ts +0 -10
- package/dist/toolbar/hooks/use-apps.d.ts +0 -15
- package/dist/toolbar/hooks/use-frame-state.d.ts +0 -100
- package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -23
- package/dist/toolbar/hooks/use-position.d.ts +0 -24
- package/dist/toolbar/hooks/use-theme.d.ts +0 -15
- package/dist/toolbar/hooks/use-toolbar.d.ts +0 -16
- package/dist/toolbar/settings.d.ts +0 -17
- package/dist/toolbar/stylesheet.d.ts +0 -3
- package/dist/toolbar/utils/index.d.ts +0 -12
- package/dist/types/app.d.ts +0 -175
- package/dist/types/global-api.d.ts +0 -91
- package/dist/types/hooks.d.ts +0 -86
- package/dist/types/index.d.ts +0 -12
- package/dist/types/messaging.d.ts +0 -43
- package/dist/types/rpc.d.ts +0 -97
- package/dist/types/timeline.d.ts +0 -62
- package/dist/types/toolbar.d.ts +0 -56
- package/dist/ui/components/alert.d.ts +0 -20
- package/dist/ui/components/badge.d.ts +0 -10
- package/dist/ui/components/button.d.ts +0 -12
- package/dist/ui/components/card.d.ts +0 -17
- package/dist/ui/components/icon.d.ts +0 -20
- package/dist/ui/components/input.d.ts +0 -8
- package/dist/ui/components/label.d.ts +0 -8
- package/dist/ui/components/popover.d.ts +0 -27
- package/dist/ui/components/progress.d.ts +0 -8
- package/dist/ui/components/separator.d.ts +0 -9
- package/dist/ui/components/skeleton.d.ts +0 -7
- package/dist/ui/components/switch.d.ts +0 -12
- package/dist/ui/components/tabs.d.ts +0 -29
- package/dist/ui/components/textarea.d.ts +0 -8
- package/dist/ui/components/tooltip.d.ts +0 -19
- package/dist/utils/cn.d.ts +0 -8
- package/dist/vite/inject-source.d.ts +0 -24
- package/dist/vite/matcher.d.ts +0 -6
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import{u as w,D as _}from"../../packem_shared/store-Dqy0FbGw.js";import{addHookName as g}from"preact/devtools";import{clsx as y}from"../../packem_shared/clsx-CtZWcPHt.js";import{useState as b,useRef as M,useEffect as R}from"preact/hooks";import{jsxs as l,jsx as r}from"preact/jsx-runtime";import T from"../../packem_shared/Button-CAKvtfij.js";import U from"../../packem_shared/Badge-PpblpNWg.js";const z=`<!-- @license lucide-static v1.17.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-gantt-chart"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
>
|
|
14
|
+
<path d="M6 5h12" />
|
|
15
|
+
<path d="M4 12h10" />
|
|
16
|
+
<path d="M12 19h8" />
|
|
17
|
+
</svg>
|
|
18
|
+
`,E="__visulima_timeline_capture__",m=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`,L=e=>e.startsWith("/@")||e.includes("/__vite")||e.includes("__visulima-dev-toolbar")||e.startsWith("data:")||e.startsWith("blob:"),I=()=>{if(globalThis[E])return;globalThis[E]=!0;const e=w();if(import.meta.hot&&(import.meta.hot.on("vite:beforeUpdate",o=>{const n=o,i=n.updates?.map(h=>h.path).join(", ")??"";e.addEvent("hmr",{data:{updates:n.updates},id:m("hmr"),level:"info",subtitle:i||void 0,time:Date.now(),title:"HMR Update"})}),import.meta.hot.on("vite:beforeFullReload",o=>{const n=o;e.addEvent("hmr",{id:m("hmr-reload"),level:"warning",subtitle:n.path??void 0,time:Date.now(),title:"Full Reload"})}),import.meta.hot.on("vite:error",o=>{const n=o,{err:i}=n;e.addEvent("errors",{data:i?{loc:i.loc,message:i.message,plugin:i.plugin,stack:i.stack}:void 0,id:m("vite-err"),level:"error",subtitle:i?.message??"Unknown error",time:Date.now(),title:"Vite Error"})})),globalThis.window!==void 0&&typeof globalThis.fetch=="function"){const o=globalThis.fetch.bind(globalThis);globalThis.fetch=async(...n)=>{const i=n[0],h=n[1],f=i instanceof URL?i.href:i.url,a=typeof i=="string"?i:f,d=(h?.method??(i instanceof Request?i.method:"GET")).toUpperCase();if(L(a))return o(...n);const c=Date.now();try{const s=await o(...n),v=Date.now()-c;return e.addEvent("network",{data:{method:d,status:s.status,statusText:s.statusText,url:a},duration:v,id:m("net"),level:s.ok?"info":"warning",subtitle:`${s.status} ${s.statusText}`,time:c,title:`${d} ${a}`}),s}catch(s){const v=Date.now()-c,p=s instanceof Error?s.message:"Network error";throw e.addEvent("network",{data:{error:p,method:d,url:a},duration:v,id:m("net-err"),level:"error",subtitle:p,time:c,title:`${d} ${a}`}),s}}}globalThis.window!==void 0&&(globalThis.addEventListener("error",o=>{o.filename?.includes("visulima-dev-toolbar")||e.addEvent("errors",{data:{colno:o.colno,filename:o.filename,lineno:o.lineno,message:o.message},id:m("err"),level:"error",subtitle:o.filename?`${o.filename}:${o.lineno}:${o.colno}`:void 0,time:Date.now(),title:o.message||"JavaScript Error"})}),globalThis.addEventListener("unhandledrejection",o=>{const{reason:n}=o,i=n instanceof Error?n.message:String(n??"Unhandled promise rejection");e.addEvent("errors",{data:{reason:String(n)},id:m("rej"),level:"error",subtitle:i,time:Date.now(),title:"Unhandled Promise Rejection"})}))},N=500,x="all",C=e=>new Date(e).toLocaleTimeString("en-US",{fractionalSecondDigits:3,hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"}),A={error:"destructive",info:"info",warning:"warning"},D=({level:e})=>{if(e)return r(U,{class:"text-[0.6rem] uppercase tracking-wider",variant:A[e]??"info",children:e})},F=({event:e,onClose:o})=>l("div",{class:"border-l border-border bg-background h-full flex flex-col min-w-0 w-80 shrink-0",children:[l("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[r("span",{class:"text-[0.75rem] font-semibold text-foreground truncate",children:e.title}),r(T,{"aria-label":"Close detail",class:"h-5 w-5 shrink-0",onClick:o,size:"icon",variant:"ghost",children:"✕"})]}),l("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Time"}),r("div",{class:"text-[0.8rem] font-mono text-foreground",children:C(e.time)})]}),e.subtitle&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Subtitle"}),r("div",{class:"text-[0.8rem] text-foreground",children:e.subtitle})]}),e.duration!==void 0&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Duration"}),l("div",{class:"text-[0.8rem] font-mono text-foreground",children:[e.duration,"ms"]})]}),e.level&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Level"}),r(D,{level:e.level})]}),e.data&&Object.keys(e.data).length>0&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Data"}),r("pre",{class:"text-[0.7rem] font-mono text-foreground/80 bg-foreground/4 p-3 overflow-auto border border-border/50 whitespace-pre-wrap break-all",children:JSON.stringify(e.data,void 0,2)})]})]})]}),G=e=>{const[o,n]=g(b(x),"activeTab"),[i,h]=g(b([]),"groups"),[f,a]=g(b(void 0),"selectedEvent"),d=g(M(void 0),"intervalRef"),c=()=>{const t=w();h(t.getGroups().map(u=>({...u,events:[...u.events]})))};R(()=>(c(),d.current=setInterval(c,N),()=>{d.current!==void 0&&clearInterval(d.current)}),[]);const s=new Map(_.map(t=>[t.id,t.color])),v=[{color:void 0,id:x,label:"All"},...i.map(t=>({color:s.get(t.id)??t.color,id:t.id,label:t.label}))],p=o===x?i.flatMap(t=>t.events).toSorted((t,u)=>t.time-u.time):i.find(t=>t.id===o)?.events??[],$=()=>{w().clearAll(),a(void 0),c()};return l("div",{class:"flex flex-col h-full",children:[l("div",{class:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border shrink-0",children:[r("div",{class:"flex items-center gap-0 overflow-x-auto",children:v.map(t=>l("button",{class:y("px-3 py-1.5 text-[0.75rem] font-medium whitespace-nowrap border-0 cursor-pointer transition-colors duration-150",o===t.id?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:()=>{n(t.id),a(void 0)},type:"button",children:[t.color&&r("span",{class:"inline-block size-2 rounded-full mr-1.5 align-middle",style:{backgroundColor:t.color}}),t.label]},t.id))}),r(T,{onClick:$,size:"sm",title:"Clear all events",variant:"outline",children:"Clear"})]}),l("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto",children:p.length===0?l("div",{class:"flex flex-col items-center justify-center h-full gap-4 p-8 text-center select-none",children:[r("div",{class:"size-12 border border-border/50 bg-foreground/2 flex items-center justify-center",children:r("svg",{"aria-hidden":"true",class:"size-5 text-muted-foreground/40",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24",children:r("path",{d:"M12 6v6h4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z","stroke-linecap":"round","stroke-linejoin":"round"})})}),l("div",{class:"space-y-1",children:[r("p",{class:"text-[0.8rem] font-medium text-foreground/60",children:"No events recorded yet"}),r("p",{class:"text-[0.7rem] text-muted-foreground",children:"Events appear here as your app runs"}),r("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-2 max-w-[240px] leading-relaxed",children:"HMR updates, network requests, and custom events are captured automatically"})]})]}):r("div",{class:"divide-y divide-border/50",children:p.map(t=>{const u=i.find(j=>j.events.some(S=>S.id===t.id)),k=s.get(u?.id??"")??u?.color;return l("button",{class:y("w-full flex items-start gap-3 px-4 py-3 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",f?.id===t.id&&"bg-primary/6"),onClick:()=>{a(f?.id===t.id?void 0:t)},type:"button",children:[k&&r("span",{class:"mt-1 size-1.5 rounded-full shrink-0",style:{backgroundColor:k}}),l("div",{class:"flex-1 min-w-0",children:[l("div",{class:"flex items-center gap-2 flex-wrap",children:[r("span",{class:"text-[0.8rem] font-medium text-foreground truncate",children:t.title}),r(D,{level:t.level})]}),t.subtitle&&r("div",{class:"text-[0.725rem] text-muted-foreground truncate mt-0.5",children:t.subtitle})]}),r("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 shrink-0 mt-0.5",children:C(t.time)})]},t.id)})})}),f&&r(F,{event:f,onClose:()=>{a(void 0)}})]})]})};I();const V={component:G,icon:z,id:"dev-toolbar:timeline",name:"Timeline"};export{V as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
|
|
2
|
+
import 'preact';
|
|
2
3
|
declare const viteConfigApp: DevToolbarApp;
|
|
3
|
-
export default
|
|
4
|
+
export { viteConfigApp as default };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import{addHookName as u}from"preact/devtools";import{clsx as h}from"../../packem_shared/clsx-CtZWcPHt.js";import{useState as p,useEffect as $,useRef as O}from"preact/hooks";import D from"../../packem_shared/Icon-0XYV-4AL.js";import{jsx as e,jsxs as l}from"preact/jsx-runtime";import w from"../../packem_shared/Badge-PpblpNWg.js";import j from"../../packem_shared/Button-CAKvtfij.js";import{Tabs as T,TabsList as P,TabsTrigger as L,TabsContent as v}from"../../packem_shared/Tabs-BdNFQd3c.js";import M from"../../packem_shared/Input-Dc1WiT01.js";import{Tooltip as V,TooltipTrigger as N,TooltipContent as B}from"../../packem_shared/Tooltip-DVeuszoY.js";const I=`<!-- @license lucide-static v1.17.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-zap"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
>
|
|
14
|
+
<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
|
|
15
|
+
</svg>
|
|
16
|
+
`,E="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M2.062%2012.348a1%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%2019.876%200%201%201%200%200%201%200%20.696%2010.75%2010.75%200%200%201-19.876%200%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%20%2F%3E%20%3C%2Fsvg%3E",R="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M10.733%205.076a10.744%2010.744%200%200%201%2011.205%206.575%201%201%200%200%201%200%20.696%2010.747%2010.747%200%200%201-1.444%202.49%22%20%2F%3E%20%3Cpath%20d%3D%22M14.084%2014.158a3%203%200%200%201-4.242-4.242%22%20%2F%3E%20%3Cpath%20d%3D%22M17.479%2017.499a10.75%2010.75%200%200%201-15.417-5.151%201%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%204.446-5.143%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3C%2Fsvg%3E",H="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-search%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21%2021-4.34-4.34%22%20%2F%3E%20%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228%22%20%2F%3E%20%3C%2Fsvg%3E",i=({children:t,title:r})=>l("section",{class:"space-y-1.5",children:[r&&l("h3",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground px-1 flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:"text-primary opacity-50",children:"//"}),r]}),e("div",{class:"rounded-none border border-border bg-card divide-y divide-border overflow-hidden border-l-2 border-l-primary/20",children:t})]}),k=({text:t})=>{const[r,o]=u(p(!1),"copied"),n=()=>{navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(o,1500,!1)}).catch(()=>{})};return e("button",{class:h("inline-flex items-center px-1.5 py-0.5 text-xxs font-mono border transition-colors duration-150 cursor-pointer",r?"border-primary text-primary bg-card":"border-border text-muted-foreground hover:text-foreground hover:border-foreground bg-transparent"),onClick:n,title:"Copy to clipboard",type:"button",children:r?"copied":"copy"})},J=({value:t})=>l("span",{class:"inline-flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:h("inline-block size-1.5 rounded-full",t?"bg-success":"bg-border")}),e("span",{class:h("text-xs font-mono font-medium",t?"text-success":"text-muted-foreground"),children:t?"true":"false"})]}),W=({items:t})=>t.length===0?e("span",{class:"text-muted-foreground text-xs italic opacity-50",children:"empty"}):e("div",{class:"flex flex-wrap gap-1",children:t.map(r=>e("span",{class:"inline-flex items-center px-1.5 py-0.5 text-xxs font-mono font-medium bg-secondary border border-border text-secondary-foreground",children:r},r))}),z=({path:t})=>{const r=t.replaceAll("\\","/").split("/").filter(Boolean),o=r.length>3?`…/${r.slice(-3).join("/")}`:t;return e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",title:t,children:o})},A=/^\/|^[A-Z]:\\/i,q=({value:t})=>{if(t==null)return e("span",{class:"text-muted-foreground text-xs opacity-40",children:"—"});if(typeof t=="boolean")return e(J,{value:t});if(Array.isArray(t))return e(W,{items:t.map(String)});if(typeof t=="object"){const o=JSON.stringify(t,void 0,2);return l("div",{class:"flex items-start gap-2",children:[e("pre",{class:"text-xs font-mono text-foreground bg-secondary border border-border px-2 py-1 overflow-auto max-h-24 flex-1 leading-relaxed",children:o}),e(k,{text:o})]})}const r=String(t);return A.test(r)&&r.length>40?e(z,{path:r}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:r})},s=({label:t,value:r})=>{if(r!=null)return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xs text-muted-foreground font-mono select-none self-center",children:t}),e("div",{class:"text-xs min-w-0 self-center",children:e(q,{value:r})})]})},K=()=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[e("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(t=>e("span",{class:"size-1.5 bg-primary rounded-full animate-pulse opacity-50",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-xs text-muted-foreground",children:"Loading Vite config…"})]}),U=({error:t,onRetry:r})=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-sm text-destructive",children:t}),e(j,{onClick:r,size:"sm",variant:"outline",children:"Retry"})]}),Z={post:"bg-blue-500/15 text-blue-400 border-blue-500/30",pre:"bg-amber-500/15 text-amber-400 border-amber-500/30"},G=({index:t,plugin:r})=>l("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xxs text-muted-foreground font-mono tabular-nums w-5 shrink-0 text-right select-none opacity-40",children:t+1}),e("span",{class:"text-xs font-mono text-foreground flex-1 truncate",children:r.name}),r.enforce?e("span",{class:h("text-xxs font-mono font-bold px-1.5 py-0.5 border uppercase tracking-wide",Z[r.enforce]),children:r.enforce}):e("span",{class:"text-xxs font-mono text-muted-foreground px-1.5 py-0.5 bg-secondary border border-border",children:"normal"})]}),Q=({plugins:t})=>{const[r,o]=u(p(""),"query"),n=u(O(null),"inputRef"),d=r?t.filter(a=>a.name.toLowerCase().includes(r.toLowerCase())):t;return l(i,{children:[l("div",{class:"flex items-center gap-2 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-6 shrink-0",children:"#"}),l("div",{class:"flex-1 flex items-center gap-2",children:[e(D,{class:"text-muted-foreground shrink-0",size:11,src:H}),e(M,{class:"h-5 text-xs bg-transparent border-0 border-b border-border rounded-none px-0 py-0 focus-visible:ring-0 focus-visible:border-foreground placeholder:text-muted-foreground",onInput:a=>{o(a.target.value)},placeholder:`filter ${t.length} plugins…`,ref:n,type:"search",value:r})]}),e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-14 text-right",children:"Enforce"})]}),d.length===0?l("div",{class:"px-4 py-6 text-center text-xs text-muted-foreground",children:['No plugins match "',r,'"']}):d.map(a=>e(G,{index:t.indexOf(a),plugin:a},a.name)),r&&d.length>0&&e("div",{class:"px-4 py-1.5 bg-secondary border-t border-border text-right",children:l("span",{class:"text-xxs text-muted-foreground",children:[d.length," of ",t.length]})})]})},F="text-xxs font-bold uppercase tracking-widest text-muted-foreground",C=({col1:t,col2:r,extra:o})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:F,children:t}),l("div",{class:"flex items-center justify-between gap-2",children:[e("span",{class:F,children:r}),o]})]}),X=({alias:t})=>{if(!t)return;let r=[];if(Array.isArray(t)?r=t.filter(o=>o?.find!==void 0):typeof t=="object"&&t!==null&&(r=Object.entries(t).map(([o,n])=>({find:o,replacement:n}))),r.length!==0)return l(i,{title:"Alias",children:[e(C,{col1:"Find",col2:"Replacement"}),r.map(({find:o,replacement:n})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary break-all leading-relaxed self-center",children:o}),e("div",{class:"self-center",children:A.test(n)&&n.length>40?e(z,{path:n}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:n})})]},o??n))]})},Y=new Set(["BASE_URL","DEV","MODE","PROD","SSR"]),_=36,ee=({forceVisible:t,tag:r,value:o})=>{const[n,d]=u(p(!1),"localRevealed"),a=t||n,b=a&&o.length>_,x=a?e("code",{class:"text-xs font-mono text-foreground truncate block",children:o}):e("span",{class:"text-xs font-mono text-muted-foreground tracking-widest select-none",children:"••••••••"});return l("div",{class:"flex items-center gap-2 w-full min-w-0",children:[e("span",{class:"flex-1 min-w-0 overflow-hidden",children:b?l(V,{children:[e(N,{class:"w-full block cursor-default",children:x}),e(B,{side:"top",children:e("code",{class:"text-xs font-mono break-all max-w-xs block",children:o})})]}):x}),r,e("button",{"aria-label":a?"Hide value":"Reveal value",class:"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer p-0.5",onClick:()=>{d(f=>!f)},title:a?"Hide value":"Reveal value",type:"button",children:e(D,{size:11,src:a?R:E})}),e(k,{text:o})]})},re=({entries:t})=>{const[r,o]=u(p(!1),"revealAll");return l(i,{title:"Environment Variables",children:[e(C,{col1:"Key",col2:"Value",extra:l("button",{class:"inline-flex items-center gap-1 text-xxs font-mono text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer",onClick:()=>{o(n=>!n)},type:"button",children:[e(D,{size:10,src:r?R:E}),r?"hide all":"reveal all"]})}),t.map(([n,d])=>{const a=Y.has(n);return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary truncate self-center",children:n}),e("div",{class:"self-center min-w-0",children:e(ee,{forceVisible:r,tag:e("span",{class:"text-xxs font-mono text-muted-foreground px-1 py-0.5 bg-secondary border border-border uppercase tracking-wide shrink-0 mr-5",children:a?"built-in":"user"}),value:d})})]},n)})]})},te=({entries:t})=>{if(t.length!==0)return l(i,{title:"Define Constants",children:[e(C,{col1:"Identifier",col2:"Replacement"}),t.map(([r,o])=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-amber-400 break-all leading-relaxed self-center",children:r}),l("div",{class:"flex items-center gap-2 self-center min-w-0",children:[e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed flex-1",children:JSON.stringify(o)}),e(k,{text:`${r}=${JSON.stringify(o)}`})]})]},r))]})},le=({helpers:t})=>{const[r,o]=u(p(void 0),"config"),[n,d]=u(p(void 0),"error"),[a,b]=u(p(!0),"loading"),x=()=>{b(!0),d(void 0),t.rpc.getViteConfig().then(c=>{o(c),b(!1)}).catch(c=>{d(c.message??"Failed to load Vite config"),b(!1)})};if($(()=>{x()},[]),a)return e(K,{});if(n||!r)return e(U,{error:n??"No config available",onRetry:x});const f=r.plugins?.length??0,m=Object.keys(r.env??{}).length,S=Object.keys(r.define??{}).length;let y=0;return Array.isArray(r.resolve?.alias)?y=r.resolve.alias.length:typeof r.resolve?.alias=="object"&&r.resolve.alias!==null&&(y=Object.keys(r.resolve.alias).length),l("div",{class:"flex flex-col h-full",children:[l("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0 flex-wrap",children:[r.mode&&e(w,{class:"uppercase tracking-wider text-xxs",variant:r.mode==="production"?"destructive":"default",children:r.mode}),r.server?.https&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"success",children:"HTTPS"}),r.ssr&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"secondary",children:"SSR"}),l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border truncate max-w-xs",title:r.root,children:["…/",r.root.replaceAll("\\","/").split("/").slice(-2).join("/")]}),r.base&&r.base!=="/"&&l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border",children:["base: ",r.base]}),e(j,{class:"ml-auto shrink-0 text-xs",onClick:x,size:"sm",variant:"outline",children:"Refresh"})]}),e("div",{class:"grid grid-cols-4 divide-x divide-border border-b border-border shrink-0",children:[{label:"plugins",value:f},{label:"env vars",value:m},{label:"defines",value:S},{label:"aliases",value:y}].map(({label:c,value:g})=>l("div",{class:"flex flex-col items-center py-2 gap-0.5",children:[e("span",{class:"text-sm font-semibold tabular-nums leading-none text-foreground",children:g}),e("span",{class:"text-xxs uppercase tracking-wider text-muted-foreground font-medium",children:c})]},c))}),l(T,{class:"flex flex-col flex-1 min-h-0",defaultValue:"server",children:[e("div",{class:"shrink-0 border-b border-border bg-muted",children:e(P,{class:"w-full rounded-none h-auto p-0 bg-transparent justify-start gap-0 overflow-x-auto",children:[{label:"Server",value:"server"},{label:`Plugins (${f})`,value:"plugins"},{label:"Build",value:"build"},{label:"Resolve",value:"resolve"},{label:`Env & Define (${m+S})`,value:"env"}].map(({label:c,value:g})=>e(L,{class:"rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none px-4 py-2 text-xs font-medium shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",value:g,children:c},g))})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"server",children:[l(i,{children:[e(s,{label:"host",value:r.server?.host??!1}),e(s,{label:"port",value:r.server?.port}),e(s,{label:"strictPort",value:r.server?.strictPort}),e(s,{label:"https",value:r.server?.https}),e(s,{label:"open",value:r.server?.open}),e(s,{label:"cors",value:r.server?.cors}),e(s,{label:"origin",value:r.server?.origin}),e(s,{label:"middlewareMode",value:r.server?.middlewareMode})]}),l(i,{title:"HMR",children:[e(s,{label:"enabled",value:r.server?.hmrEnabled??!0}),r.server?.hmrPort!==void 0&&e(s,{label:"port",value:r.server.hmrPort})]}),r.server?.proxy&&r.server.proxy.length>0&&e(i,{title:"Proxy Routes",children:r.server.proxy.map(c=>e("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:e("code",{class:"text-xs font-mono text-primary",children:c})},c))})]}),e(v,{class:"flex-1 overflow-auto p-4 mt-0",value:"plugins",children:f===0?e("p",{class:"text-sm text-muted-foreground text-center py-8",children:"No plugins registered"}):e(Q,{plugins:r.plugins??[]})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"build",children:[l(i,{children:[e(s,{label:"outDir",value:r.build?.outDir}),e(s,{label:"target",value:r.build?.target}),e(s,{label:"minify",value:r.build?.minify}),e(s,{label:"sourcemap",value:r.build?.sourcemap}),e(s,{label:"cssCodeSplit",value:r.build?.cssCodeSplit}),e(s,{label:"assetsDir",value:r.build?.assetsDir}),e(s,{label:"assetsInlineLimit",value:r.build?.assetsInlineLimit}),e(s,{label:"chunkSizeWarningLimit",value:r.build?.chunkSizeWarningLimit}),e(s,{label:"emptyOutDir",value:r.build?.emptyOutDir}),e(s,{label:"reportCompressedSize",value:r.build?.reportCompressedSize})]}),r.esbuild&&l(i,{title:"esbuild Transform",children:[e(s,{label:"jsx",value:r.esbuild.jsx}),e(s,{label:"jsxFactory",value:r.esbuild.jsxFactory}),e(s,{label:"jsxFragment",value:r.esbuild.jsxFragment}),e(s,{label:"jsxImportSource",value:r.esbuild.jsxImportSource}),e(s,{label:"target",value:r.esbuild.target})]}),l(i,{title:"CSS",children:[e(s,{label:"devSourcemap",value:r.css?.devSourcemap}),e(s,{label:"preprocessors",value:r.css?.preprocessors})]}),(r.optimizeDeps?.include?.length??0)>0||(r.optimizeDeps?.exclude?.length??0)>0?l(i,{title:"Optimize Deps",children:[e(s,{label:"include",value:r.optimizeDeps?.include}),e(s,{label:"exclude",value:r.optimizeDeps?.exclude})]}):void 0,r.ssr&&l(i,{title:"SSR",children:[e(s,{label:"target",value:r.ssr.target}),e(s,{label:"external",value:r.ssr.external}),e(s,{label:"noExternal",value:r.ssr.noExternal})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"resolve",children:[l(i,{children:[e(s,{label:"extensions",value:r.resolve?.extensions}),e(s,{label:"conditions",value:r.resolve?.conditions}),e(s,{label:"mainFields",value:r.resolve?.mainFields}),e(s,{label:"dedupe",value:r.resolve?.dedupe}),e(s,{label:"preserveSymlinks",value:r.resolve?.preserveSymlinks})]}),e(X,{alias:r.resolve?.alias}),l(i,{title:"Paths",children:[e(s,{label:"root",value:r.root}),e(s,{label:"publicDir",value:r.publicDir}),e(s,{label:"cacheDir",value:r.cacheDir}),e(s,{label:"envDir",value:r.envDir}),e(s,{label:"envPrefix",value:r.envPrefix})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"env",children:[m>0?e(re,{entries:Object.entries(r.env??{})}):e("div",{class:"rounded-none border border-border bg-card border-l-2 border-l-primary/20 px-4 py-3",children:e("p",{class:"text-xs text-muted-foreground",children:"No environment variables exposed to the client."})}),e(te,{entries:Object.entries(r.define??{})})]})]})]})},be={component:le,icon:I,id:"dev-toolbar:vite-config",name:"Vite Config"};export{be as default};
|
package/dist/client/overlay.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/client/overlay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import t from"virtual:visulima-dev-toolbar-options";globalThis.__VISULIMA_DEV_TOOLBAR_OPTIONS__=t;const f=()=>{if(!t.requireUrlFlag)return!0;const o=t.urlFlagName??"devtools";return new URLSearchParams(globalThis.window?.location.search).get(o)==="true"},g=o=>Promise.all([o.settings?import("virtual:visulima-dev-toolbar-path:apps/settings/index.js"):void 0,o.timeline?import("virtual:visulima-dev-toolbar-path:apps/timeline/index.js"):void 0,o.viteConfig?import("virtual:visulima-dev-toolbar-path:apps/vite-config/index.js"):void 0,o.moduleGraph?import("virtual:visulima-dev-toolbar-path:apps/module-graph/index.js"):void 0,o.seo?import("virtual:visulima-dev-toolbar-path:apps/seo/index.js"):void 0,o.performance?import("virtual:visulima-dev-toolbar-path:apps/performance/index.js"):void 0,o.a11y?import("virtual:visulima-dev-toolbar-path:apps/a11y/index.js"):void 0,o.inspector?import("virtual:visulima-dev-toolbar-path:apps/inspector/index.js"):void 0,o.tailwind?import("virtual:visulima-dev-toolbar-path:apps/tailwind/index.js"):void 0,o.assets?import("virtual:visulima-dev-toolbar-path:apps/assets/index.js"):void 0,o.annotations?import("virtual:visulima-dev-toolbar-path:apps/annotations/index.js"):void 0]),T=(o,i)=>{const[e,r,l,s,d,c,m,p,_,I,u]=i;if(!o.registerApp)return;const v=[r,l,s,d,c,m,p,_,I,u];for(const n of v)n&&o.registerApp(n.default,!0);e&&o.registerApp(e.default,!0)},a=async()=>{if(globalThis.window===void 0||!f()||globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__)return;globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!0;let o;try{await import("virtual:visulima-dev-toolbar-path:toolbar/index.js");const{apps:i}=t,e=await g(i);if(o=document.createElement("dev-toolbar"),document.body.append(o),T(o,e),t.customApps)for(const r of t.customApps)o.registerApp(r,!1);o.init&&o.init(),console.log("[dev-toolbar] Initialized successfully")}catch(i){o?.isConnected&&o.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,console.error("[dev-toolbar] Failed to initialize:",i)}};typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a().catch(()=>{}));import.meta.hot&&import.meta.hot.on("dev-toolbar:init",()=>{const o=document.querySelector("dev-toolbar");o&&o.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,a().catch(()=>{})});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export { DevToolbar } from "./toolbar/index.
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { D as DevToolbarApp, T as ToolbarSettings } from "./packem_shared/app.d-SmKEDxsI.js";
|
|
2
|
+
export type { A as AppView, b as DEFAULT_TOOLBAR_SETTINGS, a as DevToolbarAppState, F as FrameState, N as NotificationLevel, P as PositionAnchor, S as ServerFunctions, c as ServerHelpers, d as ToolbarAppEventTarget, e as ToolbarPlacement } from "./packem_shared/app.d-SmKEDxsI.js";
|
|
3
|
+
import { T as TimelineEvent, D as DevToolbarHook, C as ClientFunctions, b as ClientRPCContext, c as TimelineGroup } from "./packem_shared/global-api.d-DeaCvII9.js";
|
|
4
|
+
export type { A as AccessibilityInfo, d as Annotation, e as AnnotationIntent, f as AnnotationSeverity, g as AnnotationStatus, B as BoundingBox, h as CreateAnnotationData, i as DEFAULT_TIMELINE_GROUPS, F as FrameworkContext, H as HookEvents, S as RPCServerFunctions, a as ServerRPCContext, j as ThreadMessage, k as TimelineEventLevel, U as UpdateAnnotationData, V as VisulimaDevTools } from "./packem_shared/global-api.d-DeaCvII9.js";
|
|
5
|
+
export { type R as ReadFileOptions, type S as ServerRPCOptions, c as createServerRPCContext } from "./packem_shared/server.d-ZkcY0pge.js";
|
|
6
|
+
export { DevToolbar } from "./toolbar/index.js";
|
|
7
|
+
import 'preact';
|
|
8
|
+
import 'vite';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a dev toolbar hook instance.
|
|
11
|
+
* @param onRegisterApp Callback when app is registered.
|
|
12
|
+
* @param onTimelineEvent Callback when timeline event is added.
|
|
13
|
+
* @returns Hook instance.
|
|
14
|
+
*/
|
|
15
|
+
declare const createDevToolbarHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
|
|
16
|
+
/**
|
|
17
|
+
* Setup global hook on window object.
|
|
18
|
+
* @param onRegisterApp Callback when app is registered.
|
|
19
|
+
* @param onTimelineEvent Callback when timeline event is added.
|
|
20
|
+
* @returns Hook instance.
|
|
21
|
+
*/
|
|
22
|
+
declare const setupGlobalHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
|
|
23
|
+
/**
|
|
24
|
+
* Get the global hook instance.
|
|
25
|
+
* @returns Hook instance or undefined.
|
|
26
|
+
*/
|
|
27
|
+
declare const getGlobalHook: () => DevToolbarHook | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Creates client-side RPC context.
|
|
30
|
+
* @param customFunctions Custom client functions to register.
|
|
31
|
+
* @returns Client RPC context.
|
|
32
|
+
*/
|
|
33
|
+
declare const createClientRPCContext: (customFunctions?: Partial<ClientFunctions>) => ClientRPCContext;
|
|
34
|
+
/**
|
|
35
|
+
* Timeline store for managing timeline events.
|
|
36
|
+
*/
|
|
37
|
+
declare class TimelineStore {
|
|
38
|
+
private groups;
|
|
39
|
+
private maxEvents;
|
|
40
|
+
constructor(maxEvents?: number);
|
|
41
|
+
/**
|
|
42
|
+
* Adds an event to a group.
|
|
43
|
+
*/
|
|
44
|
+
addEvent(groupId: string, event: TimelineEvent): void;
|
|
45
|
+
/**
|
|
46
|
+
* Gets all timeline groups.
|
|
47
|
+
*/
|
|
48
|
+
getGroups(): TimelineGroup[];
|
|
49
|
+
/**
|
|
50
|
+
* Gets events for a specific group.
|
|
51
|
+
*/
|
|
52
|
+
getGroupEvents(groupId: string): TimelineEvent[];
|
|
53
|
+
/**
|
|
54
|
+
* Gets all events across all groups.
|
|
55
|
+
*/
|
|
56
|
+
getAllEvents(): TimelineEvent[];
|
|
57
|
+
/**
|
|
58
|
+
* Clears events for a specific group.
|
|
59
|
+
*/
|
|
60
|
+
clearGroup(groupId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clears all events from all groups.
|
|
63
|
+
*/
|
|
64
|
+
clearAll(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Gets events within a time range.
|
|
67
|
+
*/
|
|
68
|
+
getEventsInRange(startTime: number, endTime: number): TimelineEvent[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Gets or creates the timeline store singleton instance.
|
|
72
|
+
*/
|
|
73
|
+
declare const getTimelineStore: () => TimelineStore;
|
|
74
|
+
/**
|
|
75
|
+
* Message channel interface for bidirectional communication
|
|
76
|
+
*/
|
|
77
|
+
interface MessageChannel<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
78
|
+
/**
|
|
79
|
+
* Unsubscribe from an event
|
|
80
|
+
* @param event Event name
|
|
81
|
+
* @param handler Optional specific handler to remove
|
|
82
|
+
*/
|
|
83
|
+
off: <K extends keyof TEvents>(event: K, handler?: TEvents[K]) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Subscribe to an event
|
|
86
|
+
* @param event Event name
|
|
87
|
+
* @param handler Event handler
|
|
88
|
+
* @returns Unsubscribe function
|
|
89
|
+
*/
|
|
90
|
+
on: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Subscribe to an event once
|
|
93
|
+
* @param event Event name
|
|
94
|
+
* @param handler Event handler
|
|
95
|
+
*/
|
|
96
|
+
once: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Send a message/event
|
|
99
|
+
* @param event Event name
|
|
100
|
+
* @param data Event data
|
|
101
|
+
*/
|
|
102
|
+
send: <K extends keyof TEvents>(event: K, ...args: Parameters<TEvents[K]>) => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Channel factory function
|
|
106
|
+
*/
|
|
107
|
+
type ChannelFactory<TEvents extends Record<string, (...args: any[]) => void>> = () => MessageChannel<TEvents>;
|
|
108
|
+
/**
|
|
109
|
+
* Factory result providing a method to instantiate named message channels.
|
|
110
|
+
*/
|
|
111
|
+
interface MessageChannelContext<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
112
|
+
/**
|
|
113
|
+
* Creates and returns a new channel instance.
|
|
114
|
+
*/
|
|
115
|
+
createChannel: () => MessageChannel<TEvents>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Loads settings from localStorage, merging with defaults.
|
|
119
|
+
* @returns Toolbar settings.
|
|
120
|
+
*/
|
|
121
|
+
declare const loadSettings: () => ToolbarSettings;
|
|
122
|
+
/**
|
|
123
|
+
* Saves settings to localStorage.
|
|
124
|
+
* @param settings Toolbar settings to save.
|
|
125
|
+
*/
|
|
126
|
+
declare const saveSettings: (settings: ToolbarSettings) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Merges partial updates into the current settings and persists them.
|
|
129
|
+
* @param updates Partial settings to update.
|
|
130
|
+
* @returns Updated settings.
|
|
131
|
+
*/
|
|
132
|
+
declare const updateSettings: (updates: Partial<ToolbarSettings>) => ToolbarSettings;
|
|
133
|
+
export { type ChannelFactory, type ClientRPCContext, type DevToolbarApp, type DevToolbarHook, type MessageChannel, type MessageChannelContext, type ClientFunctions as RPCClientFunctions, type TimelineEvent, type TimelineGroup, type TimelineStore, type ToolbarSettings, createClientRPCContext, createDevToolbarHook, getGlobalHook, getTimelineStore, loadSettings, saveSettings, setupGlobalHook, updateSettings };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createClientRPCContext as t}from"./packem_shared/createClientRPCContext-
|
|
1
|
+
import{createClientRPCContext as t}from"./packem_shared/createClientRPCContext-80V9c3Qu.js";import{createServerRPCContext as a}from"./packem_shared/createServerRPCContext-C30tqEfQ.js";import{DevToolbar as p}from"./toolbar/index.js";import{loadSettings as m,saveSettings as f,updateSettings as n}from"./packem_shared/loadSettings-C0pUyx9j.js";import{createDevToolbarHook as s}from"./packem_shared/createDevToolbarHook-CzejbqD2.js";import{getGlobalHook as C,setupGlobalHook as S}from"./packem_shared/getGlobalHook-GRSqUNJ3.js";import{u as v}from"./packem_shared/store-Dqy0FbGw.js";export{p as DevToolbar,t as createClientRPCContext,s as createDevToolbarHook,a as createServerRPCContext,C as getGlobalHook,v as getTimelineStore,m as loadSettings,f as saveSettings,S as setupGlobalHook,n as updateSettings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as k}from"node:module";import{r as d,S as D,a as E,i as j,w as v,d as M,b as x}from"../packem_shared/annotation-store-CXMIg0dM.js";const J=k(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=f=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[m,s]=p.versions.node.split(".").map(Number);if(m>22||m===22&&s>=3||m===20&&s>=16)return p.getBuiltinModule(f)}return J(f)},A=O("node:fs/promises"),I=O("node:path"),U=async()=>{const{McpServer:f}=await import("@modelcontextprotocol/sdk/server/mcp.js"),{StdioServerTransport:m}=await import("@modelcontextprotocol/sdk/server/stdio.js"),{z:s}=await import("zod"),a=process.cwd(),u=new f({name:"visulima-dev-toolbar",version:"1.0.0-alpha.5"});u.tool("get_pending_annotations","Get all pending visual annotations from the dev toolbar. Returns annotations with metadata but not screenshot binary data — use get_screenshot for that.",{},async()=>{const i=(await d(a)).filter(t=>t.status==="pending").map(t=>({...t,screenshot:!!t.screenshot}));return{content:[{text:JSON.stringify({annotations:i,count:i.length},void 0,2),type:"text"}]}}),u.tool("get_screenshot","Get the screenshot image for an annotation as base64 data. Use this after get_pending_annotations to see what the user annotated.",{annotation_id:s.string().describe("The annotation ID to get the screenshot for")},async({annotation_id:i})=>{const t=(await d(a)).find(o=>o.id===i);if(!t)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};if(!t.screenshot)return{content:[{text:JSON.stringify({error:"No screenshot for this annotation"}),type:"text"}],isError:!0};if(!t.screenshot.startsWith(`${D}/`))return{content:[{text:JSON.stringify({error:"Invalid screenshot path"}),type:"text"}],isError:!0};const{base:n}=E(a),e=I.join(n,t.screenshot);if(!j(e,n))return{content:[{text:JSON.stringify({error:"Invalid screenshot path"}),type:"text"}],isError:!0};try{const o=await A.readFile(e),r=I.extname(e).slice(1),g=r==="svg"?"image/svg+xml":r==="jpg"?"image/jpeg":`image/${r}`;return{content:[{data:o.toString("base64"),mimeType:g,type:"image"}]}}catch{return{content:[{text:JSON.stringify({error:"Screenshot file not found"}),type:"text"}],isError:!0}}}),u.tool("resolve_annotation","Mark an annotation as resolved after fixing the issue. Automatically deletes the associated screenshot.",{annotation_id:s.string().describe("The annotation ID to resolve")},async({annotation_id:i})=>v(async()=>{const t=await d(a),n=t.findIndex(o=>o.id===i);if(n===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const e=t[n];return e.status="resolved",e.resolvedBy="agent",e.updatedAt=new Date().toISOString(),e.screenshot&&(await M(a,e.screenshot),e.screenshot=void 0),t[n]=e,await x(a,t),{content:[{text:JSON.stringify({annotation:e,ok:!0},void 0,2),type:"text"}]}})),u.tool("add_thread_message","Add a message to an annotation's conversation thread. Use this to communicate with the developer about the annotation.",{annotation_id:s.string().describe("The annotation ID to add a message to"),message:s.string().describe("The message content")},async({annotation_id:i,message:t})=>v(async()=>{const n=await d(a),e=n.findIndex(r=>r.id===i);if(e===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const o=n[e];return o.thread||(o.thread=[]),o.thread.push({content:t,id:crypto.randomUUID(),role:"agent",timestamp:new Date().toISOString()}),o.updatedAt=new Date().toISOString(),n[e]=o,await x(a,n),{content:[{text:JSON.stringify({annotation:o,ok:!0},void 0,2),type:"text"}]}})),u.tool("acknowledge_annotation","Mark an annotation as acknowledged — signals to the developer that the agent has seen it and will work on it. Use this before starting to fix an issue.",{annotation_id:s.string().describe("The annotation ID to acknowledge")},async({annotation_id:i})=>v(async()=>{const t=await d(a),n=t.findIndex(o=>o.id===i);if(n===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const e=t[n];return e.status="acknowledged",e.updatedAt=new Date().toISOString(),t[n]=e,await x(a,t),{content:[{text:JSON.stringify({annotation:e,ok:!0},void 0,2),type:"text"}]}})),u.tool("watch_annotations","Block until new pending annotations appear. Use this for hands-free mode: call in a loop to automatically detect when the developer adds feedback. Returns after the batch window (default 10s) to collect multiple annotations submitted in quick succession.",{batch_window_ms:s.number().optional().describe("How long to wait for additional annotations after the first one arrives (default: 10000ms)"),timeout_ms:s.number().optional().describe("Maximum time to wait before returning empty (default: 300000ms = 5 minutes)")},async({batch_window_ms:i,timeout_ms:t})=>{const n=i??1e4,e=t??3e5,o=2e3,r=new Set((await d(a)).filter(l=>l.status==="pending").map(l=>l.id));let g,w;const y=await Promise.race([new Promise(l=>{w=setTimeout(l,e,{timedOut:!0})}),new Promise((l,S)=>{g=setInterval(()=>{d(a).then(_=>{_.filter(h=>h.status==="pending").filter(h=>!r.has(h.id)).map(h=>h.id).length>0&&(clearInterval(g),clearTimeout(w),setTimeout(()=>{d(a).then(h=>{const b=h.filter(c=>c.status==="pending"),T=b.filter(c=>!r.has(c.id)).map(c=>c.id);l({annotations:b.map(c=>({...c,screenshot:!!c.screenshot})),newIds:T})}).catch(S)},n))}).catch(_=>{clearInterval(g),clearTimeout(w),S(_)})},o)})]);return clearInterval(g),clearTimeout(w),"timedOut"in y?{content:[{text:JSON.stringify({annotations:[],count:0,newCount:0,timedOut:!0}),type:"text"}]}:{content:[{text:JSON.stringify({annotations:y.annotations,count:y.annotations.length,newCount:y.newIds.length},void 0,2),type:"text"}]}});const N=new m;await u.connect(N)};export{U as startMcpServer};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
var $=Object.defineProperty;var f=(e,t)=>$(e,"name",{value:t,configurable:!0});import x from"@babel/generator";import{parse as S}from"@babel/parser";import E from"@babel/traverse";import*as g from"@babel/types";import{normalizePath as j}from"vite";var w=Object.defineProperty,y=f((e,t)=>w(e,"name",{value:t,configurable:!0}),"r");const A=/[.+^${}()|[\]\\]/g,O=y(e=>e.replaceAll(A,String.raw`\$&`),"escapeRegExp"),h=y(e=>{const t=e.split("**").map(o=>o.split("*").map(a=>O(a)).join("[^/]*")).join(".*");return new RegExp(t)},"globToRegex"),F=y((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):h(o).test(t)),"matcher");var P=Object.defineProperty,m=f((e,t)=>P(e,"name",{value:t,configurable:!0}),"c");const v=E.default??E,R=x.default??x,b="data-vdt-source",u=m(e=>{let t;const o=m(a=>{const r=a[0];r&&(r.type==="Identifier"&&(t=r.name),r.type==="ObjectPattern"&&r.properties.forEach(i=>{i.type==="RestElement"&&i.argument.type==="Identifier"&&(t=i.argument.name)}))},"extractFromParams");return e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"||e.type==="FunctionDeclaration"?(o(e.params),t):(e.type==="VariableDeclarator"&&(e.init?.type==="ArrowFunctionExpression"||e.init?.type==="FunctionExpression")&&o(e.init.params),t)},"getPropsNameFromFunctionDeclaration"),d=m(e=>e.type==="JSXIdentifier"?e.name:e.type==="JSXMemberExpression"?`${d(e.object)}.${d(e.property)}`:`${e.namespace.name}:${e.name.name}`,"getNameOfElement"),M=m(e=>{const t=new Map,o=new Map;try{const a=S(e,{plugins:["jsx","typescript"],sourceType:"module"});v(a,{JSXOpeningElement(r){const i=d(r.node.name),s=o.get(i)??0;o.set(i,s+1),r.node.loc&&t.set(`${i}:${s}`,{col:r.node.loc.start.column,line:r.node.loc.start.line})}})}catch{}return t},"buildPositionMap"),T=m((e,t,o,a,r,i)=>{const{loc:s}=e.node;if(!s)return!1;const n=d(e.node.name);let p;if(r&&i){const c=i.get(n)??0;i.set(n,c+1),p=r.get(`${n}:${c}`)}if(n==="Fragment"||n==="React.Fragment"||n==="html"||n==="head"||n==="body"||F(a,n))return!1;const l=e.node.attributes.some(c=>c.type==="JSXAttribute"&&c.name.type==="JSXIdentifier"&&c.name.name===b);if(e.node.attributes.some(c=>c.type==="JSXSpreadAttribute"&&c.argument.type==="Identifier"&&c.argument.name===t)||l)return!1;const J=p?.line??s.start.line,X=p?.col??s.start.column;return e.node.attributes.push(g.jsxAttribute(g.jsxIdentifier(b),g.stringLiteral(`${o}:${J}:${X+1}`))),!0},"transformJSX"),I=m((e,t,o,a)=>{let r=!1;const i=a?new Map:void 0,s=m(n=>p=>{T(p,n,t,o,a,i)&&(r=!0)},"visitJSX");return v(e,{ArrowFunctionExpression(n){n.traverse({JSXOpeningElement:s(u(n.node))})},FunctionDeclaration(n){n.traverse({JSXOpeningElement:s(u(n.node))})},FunctionExpression(n){n.traverse({JSXOpeningElement:s(u(n.node))})},VariableDeclaration(n){const p=n.node.declarations.find(l=>l.init?.type==="ArrowFunctionExpression"||l.init?.type==="FunctionExpression");p&&n.traverse({JSXOpeningElement:s(u(p))})}}),r},"transform"),C=m((e,t,o={},a)=>{const[r]=t.split("?"),i=r.replace(`${j(process.cwd())}/`,"");if(!F(o.files??[],i))try{const s=S(e,{plugins:["jsx","typescript"],sourceType:"module"}),n=a&&a!==e?M(a):void 0;return I(s,i,o.components??[],n)?R(s,{filename:t,retainLines:!0,sourceFileName:r,sourceMaps:!0}):void 0}catch{return}},"addSourceToJsx");export{b as SOURCE_ATTR,C as addSourceToJsx};
|
|
1
|
+
import me from"@babel/generator";import{parse as Ee}from"@babel/parser";import ye from"@babel/traverse";import{normalizePath as Ue}from"vite";const xe="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u0870-\\u0887\\u0889-\\u088f\\u08a0-\\u08c9\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u09fc\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c5c\\u0c5d\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cdc-\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d04-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u1711\\u171f-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4c\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c8a\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31bf\\u31f0-\\u31ff\\u3400-\\u4dbf\\u4e00-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7dc\\ua7f1-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab69\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",Ke="\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u0897-\\u089f\\u08ca-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b55-\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3c\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0cf3\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d81-\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ece\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u180f-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1abf-\\u1add\\u1ae0-\\u1aeb\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1dff\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\u30fb\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua82c\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\\uff65",ge=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],_e=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],We=new RegExp("["+xe+"]"),ze=new RegExp("["+xe+Ke+"]");function te(e,t){let a=65536;for(let r=0,n=t.length;r<n;r+=2){if(a+=t[r],a>e)return!1;if(a+=t[r+1],a>=e)return!0}return!1}function Ye(e){return e<65?e===36:e<=90?!0:e<97?e===95:e<=122?!0:e<=65535?e>=170&&We.test(String.fromCharCode(e)):te(e,ge)}function Qe(e){return e<48?e===36:e<58?!0:e<65?!1:e<=90?!0:e<97?e===95:e<=122?!0:e<=65535?e>=170&&ze.test(String.fromCharCode(e)):te(e,ge)||te(e,_e)}function He(e){let t=!0;for(let a=0;a<e.length;a++){let r=e.charCodeAt(a);if((r&64512)===55296&&a+1<e.length){const n=e.charCodeAt(++a);(n&64512)===56320&&(r=65536+((r&1023)<<10)+(n&1023))}if(t){if(t=!1,!Ye(r))return!1}else if(!Qe(r))return!1}return!t}const re={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},Ge=new Set(re.keyword),Ze=new Set(re.strict);new Set(re.strictBind);function Pe(e,t){return t&&e==="await"||e==="enum"}function et(e,t){return Pe(e,t)||Ze.has(e)}function he(e){return Ge.has(e)}var tt=function(e){return e>=48&&e<=57};function at(e,t,a,r,n,d){const m=a,u=r,y=n;let c="",x=null,g=a;const{length:I}=t;for(;;){if(a>=I){d.unterminated(m,u,y),c+=t.slice(g,a);break}const L=t.charCodeAt(a);if(it(e,L,t,a)){c+=t.slice(g,a);break}if(L===92){c+=t.slice(g,a);const q=rt(t,a,r,n,e==="template",d);q.ch===null&&!x?x={pos:a,lineStart:r,curLine:n}:c+=q.ch,{pos:a,lineStart:r,curLine:n}=q,g=a}else L===8232||L===8233?(++a,++n,r=a):L===10||L===13?(c+=t.slice(g,a)+`
|
|
2
|
+
`,++a,L===13&&t.charCodeAt(a)===10&&++a,++n,g=r=a):++a}return{pos:a,str:c,firstInvalidLoc:x,lineStart:r,curLine:n}}function it(e,t,a,r){return t===96||t===36&&a.charCodeAt(r+1)===123}function rt(e,t,a,r,n,d){t++;const u=c=>({pos:t,ch:c,lineStart:a,curLine:r}),y=e.charCodeAt(t++);switch(y){case 110:return u(`
|
|
3
|
+
`);case 114:return u("\r");case 120:{let c;return{code:c,pos:t}=ae(e,t,a,r,2,!1,!1,d),u(c===null?null:String.fromCharCode(c))}case 117:{let c;return{code:c,pos:t}=ot(e,t,a,r,!1,d),u(c===null?null:String.fromCodePoint(c))}case 116:return u(" ");case 98:return u("\b");case 118:return u("\v");case 102:return u("\f");case 13:e.charCodeAt(t)===10&&++t;case 10:a=t,++r;case 8232:case 8233:return u("");case 56:case 57:return u(null);default:if(y>=48&&y<=55){const c=t-1;let x=/^[0-7]+/.exec(e.slice(c,t+2))[0],g=parseInt(x,8);g>255&&(x=x.slice(0,-1),g=parseInt(x,8)),t+=x.length-1;const I=e.charCodeAt(t);return u(x!=="0"||I===56||I===57?null:String.fromCharCode(g))}return u(String.fromCharCode(y))}}function ae(e,t,a,r,n,d,m,u){const y=t;let c;return{n:c,pos:t}=nt(e,t,a,r,16,n,d,!1,u,!0),c===null&&(t=y-1),{code:c,pos:t}}function nt(e,t,a,r,n,d,m,u,y,c){const x=t;let g=!1,I=0;for(let L=0,q=d??1/0;L<q;++L){const B=e.charCodeAt(t);let O;if(B===95&&u!=="bail")return e.charCodeAt(t-1),e.charCodeAt(t+1),{n:null,pos:t};if(B>=97?O=B-97+10:B>=65?O=B-65+10:tt(B)?O=B-48:O=1/0,O>=n){if(O<=9&&c)return{n:null,pos:t};if(O<=9&&y.invalidDigit(t,a,r,n))O=0;else if(m)O=0,g=!0;else break}++t,I=I*n+O}return t===x||d!=null&&t-x!==d||g?{n:null,pos:t}:{n:I,pos:t}}function ot(e,t,a,r,n,d){const m=e.charCodeAt(t);let u;if(m===123){if(++t,{code:u,pos:t}=ae(e,t,a,r,e.indexOf("}",t)-t,!0,n,d),++t,u!==null&&u>1114111)return{code:null,pos:t}}else({code:u,pos:t}=ae(e,t,a,r,4,!1,n,d));return{code:u,pos:t}}function st(e,t){const a=Object.keys(t);for(const r of a)if(e[r]!==t[r])return!1;return!0}function lt(e,t){return e===t?!0:e==null||Y[t]?!1:!!C[t]?.includes(e)}function ut(e,t){return!!(e===t||_[e]?.includes(t))}function A(e,t,a){return t?lt(t.type,e)?a===void 0?!0:st(t,a):!a&&t.type==="Placeholder"&&e in C?ut(t.expectedNode,e):!1:!1}function dt(e,t=!0){return typeof e!="string"||t&&(he(e)||et(e,!0))?!1:He(e)}const Ie=["||","&&","??"],pt=["++","--"],ct=[">","<",">=","<="],ft=["==","===","!=","!=="],mt=[...ft,"in","instanceof"],yt=[...mt,...ct],Ae=["-","/","%","*","**","&","|",">>",">>>","<<","^"],be=["+",...Ae,...yt,"|>"],ve=["=","+=",...Ae.map(e=>e+"="),...Ie.map(e=>e+"=")],bt=["delete","!"],vt=["+","-","~"],Tt=["typeof"],St=["void","throw",...bt,...vt,...Tt],we={},Y={},C={},ne={},De={},Fe={},Q={},ke={};function K(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function P(e,...t){return Object.assign(e,...t)}function w(e){return{validate:e}}function o(...e){return w(i(...e))}function E(e){return{validate:e,optional:!0}}function k(e,t){return{validate:e,default:t,optional:!1}}function b(...e){return{validate:i(...e),optional:!0}}function H(e){return h(l("array"),M(e))}function S(...e){return H(i(...e))}function v(...e){return w(S(...e))}function M(e){const t=$;function a(r,n,d){if(!Array.isArray(d))return;let m=0;const u={toString(){return`${n}[${m}]`}};for(;m<d.length;m++){const y=d[m];e(r,u,y),t(r,u,y)}}return a.each=e,a}function T(...e){function t(a,r,n){if(!e.includes(n))throw new TypeError(`Property ${r} expected value to be one of ${JSON.stringify(e)} but got ${JSON.stringify(n)}`)}return t.oneOf=e,t}const oe=[];function i(...e){const t=new Set;oe.push({types:e,set:t});function a(r,n,d){const m=d?.type;if(m!=null){if(t.has(m)){$(r,n,d);return}if(m==="Placeholder"){for(const u of e)if(A(u,d)){$(r,n,d);return}}}throw new TypeError(`Property ${n} of ${r.type} expected node to be of a type ${JSON.stringify(e)} but instead got ${JSON.stringify(m)}`)}return a.oneOfNodeTypes=e,a}function G(...e){function t(a,r,n){const d=K(n);for(const m of e)if(d===m||A(m,n)){$(a,r,n);return}throw new TypeError(`Property ${r} of ${a.type} expected node to be of a type ${JSON.stringify(e)} but instead got ${JSON.stringify(n?.type)}`)}return t.oneOfNodeOrValueTypes=e,t}function l(e){function t(a,r,n){if(K(n)!==e)throw new TypeError(`Property ${r} expected type of ${e} but got ${K(n)}`)}return t.type=e,t}function Ne(e){const t=Object.keys(e);function a(r,n,d){const m=[];for(const u of t)try{ce(r,u,d[u],e[u])}catch(y){if(y instanceof TypeError){m.push(y.message);continue}throw y}if(m.length)throw new TypeError(`Property ${n} of ${r.type} expected to have the following:
|
|
4
|
+
${m.join(`
|
|
5
|
+
`)}`)}return a.shapeOf=e,a}function se(){function e(t){let a=t;for(;t;){const{type:r}=a;if(r==="OptionalCallExpression"){if(a.optional)return;a=a.callee;continue}if(r==="OptionalMemberExpression"){if(a.optional)return;a=a.object;continue}break}throw new TypeError(`Non-optional ${t.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${a?.type}`)}return e}function h(...e){function t(...a){for(const r of e)r(...a)}if(t.chainOf=e,e.length>=2&&"type"in e[0]&&e[0].type==="array"&&!("each"in e[1]))throw new Error('An assertValueType("array") validator can only be followed by an assertEach(...) validator.');return t}const Et=new Set(["aliases","builder","deprecatedAlias","fields","inherits","visitor","validate","unionShape"]),xt=new Set(["default","optional","deprecated","validate"]),ie={};function j(...e){return(t,a={})=>{let r=a.aliases;r||(a.inherits&&(r=ie[a.inherits].aliases?.slice()),r??=[],a.aliases=r);const n=e.filter(d=>!r.includes(d));r.unshift(...n),N(t,a)}}function N(e,t={}){const a=t.inherits&&ie[t.inherits]||{},r=t.visitor||a.visitor||[],n=t.aliases||a.aliases||[],d=t.builder||a.builder||t.visitor||[];let m=t.fields;if(!m&&(m={},a.fields)){const u=Object.getOwnPropertyNames(a.fields);for(const y of u){const c=a.fields[y],x=c.default;if(Array.isArray(x)?x.length>0:x&&typeof x=="object")throw new Error("field defaults can only be primitives or empty arrays currently");m[y]={default:Array.isArray(x)?[]:x,optional:c.optional,deprecated:c.deprecated,validate:c.validate}}}for(const u of Object.keys(t))if(!Et.has(u))throw new Error(`Unknown type option "${u}" on ${e}`);t.deprecatedAlias&&(Fe[t.deprecatedAlias]=e);for(const u of r.concat(d))m[u]=m[u]||{};for(const u of Object.keys(m)){const y=m[u];y.default===null&&(y.optional??=!0),y.default===void 0?(y.default=null,y.optional??=!1):!y.validate&&y.default!=null&&(y.validate=l(K(y.default)));for(const c of Object.keys(y))if(!xt.has(c))throw new Error(`Unknown field key "${c}" on ${e}.${u}`)}we[e]=t.visitor=r,De[e]=t.builder=d,ne[e]=t.fields=m,Y[e]=t.aliases=n,n.forEach(u=>{C[u]=C[u]||[],C[u].push(e)}),t.validate&&(Q[e]=t.validate),t.unionShape&&(ke[e]=t.unionShape),ie[e]=t}const gt=Object.defineProperty({__proto__:null,ALIAS_KEYS:Y,BUILDER_KEYS:De,DEPRECATED_KEYS:Fe,FLIPPED_ALIAS_KEYS:C,NODE_FIELDS:ne,NODE_PARENT_VALIDATIONS:Q,NODE_UNION_SHAPES__PRIVATE:ke,VISITOR_KEYS:we,allExpandedTypes:oe,arrayOf:H,arrayOfType:S,assertEach:M,assertNodeOrValueType:G,assertNodeType:i,assertOneOf:T,assertOptionalChainStart:se,assertShape:Ne,assertValueType:l,chain:h,combine:P,default:N,defineAliasedType:j,validate:w,validateArrayOfType:v,validateDefault:k,validateOptional:E,validateOptionalType:b,validateType:o},Symbol.toStringTag,{value:"Module"}),J=(e=!1)=>({unionShape:{discriminator:"computed",shapes:[{name:"computed",value:[!0],properties:{key:{validate:i("Expression")}}},{name:"nonComputed",value:[!1],properties:{key:{validate:e?i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"):i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral")}}}]}}),Le={unionShape:{discriminator:"computed",shapes:[{name:"computed",value:[!0],properties:{property:{validate:i("Expression")}}},{name:"nonComputed",value:[!1],properties:{property:{validate:i("Identifier","PrivateName")}}}]}},s=j("Standardized");s("ArrayExpression",{fields:{elements:{validate:H(G("null","Expression","SpreadElement")),default:void 0}},visitor:["elements"],aliases:["Expression"]});s("AssignmentExpression",{fields:{operator:{validate:P((function(){const e=T(...ve),t=T("=");return function(a,r,n){(A("Pattern",a.left)?t:e)(a,r,n)}})(),{oneOf:ve})},left:{validate:i("Identifier","MemberExpression","OptionalMemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")},right:{validate:i("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]});s("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:T(...be)},left:{validate:(function(){const e=i("Expression"),t=i("Expression","PrivateName");return P(function(a,r,n){(a.operator==="in"?t:e)(a,r,n)},{oneOfNodeTypes:["Expression","PrivateName"]})})()},right:{validate:i("Expression")}},unionShape:{discriminator:"operator",shapes:[{name:"in",value:["in"],properties:{left:{validate:i("Expression","PrivateName")}}},{name:"notIn",value:be.filter(e=>e!=="in"),properties:{left:{validate:i("Expression")}}}]},visitor:["left","right"],aliases:["Binary","Expression"]});s("InterpreterDirective",{builder:["value"],fields:{value:{validate:l("string")}}});s("Directive",{visitor:["value"],fields:{value:{validate:i("DirectiveLiteral")}}});s("DirectiveLiteral",{builder:["value"],fields:{value:{validate:l("string")}}});s("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:S("Directive"),default:[]},body:v("Statement")},aliases:["Scopable","BlockParent","Block","Statement"]});s("BreakStatement",{visitor:["label"],fields:{label:{validate:i("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]});s("CallExpression",{visitor:["callee","typeArguments","arguments"],builder:["callee","arguments"],aliases:["Expression"],fields:{callee:{validate:i("Expression","Super","Import","V8IntrinsicIdentifier")},arguments:v("Expression","SpreadElement","ArgumentPlaceholder"),typeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}});s("CatchClause",{visitor:["param","body"],fields:{param:{validate:i("Identifier","ArrayPattern","ObjectPattern"),optional:!0},body:{validate:i("BlockStatement")}},aliases:["Scopable","BlockParent"]});s("ConditionalExpression",{visitor:["test","consequent","alternate"],fields:{test:{validate:i("Expression")},consequent:{validate:i("Expression")},alternate:{validate:i("Expression")}},aliases:["Expression","Conditional"]});s("ContinueStatement",{visitor:["label"],fields:{label:{validate:i("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]});s("DebuggerStatement",{aliases:["Statement"]});s("DoWhileStatement",{builder:["test","body"],visitor:["body","test"],fields:{test:{validate:i("Expression")},body:{validate:i("Statement")}},aliases:["Statement","BlockParent","Loop","While","Scopable"]});s("EmptyStatement",{aliases:["Statement"]});s("ExpressionStatement",{visitor:["expression"],fields:{expression:{validate:i("Expression")}},aliases:["Statement","ExpressionWrapper"]});s("File",{builder:["program","comments","tokens"],visitor:["program"],fields:{program:{validate:i("Program")},comments:{validate:M(i("CommentBlock","CommentLine")),optional:!0},tokens:{validate:M(Object.assign(()=>{},{type:"any"})),optional:!0}}});s("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:i("VariableDeclaration","Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")},right:{validate:i("Expression")},body:{validate:i("Statement")}}});s("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"],fields:{init:{validate:i("VariableDeclaration","Expression"),optional:!0},test:{validate:i("Expression"),optional:!0},update:{validate:i("Expression"),optional:!0},body:{validate:i("Statement")}}});const R=()=>({params:v("FunctionParameter"),generator:{default:!1},async:{default:!1}}),X=()=>({returnType:{validate:i("TypeAnnotation","TSTypeAnnotation"),optional:!0},typeParameters:{validate:i("TypeParameterDeclaration","TSTypeParameterDeclaration"),optional:!0}}),Oe=()=>({...R(),declare:{validate:l("boolean"),optional:!0},id:{validate:i("Identifier"),optional:!0}});s("FunctionDeclaration",{builder:["id","params","body","generator","async"],visitor:["id","typeParameters","params","predicate","returnType","body"],fields:{...Oe(),...X(),body:{validate:i("BlockStatement")},predicate:{validate:i("FlowPredicate"),optional:!0}},aliases:["Scopable","Function","BlockParent","FunctionParent","Statement","Pureish","Declaration"],validate:(function(){const e=i("Identifier");return function(t,a,r){A("ExportDefaultDeclaration",t)||e(r,"id",r.id)}})()});s("FunctionExpression",{inherits:"FunctionDeclaration",aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{...R(),...X(),id:{validate:i("Identifier"),optional:!0},body:{validate:i("BlockStatement")},predicate:{validate:i("FlowPredicate"),optional:!0}}});const V=()=>({typeAnnotation:{validate:i("TypeAnnotation","TSTypeAnnotation"),optional:!0},optional:{validate:l("boolean"),optional:!0},decorators:{validate:S("Decorator"),optional:!0}});s("Identifier",{builder:["name"],visitor:["typeAnnotation","decorators"],aliases:["Expression","FunctionParameter","PatternLike","LVal","TSEntityName"],fields:{...V(),name:{validate:h(l("string"),P(function(e,t,a){if(!dt(a,!1))throw new TypeError(`"${a}" is not a valid identifier name`)},{type:"string"}))}},validate:function(e,t,a){const r=/\.(\w+)$/.exec(t.toString());if(!r)return;const[,n]=r,d={computed:!1};if(n==="property"){if(A("MemberExpression",e,d)||A("OptionalMemberExpression",e,d))return}else if(n==="key"){if(A("Property",e,d)||A("Method",e,d))return}else if(n==="exported"){if(A("ExportSpecifier",e))return}else if(n==="imported"){if(A("ImportSpecifier",e,{imported:a}))return}else if(n==="meta"&&A("MetaProperty",e,{meta:a}))return;if((he(a.name)||Pe(a.name,!1))&&a.name!=="this")throw new TypeError(`"${a.name}" is not a valid identifier`)}});s("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement","Conditional"],fields:{test:{validate:i("Expression")},consequent:{validate:i("Statement")},alternate:{optional:!0,validate:i("Statement")}}});s("LabeledStatement",{visitor:["label","body"],aliases:["Statement"],fields:{label:{validate:i("Identifier")},body:{validate:i("Statement")}}});s("StringLiteral",{builder:["value"],fields:{value:{validate:l("string")}},aliases:["Expression","Pureish","Literal","Immutable"]});s("NumericLiteral",{builder:["value"],deprecatedAlias:"NumberLiteral",fields:{value:{validate:h(l("number"),P(function(e,t,a){if(1/a<0||!Number.isFinite(a)){const r=new Error(`NumericLiterals must be non-negative finite numbers. You can use t.valueToNode(${a}) instead.`);if(!new Error().stack.includes("regenerator"))throw r}},{type:"number"}))}},aliases:["Expression","Pureish","Literal","Immutable"]});s("NullLiteral",{aliases:["Expression","Pureish","Literal","Immutable"]});s("BooleanLiteral",{builder:["value"],fields:{value:{validate:l("boolean")}},aliases:["Expression","Pureish","Literal","Immutable"]});s("RegExpLiteral",{builder:["pattern","flags"],deprecatedAlias:"RegexLiteral",aliases:["Expression","Pureish","Literal"],fields:{pattern:{validate:l("string")},flags:{validate:h(l("string"),P(function(e,t,a){const r=/[^dgimsuvy]/.exec(a);if(r)throw new TypeError(`"${r[0]}" is not a valid RegExp flag`)},{type:"string"})),default:""}}});s("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"],fields:{operator:{validate:T(...Ie)},left:{validate:i("Expression")},right:{validate:i("Expression")}}});s("MemberExpression",{builder:["object","property","computed"],visitor:["object","property"],aliases:["Expression","LVal","PatternLike"],...Le,fields:{object:{validate:i("Expression","Super")},property:{validate:(function(){const e=i("Identifier","PrivateName"),t=i("Expression");return P(function(a,r,n){(a.computed?t:e)(a,r,n)},{oneOfNodeTypes:["Expression","Identifier","PrivateName"]})})()},computed:{default:!1}}});s("NewExpression",{inherits:"CallExpression",fields:{callee:{validate:i("Expression")},arguments:v("Expression","SpreadElement","ArgumentPlaceholder"),typeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}});s("Program",{visitor:["directives","body"],builder:["body","directives","sourceType","interpreter"],fields:{sourceType:{validate:T("script","module"),default:"script"},interpreter:{validate:i("InterpreterDirective"),default:null,optional:!0},directives:{validate:S("Directive"),default:[]},body:v("Statement")},aliases:["Scopable","BlockParent","Block"]});s("ObjectExpression",{visitor:["properties"],aliases:["Expression"],fields:{properties:v("ObjectMethod","ObjectProperty","SpreadElement")}});s("ObjectMethod",{builder:["kind","key","params","body","computed","generator","async"],visitor:["decorators","key","typeParameters","params","returnType","body"],...J(),fields:{...R(),...X(),kind:{validate:T("method","get","set")},computed:{default:!1},key:{validate:(function(){const e=i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral"),t=i("Expression");return P(function(a,r,n){(a.computed?t:e)(a,r,n)},{oneOfNodeTypes:["Expression","Identifier","StringLiteral","NumericLiteral","BigIntLiteral"]})})()},decorators:{validate:S("Decorator"),optional:!0},body:{validate:i("BlockStatement")}},aliases:["UserWhitespacable","Function","Scopable","BlockParent","FunctionParent","Method","ObjectMember"]});s("ObjectProperty",{builder:["key","value","computed","shorthand"],...J(!0),fields:{computed:{default:!1},key:{validate:(function(){const e=i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"),t=i("Expression");return P(function(a,r,n){(a.computed?t:e)(a,r,n)},{oneOfNodeTypes:["Expression","Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"]})})()},value:{validate:i("Expression","PatternLike")},shorthand:{validate:h(l("boolean"),P(function(e,t,a){if(a){if(e.computed)throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");if(!A("Identifier",e.key))throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier")}},{type:"boolean"})),default:!1},decorators:{validate:S("Decorator"),optional:!0}},visitor:["decorators","key","value"],aliases:["UserWhitespacable","Property","ObjectMember"],validate:(function(){const e=i("Identifier","Pattern","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"),t=i("Expression");return function(a,r,n){(A("ObjectPattern",a)?e:t)(n,"value",n.value)}})()});s("RestElement",{visitor:["argument","typeAnnotation"],builder:["argument"],aliases:["FunctionParameter","PatternLike"],deprecatedAlias:"RestProperty",fields:{...V(),argument:{validate:i("Identifier","ArrayPattern","ObjectPattern","MemberExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")}},validate:function(e,t){const a=/(\w+)\[(\d+)\]/.exec(t.toString());if(!a)throw new Error("Internal Babel error: malformed key.");const[,r,n]=a;if(e[r].length>+n+1)throw new TypeError(`RestElement must be last element of ${r}`)}});s("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:i("Expression"),optional:!0}}});s("SequenceExpression",{visitor:["expressions"],fields:{expressions:v("Expression")},aliases:["Expression"]});s("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:i("Expression")}}});s("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:i("Expression"),optional:!0},consequent:v("Statement")}});s("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:i("Expression")},cases:v("SwitchCase")}});s("ThisExpression",{aliases:["Expression","TSEntityName"]});s("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:i("Expression")}}});s("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{block:{validate:h(i("BlockStatement"),P(function(e){if(!e.handler&&!e.finalizer)throw new TypeError("TryStatement expects either a handler or finalizer, or both")},{oneOfNodeTypes:["BlockStatement"]}))},handler:{optional:!0,validate:i("CatchClause")},finalizer:{optional:!0,validate:i("BlockStatement")}}});s("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:i("Expression")},operator:{validate:T(...St)}},visitor:["argument"],aliases:["UnaryLike","Expression"]});s("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:i("Identifier","MemberExpression")},operator:{validate:T(...pt)}},visitor:["argument"],aliases:["Expression"]});s("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{declare:{validate:l("boolean"),optional:!0},kind:{validate:T("var","let","const","using","await using")},declarations:v("VariableDeclarator")},validate:(()=>{const e=i("Identifier","Placeholder"),t=i("Identifier","ArrayPattern","ObjectPattern","Placeholder"),a=i("Identifier","VoidPattern","Placeholder");return function(r,n,d){const{kind:m,declarations:u}=d,y=A("ForXStatement",r,{left:d});if(y&&u.length!==1)throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${r.type}`);for(const c of u)m==="const"||m==="let"||m==="var"?!y&&!c.init?e(c,"id",c.id):t(c,"id",c.id):a(c,"id",c.id)}})()});s("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:i("Identifier","ArrayPattern","ObjectPattern","VoidPattern")},definite:{optional:!0,validate:l("boolean")},init:{optional:!0,validate:i("Expression")}}});s("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:i("Expression")},body:{validate:i("Statement")}}});s("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{validate:i("Expression")},body:{validate:i("Statement")}}});s("AssignmentPattern",{visitor:["left","right","decorators"],builder:["left","right"],aliases:["FunctionParameter","Pattern","PatternLike"],fields:{...V(),left:{validate:i("Identifier","ObjectPattern","ArrayPattern","MemberExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")},right:{validate:i("Expression")},decorators:{validate:S("Decorator"),optional:!0}}});s("ArrayPattern",{visitor:["elements","typeAnnotation"],builder:["elements"],aliases:["FunctionParameter","Pattern","PatternLike","LVal"],fields:{...V(),elements:{validate:h(l("array"),M(G("null","PatternLike")))}}});s("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["typeParameters","params","predicate","returnType","body"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{...R(),generator:{default:null,optional:!0,validate:P((e,t,a)=>{if(a)throw new TypeError("ArrowFunctionExpression cannot be a generator")},{type:"boolean"})},...X(),expression:{optional:!0,validate:l("boolean")},body:{validate:i("BlockStatement","Expression")},predicate:{validate:i("FlowPredicate"),optional:!0}}});s("ClassBody",{visitor:["body"],fields:{body:v("ClassMethod","ClassPrivateMethod","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","TSDeclareMethod","TSIndexSignature","StaticBlock")}});s("ClassExpression",{builder:["id","superClass","body","decorators"],visitor:["decorators","id","typeParameters","superClass","superTypeArguments","mixins","implements","body"],aliases:["Scopable","Class","Expression"],fields:{id:{validate:i("Identifier"),optional:!0},typeParameters:{validate:i("TypeParameterDeclaration","TSTypeParameterDeclaration"),optional:!0},body:{validate:i("ClassBody")},superClass:{optional:!0,validate:i("Expression")},superTypeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},implements:{validate:S("TSClassImplements","ClassImplements"),optional:!0},decorators:{validate:S("Decorator"),optional:!0},mixins:{validate:i("InterfaceExtends"),optional:!0}}});s("ClassDeclaration",{inherits:"ClassExpression",aliases:["Scopable","Class","Statement","Declaration"],fields:{id:{validate:i("Identifier"),optional:!0},typeParameters:{validate:i("TypeParameterDeclaration","TSTypeParameterDeclaration"),optional:!0},body:{validate:i("ClassBody")},superClass:{optional:!0,validate:i("Expression")},superTypeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},implements:{validate:S("TSClassImplements","ClassImplements"),optional:!0},decorators:{validate:S("Decorator"),optional:!0},mixins:{validate:i("InterfaceExtends"),optional:!0},declare:{validate:l("boolean"),optional:!0},abstract:{validate:l("boolean"),optional:!0}},validate:(function(){const e=i("Identifier");return function(t,a,r){A("ExportDefaultDeclaration",t)||e(r,"id",r.id)}})()});const U={attributes:{optional:!0,validate:S("ImportAttribute")}};s("ExportAllDeclaration",{visitor:["source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:{source:{validate:i("StringLiteral")},exportKind:E(T("type","value")),...U}});s("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:{declaration:o("FunctionDeclaration","ClassDeclaration","Expression","TSDeclareFunction","TSInterfaceDeclaration","EnumDeclaration"),exportKind:E(T("value"))}});s("ExportNamedDeclaration",{builder:["declaration","specifiers","source","attributes"],visitor:["declaration","specifiers","source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:{declaration:{optional:!0,validate:h(i("Declaration"),P(function(e,t,a){if(a&&e.specifiers.length)throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");if(a&&e.source)throw new TypeError("Cannot export a declaration from a source")},{oneOfNodeTypes:["VariableDeclaration","FunctionDeclaration","ClassDeclaration","TSDeclareFunction","TSEnumDeclaration","TSImportEqualsDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration","EnumDeclaration","InterfaceDeclaration","OpaqueType","TypeAlias"]}))},...U,specifiers:{default:[],validate:H((function(){const e=i("ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"),t=i("ExportSpecifier");return P(function(a,r,n){(a.source?e:t)(a,r,n)},{oneOfNodeTypes:["ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"]})})())},source:{validate:i("StringLiteral"),optional:!0},exportKind:E(T("type","value"))}});s("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:i("Identifier")},exported:{validate:i("Identifier","StringLiteral")},exportKind:{validate:T("type","value"),optional:!0}}});s("ForOfStatement",{visitor:["left","right","body"],builder:["left","right","body","await"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(function(){const e=i("VariableDeclaration"),t=i("Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression");return P(function(a,r,n){A("VariableDeclaration",n)?e(a,r,n):t(a,r,n)},{oneOfNodeTypes:["VariableDeclaration","Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]})})()},right:{validate:i("Expression")},body:{validate:i("Statement")},await:{default:!1}}});s("ImportDeclaration",{builder:["specifiers","source","attributes"],visitor:["specifiers","source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration"],fields:{...U,module:{optional:!0,validate:l("boolean")},phase:{default:null,validate:T("source","defer")},specifiers:v("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier"),source:{validate:i("StringLiteral")},importKind:{validate:T("type","typeof","value"),optional:!0}}});s("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:i("Identifier")}}});s("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:i("Identifier")}}});s("ImportSpecifier",{visitor:["imported","local"],builder:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:i("Identifier")},imported:{validate:i("Identifier","StringLiteral")},importKind:{validate:T("type","typeof","value"),optional:!0}}});s("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:h(i("Identifier"),P(function(e,t,a){let r;switch(a.name){case"function":r="sent";break;case"new":r="target";break;case"import":r="meta";break}if(!A("Identifier",e.property,{name:r}))throw new TypeError("Unrecognised MetaProperty")},{oneOfNodeTypes:["Identifier"]}))},property:{validate:i("Identifier")}}});const le=()=>({abstract:{validate:l("boolean"),default:!1,optional:!0},accessibility:{validate:T("public","private","protected"),optional:!0},static:{default:!1},override:{optional:!0,validate:l("boolean"),default:!1},computed:{default:!1},optional:{validate:l("boolean"),optional:!0},key:{validate:h((function(){const e=i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral"),t=i("Expression");return function(a,r,n){(a.computed?t:e)(a,r,n)}})(),i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression"))}}),ue=(e=!0)=>({...R(),...le(),params:v("FunctionParameter","TSParameterProperty"),kind:{validate:T("get","set","method","constructor"),default:"method"},access:{validate:h(l("string"),T("public","private","protected")),optional:!0},...e?{decorators:{validate:S("Decorator"),optional:!0}}:{}});s("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static","generator","async"],visitor:["decorators","key","typeParameters","params","returnType","body"],...J(),fields:{...ue(),...X(),body:{validate:i("BlockStatement")}}});s("ObjectPattern",{visitor:["decorators","properties","typeAnnotation"],builder:["properties"],aliases:["FunctionParameter","Pattern","PatternLike","LVal"],fields:{...V(),properties:v("RestElement","ObjectProperty")}});s("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],deprecatedAlias:"SpreadProperty",fields:{argument:{validate:i("Expression")}}});s("Super");s("TaggedTemplateExpression",{visitor:["tag","typeArguments","quasi"],builder:["tag","quasi"],aliases:["Expression"],fields:{tag:{validate:i("Expression")},quasi:{validate:i("TemplateLiteral")},typeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}});s("TemplateElement",{builder:["value","tail"],fields:{value:{validate:h(Ne({raw:{validate:l("string")},cooked:{validate:l("string"),optional:!0}}),function(e){const t=e.value.raw;let a=!1;const r=()=>{throw new Error("Internal @babel/types error.")},{str:n,firstInvalidLoc:d}=at("template",t,0,0,0,{unterminated(){a=!0},strictNumericEscape:r,invalidEscapeSequence:r,numericSeparatorInEscapeSequence:r,unexpectedNumericSeparator:r,invalidDigit:r,invalidCodePoint:r});if(!a)throw new Error("Invalid raw");e.value.cooked=d?null:n})},tail:{default:!1}}});s("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:v("TemplateElement"),expressions:{validate:h(l("array"),M(i("Expression","TSType")),function(e,t,a){if(e.quasis.length!==a.length+1)throw new TypeError(`Number of ${e.type} quasis should be exactly one more than the number of expressions.
|
|
6
|
+
Expected ${a.length+1} quasis but got ${e.quasis.length}`)})}}});s("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:h(l("boolean"),P(function(e,t,a){if(a&&!e.argument)throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument")},{type:"boolean"})),default:!1},argument:{optional:!0,validate:i("Expression")}}});s("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:i("Expression")}}});s("ImportExpression",{visitor:["source","options"],aliases:["Expression"],fields:{phase:{default:null,validate:T("source","defer")},source:{validate:i("Expression")},options:{validate:i("Expression"),optional:!0}}});s("Import");s("BigIntLiteral",{builder:["value"],fields:{value:{validate:l("bigint")}},aliases:["Expression","Pureish","Literal","Immutable"]});s("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:i("Identifier","StringLiteral")}}});s("OptionalMemberExpression",{builder:["object","property","computed","optional"],visitor:["object","property"],aliases:["Expression"],...Le,fields:{object:{validate:i("Expression")},property:{validate:(function(){const e=i("Identifier","PrivateName"),t=i("Expression");return P(function(a,r,n){(a.computed?t:e)(a,r,n)},{oneOfNodeTypes:["Expression","PrivateName"]})})()},computed:{default:!1},optional:{validate:h(l("boolean"),se())}}});s("OptionalCallExpression",{visitor:["callee","typeArguments","arguments"],builder:["callee","arguments","optional"],aliases:["Expression"],fields:{callee:{validate:i("Expression")},arguments:v("Expression","SpreadElement","ArgumentPlaceholder"),optional:{validate:h(l("boolean"),se())},typeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}});s("ClassProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property"],...J(),fields:{...le(),value:{validate:i("Expression"),optional:!0},definite:{validate:l("boolean"),optional:!0},typeAnnotation:{validate:i("TypeAnnotation","TSTypeAnnotation"),optional:!0},decorators:{validate:S("Decorator"),optional:!0},readonly:{validate:l("boolean"),optional:!0},declare:{validate:l("boolean"),optional:!0},variance:{validate:i("Variance"),optional:!0}}});s("ClassPrivateProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","decorators","static"],aliases:["Property","Private"],fields:{key:{validate:i("PrivateName")},value:{validate:i("Expression"),optional:!0},typeAnnotation:{validate:i("TypeAnnotation","TSTypeAnnotation"),optional:!0},decorators:{validate:S("Decorator"),optional:!0},static:{validate:l("boolean"),default:!1},readonly:{validate:l("boolean"),optional:!0},optional:{validate:l("boolean"),optional:!0},definite:{validate:l("boolean"),optional:!0},variance:{validate:i("Variance"),optional:!0}}});s("ClassPrivateMethod",{builder:["kind","key","params","body","static"],visitor:["decorators","key","typeParameters","params","returnType","body"],aliases:["Function","Scopable","BlockParent","FunctionParent","Method","Private"],fields:{...ue(),...X(),kind:{validate:T("get","set","method"),default:"method"},key:{validate:i("PrivateName")},body:{validate:i("BlockStatement")}}});s("PrivateName",{visitor:["id"],aliases:["Private"],fields:{id:{validate:i("Identifier")}}});s("StaticBlock",{visitor:["body"],fields:{body:v("Statement")},aliases:["Scopable","BlockParent","FunctionParent"]});s("ImportAttribute",{visitor:["key","value"],fields:{key:{validate:i("Identifier","StringLiteral")},value:{validate:i("StringLiteral")}}});const p=j("Flow"),de=e=>{const t=e==="DeclareClass";p(e,{builder:["id","typeParameters","extends","body"],visitor:["id","typeParameters","extends",...t?["mixins","implements"]:[],"body"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterDeclaration"),extends:E(S("InterfaceExtends")),...t?{mixins:E(S("InterfaceExtends")),implements:E(S("ClassImplements"))}:{},body:o("ObjectTypeAnnotation")}})};p("AnyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["FlowType"],fields:{elementType:o("FlowType")}});p("BooleanTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("BooleanLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:w(l("boolean"))}});p("NullLiteralTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("ClassImplements",{visitor:["id","typeParameters"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterInstantiation")}});de("DeclareClass");p("DeclareFunction",{builder:["id"],visitor:["id","predicate"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),predicate:b("FlowPredicate")}});de("DeclareInterface");p("DeclareModule",{builder:["id","body","kind"],visitor:["id","body"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier","StringLiteral"),body:o("BlockStatement"),kind:E(T("CommonJS","ES"))}});p("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{typeAnnotation:o("TypeAnnotation")}});p("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterDeclaration"),right:o("FlowType")}});p("DeclareOpaqueType",{visitor:["id","typeParameters","supertype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterDeclaration"),supertype:b("FlowType"),impltype:b("FlowType")}});p("DeclareVariable",{visitor:["id"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier")}});p("DeclareExportDeclaration",{visitor:["declaration","specifiers","source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{declaration:b("Flow"),specifiers:E(S("ExportSpecifier","ExportNamespaceSpecifier")),source:b("StringLiteral"),default:E(l("boolean")),...U}});p("DeclareExportAllDeclaration",{visitor:["source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{source:o("StringLiteral"),exportKind:E(T("type","value")),...U}});p("DeclaredPredicate",{visitor:["value"],aliases:["FlowPredicate"],fields:{value:o("Expression")}});p("ExistsTypeAnnotation",{aliases:["FlowType"]});p("FunctionTypeAnnotation",{builder:["typeParameters","params","rest","returnType"],visitor:["typeParameters","this","params","rest","returnType"],aliases:["FlowType"],fields:{typeParameters:b("TypeParameterDeclaration"),params:v("FunctionTypeParam"),rest:b("FunctionTypeParam"),this:b("FunctionTypeParam"),returnType:o("FlowType")}});p("FunctionTypeParam",{visitor:["name","typeAnnotation"],fields:{name:b("Identifier"),typeAnnotation:o("FlowType"),optional:E(l("boolean"))}});p("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["FlowType"],fields:{id:o("Identifier","QualifiedTypeIdentifier"),typeParameters:b("TypeParameterInstantiation")}});p("InferredPredicate",{aliases:["FlowPredicate"]});p("InterfaceExtends",{visitor:["id","typeParameters"],fields:{id:o("Identifier","QualifiedTypeIdentifier"),typeParameters:b("TypeParameterInstantiation")}});de("InterfaceDeclaration");p("InterfaceTypeAnnotation",{visitor:["extends","body"],aliases:["FlowType"],fields:{extends:E(S("InterfaceExtends")),body:o("ObjectTypeAnnotation")}});p("IntersectionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:w(S("FlowType"))}});p("MixedTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("EmptyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["FlowType"],fields:{typeAnnotation:o("FlowType")}});p("NumberLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:w(l("number"))}});p("BigIntLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:w(l("bigint"))}});p("NumberTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties","internalSlots"],aliases:["FlowType"],builder:["properties","indexers","callProperties","internalSlots","exact"],fields:{properties:w(S("ObjectTypeProperty","ObjectTypeSpreadProperty")),indexers:{validate:S("ObjectTypeIndexer"),optional:!1,default:[]},callProperties:{validate:S("ObjectTypeCallProperty"),optional:!1,default:[]},internalSlots:{validate:S("ObjectTypeInternalSlot"),optional:!1,default:[]},exact:{validate:l("boolean"),default:!1},inexact:E(l("boolean"))}});p("ObjectTypeInternalSlot",{visitor:["id","value"],builder:["id","value","optional","static","method"],aliases:["UserWhitespacable"],fields:{id:o("Identifier"),value:o("FlowType"),optional:w(l("boolean")),static:w(l("boolean")),method:w(l("boolean"))}});p("ObjectTypeCallProperty",{visitor:["value"],aliases:["UserWhitespacable"],fields:{value:o("FlowType"),static:k(l("boolean"),!1)}});p("ObjectTypeIndexer",{visitor:["variance","id","key","value"],builder:["id","key","value","variance"],aliases:["UserWhitespacable"],fields:{id:b("Identifier"),key:o("FlowType"),value:o("FlowType"),static:k(l("boolean"),!1),variance:b("Variance")}});p("ObjectTypeProperty",{visitor:["key","value","variance"],aliases:["UserWhitespacable"],fields:{key:o("Identifier","StringLiteral","NumericLiteral"),value:o("FlowType"),kind:{validate:T("init","get","set"),default:"init",optional:!1},static:k(l("boolean"),!1),proto:k(l("boolean"),!1),optional:k(l("boolean"),!1),variance:b("Variance"),method:k(l("boolean"),!1)}});p("ObjectTypeSpreadProperty",{visitor:["argument"],aliases:["UserWhitespacable"],fields:{argument:o("FlowType")}});p("OpaqueType",{visitor:["id","typeParameters","supertype","impltype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterDeclaration"),supertype:b("FlowType"),impltype:o("FlowType")}});p("QualifiedTypeIdentifier",{visitor:["qualification","id"],builder:["id","qualification"],fields:{id:o("Identifier"),qualification:o("Identifier","QualifiedTypeIdentifier")}});p("StringLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:w(l("string"))}});p("StringTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("SymbolTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("ThisTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("TupleTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:w(S("FlowType"))}});p("TypeofTypeAnnotation",{visitor:["argument"],aliases:["FlowType"],fields:{argument:o("FlowType")}});p("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:o("Identifier"),typeParameters:b("TypeParameterDeclaration"),right:o("FlowType")}});p("TypeAnnotation",{visitor:["typeAnnotation"],fields:{typeAnnotation:o("FlowType")}});p("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["ExpressionWrapper","Expression"],fields:{expression:o("Expression"),typeAnnotation:o("TypeAnnotation")}});p("TypeParameter",{builder:["name","bound","default","variance"],visitor:["bound","default","variance"],fields:{name:w(l("string")),bound:b("TypeAnnotation"),default:b("FlowType"),variance:b("Variance")}});p("TypeParameterDeclaration",{visitor:["params"],fields:{params:w(S("TypeParameter"))}});p("TypeParameterInstantiation",{visitor:["params"],fields:{params:w(S("FlowType"))}});p("UnionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:w(S("FlowType"))}});p("Variance",{builder:["kind"],fields:{kind:w(T("minus","plus"))}});p("VoidTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]});p("EnumDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:{id:o("Identifier"),body:o("EnumBooleanBody","EnumNumberBody","EnumStringBody","EnumSymbolBody")}});const pe={explicitType:k(l("boolean"),!1),hasUnknownMembers:k(l("boolean"),!1)};p("EnumBooleanBody",{aliases:["EnumBody"],visitor:["members"],fields:{...pe,members:v("EnumBooleanMember")}});p("EnumNumberBody",{aliases:["EnumBody"],visitor:["members"],fields:{...pe,members:v("EnumNumberMember")}});p("EnumStringBody",{aliases:["EnumBody"],visitor:["members"],fields:{...pe,members:v("EnumStringMember","EnumDefaultedMember")}});p("EnumSymbolBody",{aliases:["EnumBody"],visitor:["members"],fields:{members:v("EnumDefaultedMember"),hasUnknownMembers:k(l("boolean"),!1)}});p("EnumBooleanMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:o("Identifier"),init:o("BooleanLiteral")}});p("EnumNumberMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:o("Identifier"),init:o("NumericLiteral")}});p("EnumStringMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:o("Identifier"),init:o("StringLiteral")}});p("EnumDefaultedMember",{aliases:["EnumMember"],visitor:["id"],fields:{id:o("Identifier")}});p("IndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:o("FlowType"),indexType:o("FlowType")}});p("OptionalIndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:o("FlowType"),indexType:o("FlowType"),optional:k(l("boolean"),!1)}});const D=j("JSX");D("JSXAttribute",{visitor:["name","value"],aliases:["Immutable"],fields:{name:{validate:i("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:i("JSXElement","JSXFragment","StringLiteral","JSXExpressionContainer")}}});D("JSXClosingElement",{visitor:["name"],aliases:["Immutable"],fields:{name:{validate:i("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")}}});D("JSXElement",{builder:["openingElement","closingElement","children"],visitor:["openingElement","children","closingElement"],aliases:["Immutable","Expression"],fields:{openingElement:{validate:i("JSXOpeningElement")},closingElement:{optional:!0,validate:i("JSXClosingElement")},children:v("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")}});D("JSXEmptyExpression",{});D("JSXExpressionContainer",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:i("Expression","JSXEmptyExpression")}}});D("JSXSpreadChild",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:i("Expression")}}});D("JSXIdentifier",{builder:["name"],fields:{name:{validate:l("string")}}});D("JSXMemberExpression",{visitor:["object","property"],fields:{object:{validate:i("JSXMemberExpression","JSXIdentifier")},property:{validate:i("JSXIdentifier")}}});D("JSXNamespacedName",{visitor:["namespace","name"],fields:{namespace:{validate:i("JSXIdentifier")},name:{validate:i("JSXIdentifier")}}});D("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","typeArguments","attributes"],aliases:["Immutable"],fields:{name:{validate:i("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")},selfClosing:{default:!1},attributes:v("JSXAttribute","JSXSpreadAttribute"),typeArguments:{validate:i("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}});D("JSXSpreadAttribute",{visitor:["argument"],fields:{argument:{validate:i("Expression")}}});D("JSXText",{aliases:["Immutable"],builder:["value"],fields:{value:{validate:l("string")}}});D("JSXFragment",{builder:["openingFragment","closingFragment","children"],visitor:["openingFragment","children","closingFragment"],aliases:["Immutable","Expression"],fields:{openingFragment:{validate:i("JSXOpeningFragment")},closingFragment:{validate:i("JSXClosingFragment")},children:v("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")}});D("JSXOpeningFragment",{aliases:["Immutable"]});D("JSXClosingFragment",{aliases:["Immutable"]});const Ce=["Identifier","StringLiteral","Expression","Statement","Declaration","BlockStatement","ClassBody","Pattern"],_={Declaration:["Statement"],Pattern:["PatternLike","LVal"]};for(const e of Ce){const t=Y[e];t?.length&&(_[e]=t)}const ee={};Object.keys(_).forEach(e=>{_[e].forEach(t=>{Object.hasOwn(ee,t)||(ee[t]=[]),ee[t].push(e)})});const Be=j("Miscellaneous");Be("Placeholder",{visitor:[],builder:["expectedNode","name"],fields:{name:{validate:i("Identifier")},expectedNode:{validate:T(...Ce)},...V()}});Be("V8IntrinsicIdentifier",{builder:["name"],fields:{name:{validate:l("string")}}});N("ArgumentPlaceholder",{});N("BindExpression",{visitor:["object","callee"],aliases:["Expression"],fields:{object:{validate:G("null","Expression")},callee:{validate:i("Expression")}}});N("ClassAccessorProperty",{visitor:["decorators","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property","Accessor"],...J(!0),fields:{...le(),key:{validate:h((function(){const e=i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"),t=i("Expression");return function(a,r,n){(a.computed?t:e)(a,r,n)}})(),i("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression","PrivateName"))},value:{validate:i("Expression"),optional:!0},definite:{validate:l("boolean"),optional:!0},typeAnnotation:{validate:i("TypeAnnotation","TSTypeAnnotation"),optional:!0},decorators:{validate:S("Decorator"),optional:!0},readonly:{validate:l("boolean"),optional:!0},declare:{validate:l("boolean"),optional:!0},variance:{validate:i("Variance"),optional:!0}}});N("Decorator",{visitor:["expression"],fields:{expression:{validate:i("Expression")}}});N("DoExpression",{visitor:["body"],builder:["body","async"],aliases:["Expression"],fields:{body:{validate:i("BlockStatement")},async:{validate:l("boolean"),default:!1}}});N("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:i("Identifier")}}});N("ModuleExpression",{visitor:["body"],fields:{body:{validate:i("Program")}},aliases:["Expression"]});N("TopicReference",{aliases:["Expression"]});N("VoidPattern",{aliases:["Pattern","PatternLike","FunctionParameter"]});const f=j("TypeScript"),F=l("boolean"),Me=()=>({returnType:{validate:i("TSTypeAnnotation"),optional:!0},typeParameters:{validate:i("TSTypeParameterDeclaration"),optional:!0}});f("TSParameterProperty",{aliases:[],visitor:["parameter"],fields:{accessibility:{validate:T("public","private","protected"),optional:!0},readonly:{validate:l("boolean"),optional:!0},parameter:{validate:i("Identifier","AssignmentPattern")},override:{validate:l("boolean"),optional:!0},decorators:{validate:S("Decorator"),optional:!0}}});f("TSDeclareFunction",{aliases:["Statement","Declaration"],visitor:["id","typeParameters","params","returnType"],fields:{...Oe(),...Me()}});f("TSDeclareMethod",{visitor:["key","typeParameters","params","returnType"],...J(),fields:{...ue(!1),...Me()}});f("TSQualifiedName",{aliases:["TSEntityName"],visitor:["left","right"],fields:{left:o("TSEntityName"),right:o("Identifier")}});const Z=()=>({typeParameters:b("TSTypeParameterDeclaration"),params:v("ArrayPattern","Identifier","ObjectPattern","RestElement"),returnType:b("TSTypeAnnotation")}),$e={aliases:["TSTypeElement"],visitor:["typeParameters","params","returnType"],fields:Z()};f("TSCallSignatureDeclaration",$e);f("TSConstructSignatureDeclaration",$e);const je=()=>({key:o("Expression"),computed:{default:!1},optional:E(F)});f("TSPropertySignature",{aliases:["TSTypeElement"],visitor:["key","typeAnnotation"],fields:{...je(),readonly:E(F),typeAnnotation:b("TSTypeAnnotation"),kind:{optional:!0,validate:T("get","set")}}});f("TSMethodSignature",{aliases:["TSTypeElement"],visitor:["key","typeParameters","params","returnType"],fields:{...Z(),...je(),kind:{validate:T("method","get","set"),default:"method"}}});f("TSIndexSignature",{aliases:["TSTypeElement"],visitor:["parameters","typeAnnotation"],fields:{readonly:E(F),static:E(F),parameters:v("Identifier"),typeAnnotation:b("TSTypeAnnotation")}});const Pt=["TSAnyKeyword","TSBooleanKeyword","TSBigIntKeyword","TSIntrinsicKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword"];for(const e of Pt)f(e,{aliases:["TSType","TSBaseType"],visitor:[],fields:{}});f("TSThisType",{aliases:["TSType","TSBaseType"],visitor:[],fields:{}});const Je={aliases:["TSType"],visitor:["typeParameters","params","returnType"]};f("TSFunctionType",{...Je,fields:Z()});f("TSConstructorType",{...Je,fields:{...Z(),abstract:E(F)}});f("TSTypeReference",{aliases:["TSType"],visitor:["typeName","typeArguments"],fields:{typeName:o("TSEntityName"),typeArguments:b("TSTypeParameterInstantiation")}});f("TSTypePredicate",{aliases:["TSType"],visitor:["parameterName","typeAnnotation"],builder:["parameterName","typeAnnotation","asserts"],fields:{parameterName:o("Identifier","TSThisType"),typeAnnotation:b("TSTypeAnnotation"),asserts:E(F)}});f("TSTypeQuery",{aliases:["TSType"],visitor:["exprName","typeArguments"],fields:{exprName:o("TSEntityName","TSImportType"),typeArguments:b("TSTypeParameterInstantiation")}});f("TSTypeLiteral",{aliases:["TSType"],visitor:["members"],fields:{members:v("TSTypeElement")}});f("TSArrayType",{aliases:["TSType"],visitor:["elementType"],fields:{elementType:o("TSType")}});f("TSTupleType",{aliases:["TSType"],visitor:["elementTypes"],fields:{elementTypes:v("TSType","TSNamedTupleMember")}});f("TSOptionalType",{aliases:["TSType"],visitor:["typeAnnotation"],fields:{typeAnnotation:o("TSType")}});f("TSRestType",{aliases:["TSType"],visitor:["typeAnnotation"],fields:{typeAnnotation:o("TSType")}});f("TSNamedTupleMember",{visitor:["label","elementType"],builder:["label","elementType","optional"],fields:{label:o("Identifier"),optional:{validate:F,default:!1},elementType:o("TSType")}});const Xe={aliases:["TSType"],visitor:["types"],fields:{types:v("TSType")}};f("TSUnionType",Xe);f("TSIntersectionType",Xe);f("TSConditionalType",{aliases:["TSType"],visitor:["checkType","extendsType","trueType","falseType"],fields:{checkType:o("TSType"),extendsType:o("TSType"),trueType:o("TSType"),falseType:o("TSType")}});f("TSInferType",{aliases:["TSType"],visitor:["typeParameter"],fields:{typeParameter:o("TSTypeParameter")}});f("TSParenthesizedType",{aliases:["TSType"],visitor:["typeAnnotation"],fields:{typeAnnotation:o("TSType")}});f("TSTypeOperator",{aliases:["TSType"],visitor:["typeAnnotation"],builder:["typeAnnotation","operator"],fields:{operator:{validate:T("keyof","readonly","unique"),default:void 0},typeAnnotation:o("TSType")}});f("TSIndexedAccessType",{aliases:["TSType"],visitor:["objectType","indexType"],fields:{objectType:o("TSType"),indexType:o("TSType")}});f("TSMappedType",{aliases:["TSType"],visitor:["key","constraint","nameType","typeAnnotation"],builder:["key","constraint","nameType","typeAnnotation"],fields:{key:o("Identifier"),constraint:o("TSType"),readonly:E(T(!0,!1,"+","-")),optional:E(T(!0,!1,"+","-")),typeAnnotation:b("TSType"),nameType:b("TSType")}});f("TSTemplateLiteralType",{aliases:["TSType","TSBaseType"],visitor:["quasis","types"],fields:{quasis:v("TemplateElement"),types:{validate:h(l("array"),M(i("TSType")),function(e,t,a){if(e.quasis.length!==a.length+1)throw new TypeError(`Number of ${e.type} quasis should be exactly one more than the number of types.
|
|
7
|
+
Expected ${a.length+1} quasis but got ${e.quasis.length}`)})}}});f("TSLiteralType",{aliases:["TSType","TSBaseType"],visitor:["literal"],fields:{literal:{validate:(function(){const e=i("NumericLiteral","BigIntLiteral"),t=T("-"),a=i("NumericLiteral","StringLiteral","BooleanLiteral","BigIntLiteral","TemplateLiteral");return P(function(r,n,d){A("UnaryExpression",d)?(t(d,"operator",d.operator),e(d,"argument",d.argument)):a(r,n,d)},{oneOfNodeTypes:["NumericLiteral","StringLiteral","BooleanLiteral","BigIntLiteral","TemplateLiteral","UnaryExpression"]})})()}}});f("TSClassImplements",{aliases:["TSType"],visitor:["expression","typeArguments"],fields:{expression:o("Expression"),typeArguments:b("TSTypeParameterInstantiation")}});f("TSInterfaceHeritage",{aliases:["TSType"],visitor:["expression","typeArguments"],fields:{expression:o("Expression"),typeArguments:b("TSTypeParameterInstantiation")}});f("TSInterfaceDeclaration",{aliases:["Statement","Declaration"],visitor:["id","typeParameters","extends","body"],fields:{declare:E(F),id:o("Identifier"),typeParameters:b("TSTypeParameterDeclaration"),extends:E(S("TSInterfaceHeritage")),body:o("TSInterfaceBody")}});f("TSInterfaceBody",{visitor:["body"],fields:{body:v("TSTypeElement")}});f("TSTypeAliasDeclaration",{aliases:["Statement","Declaration"],visitor:["id","typeParameters","typeAnnotation"],fields:{declare:E(F),id:o("Identifier"),typeParameters:b("TSTypeParameterDeclaration"),typeAnnotation:o("TSType")}});f("TSInstantiationExpression",{aliases:["Expression"],visitor:["expression","typeArguments"],fields:{expression:o("Expression"),typeArguments:b("TSTypeParameterInstantiation")}});const Ve={aliases:["Expression","LVal","PatternLike"],visitor:["expression","typeAnnotation"],fields:{expression:o("Expression"),typeAnnotation:o("TSType")}};f("TSAsExpression",Ve);f("TSSatisfiesExpression",Ve);f("TSTypeAssertion",{aliases:["Expression","LVal","PatternLike"],visitor:["typeAnnotation","expression"],fields:{typeAnnotation:o("TSType"),expression:o("Expression")}});f("TSEnumBody",{visitor:["members"],fields:{members:v("TSEnumMember")}});f("TSEnumDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:{declare:E(F),const:E(F),id:o("Identifier"),body:o("TSEnumBody")}});f("TSEnumMember",{visitor:["id","initializer"],fields:{id:o("Identifier","StringLiteral"),initializer:b("Expression")}});f("TSModuleDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:{kind:{validate:T("global","namespace","module"),default:"namespace"},declare:E(F),id:{validate:h(i("TSEntityName","StringLiteral"),P(function(e,t,a){if(e.kind==="namespace"&&A("StringLiteral",a))throw new TypeError("TSModuleDeclaration of kind 'namespace' cannot have a StringLiteral id.")},{oneOfNodeTypes:["TSEntityName","StringLiteral"]}))},body:o("TSModuleBlock")}});f("TSModuleBlock",{aliases:["Scopable","Block","BlockParent","FunctionParent"],visitor:["body"],fields:{body:v("Statement")}});f("TSImportType",{aliases:["TSType"],builder:["source","qualifier","typeArguments"],visitor:["source","options","qualifier","typeArguments"],fields:{source:o("StringLiteral"),qualifier:b("TSEntityName"),typeArguments:b("TSTypeParameterInstantiation"),options:{validate:i("ObjectExpression"),optional:!0}}});f("TSImportEqualsDeclaration",{aliases:["Statement","Declaration"],visitor:["id","moduleReference"],fields:{id:o("Identifier"),moduleReference:o("TSEntityName","TSExternalModuleReference"),importKind:{validate:T("type","value"),optional:!0}}});f("TSExternalModuleReference",{visitor:["expression"],fields:{expression:o("StringLiteral")}});f("TSNonNullExpression",{aliases:["Expression","LVal","PatternLike"],visitor:["expression"],fields:{expression:o("Expression")}});f("TSExportAssignment",{aliases:["Statement"],visitor:["expression"],fields:{expression:o("Expression")}});f("TSNamespaceExportDeclaration",{aliases:["Statement"],visitor:["id"],fields:{id:o("Identifier")}});f("TSTypeAnnotation",{visitor:["typeAnnotation"],fields:{typeAnnotation:{validate:i("TSType")}}});f("TSTypeParameterInstantiation",{visitor:["params"],fields:{params:v("TSType")}});f("TSTypeParameterDeclaration",{visitor:["params"],fields:{params:v("TSTypeParameter")}});f("TSTypeParameter",{builder:["constraint","default","name"],visitor:["name","constraint","default"],fields:{name:{validate:i("Identifier")},in:{validate:l("boolean"),optional:!0},out:{validate:l("boolean"),optional:!0},const:{validate:l("boolean"),optional:!0},constraint:{validate:i("TSType"),optional:!0},default:{validate:i("TSType"),optional:!0}}});const Te={ModuleDeclaration:"ImportOrExportDeclaration"};Object.keys(Te).forEach(e=>{C[e]=C[Te[e]]});for(const{types:e,set:t}of oe)for(const a of e){const r=C[a];r?r.forEach(t.add,t):t.add(a)}function ht(e,t,a){if(!e)return;const r=ne[e.type];if(!r)return;const n=r[t];ce(e,t,a,n),$(e,t,a)}function It(e,t,a,r,n){if(e?.validate&&!(e.optional&&r==null)&&(e.validate(t,a,r),n)){const d=r.type;if(d==null)return;Q[d]?.(t,a,r)}}function ce(e,t,a,r){r?.validate&&(r.optional&&a==null||r.validate(e,t,a))}function $(e,t,a){const r=a?.type;r!=null&&Q[r]?.(e,t,a)}const At=Object.defineProperty({__proto__:null,default:ht,validateChild:$,validateField:ce,validateInternal:It},Symbol.toStringTag,{value:"Module"}),{validateInternal:W}=At,{NODE_FIELDS:fe}=gt;function wt(e){const t={type:"StringLiteral",value:e},a=fe.StringLiteral;return W(a.value,t,"value",e),t}function Dt(e,t=null){const a={type:"JSXAttribute",name:e,value:t},r=fe.JSXAttribute;return W(r.name,a,"name",e,1),W(r.value,a,"value",t,1),a}function Ft(e){const t={type:"JSXIdentifier",name:e},a=fe.JSXIdentifier;return W(a.name,t,"name",e),t}Function.call.bind(Object.prototype.toString);const kt=/[.+^${}()|[\]\\]/g,Nt=e=>e.replaceAll(kt,String.raw`\$&`),qe=e=>{const t=e.split("**").map(a=>a.split("*").map(r=>Nt(r)).join("[^/]*")).join(".*");return new RegExp(`^${t}$`)},Lt=(e,t)=>e.some(a=>a instanceof RegExp?a.test(t):qe(a).test(t)),Ot=e=>{const t=e.map(a=>a instanceof RegExp?a:qe(a));return a=>t.some(r=>r.test(a))},Re=ye.default??ye,Ct=me.default??me,Se="data-vdt-source",Bt=e=>{let t;const a=e.params[0];if(a)return a.type==="Identifier"&&(t=a.name),a.type==="ObjectPattern"&&a.properties.forEach(r=>{r.type==="RestElement"&&r.argument.type==="Identifier"&&(t=r.argument.name)}),t},z=e=>e.type==="JSXIdentifier"?e.name:e.type==="JSXMemberExpression"?`${z(e.object)}.${z(e.property)}`:`${e.namespace.name}:${e.name.name}`,Mt=e=>{const t=new Map,a=new Map;try{const r=Ee(e,{plugins:["jsx","typescript"],sourceType:"module"});Re(r,{JSXOpeningElement(n){const d=z(n.node.name),m=a.get(d)??0;a.set(d,m+1),n.node.loc&&t.set(`${d}:${m}`,{col:n.node.loc.start.column,line:n.node.loc.start.line})}})}catch{}return t},$t=(e,t,a,r,n,d)=>{const{loc:m}=e.node;if(!m)return!1;const u=z(e.node.name);let y;if(n&&d){const I=d.get(u)??0;d.set(u,I+1),y=n.get(`${u}:${I}`)}if(u==="Fragment"||u==="React.Fragment"||u==="html"||u==="head"||u==="body"||r(u))return!1;const c=e.node.attributes.some(I=>I.type==="JSXAttribute"&&I.name.type==="JSXIdentifier"&&I.name.name===Se);if(e.node.attributes.some(I=>I.type==="JSXSpreadAttribute"&&I.argument.type==="Identifier"&&I.argument.name===t)||c)return!1;const x=y?.line??m.start.line,g=y?.col??m.start.column;return e.node.attributes.push(Dt(Ft(Se),wt(`${a}:${x}:${g+1}`))),!0},jt=(e,t,a,r)=>{let n=!1;const d=r?new Map:void 0,m=Ot(a),u=c=>x=>{$t(x,c,t,m,r,d)&&(n=!0)},y=c=>{const x=Bt(c.node);c.traverse({ArrowFunctionExpression(g){y(g),g.skip()},FunctionDeclaration(g){y(g),g.skip()},FunctionExpression(g){y(g),g.skip()},JSXOpeningElement:u(x)})};return Re(e,{ArrowFunctionExpression(c){y(c),c.skip()},FunctionDeclaration(c){y(c),c.skip()},FunctionExpression(c){y(c),c.skip()}}),n},Rt=(e,t,a={},r)=>{const[n]=t.split("?"),d=n.replace(`${Ue(process.cwd())}/`,"");if(!Lt(a.files??[],d))try{const m=Ee(e,{plugins:["jsx","typescript"],sourceType:"module"}),u=r&&r!==e?Mt(r):void 0;return jt(m,d,a.components??[],u)?Ct(m,{filename:t,retainLines:!0,sourceFileName:n,sourceMaps:!0}):void 0}catch{return}};export{Se as SOURCE_ATTR,Rt as addSourceToJsx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{clsx as s}from"./clsx-CtZWcPHt.js";import{jsx as l}from"preact/jsx-runtime";const n={default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive",info:"border-info/50 text-info",success:"border-success/50 text-success",warning:"border-warning/50 text-warning"},d=({children:e,class:r,variant:t="default",...i})=>l("div",{class:s("relative w-full rounded-none border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",n[t],r),role:"alert",...i,children:e}),o=({children:e,class:r,...t})=>l("h5",{class:s("mb-1 font-medium leading-none tracking-tight",r),...t,children:e}),g=({children:e,class:r,...t})=>l("div",{class:s("text-sm [&_p]:leading-relaxed",r),...t,children:e});export{d as Alert,g as AlertDescription,o as AlertTitle};
|