import{j as i,r as S,t as Fe,v as wr,w as gi}from"./index-DSo1AH_7.js";function rn({steps:e,currentStepIndex:t,onStepClick:n}){return i.jsxs("div",{className:"relative w-full",children:[i.jsx("div",{className:"absolute top-5 left-0 right-0 h-1 bg-gray-300 mr-9 ml-9",children:i.jsx("div",{className:"h-full bg-solace-green transition-all duration-300 ease-in-out",style:{width:t===0?"0%":`${t/(e.length-1)*100}%`}})}),i.jsx("div",{className:"flex items-center justify-between w-full relative z-10",children:e.map((r,s)=>{const l=s===t,o=s<t;return i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsx("button",{onClick:()=>n==null?void 0:n(s),disabled:!n,className:`
                  w-10 h-10 rounded-full flex items-center justify-center
                  font-bold transition-colors duration-300
                  ${l?"bg-solace-green text-white":""}
                  ${o?"bg-solace-dark-green text-white":""}
                  ${!l&&!o?"bg-gray-200 text-gray-600":""}
                  ${n?"cursor-pointer":"cursor-default"}
                `,children:o?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):s+1}),i.jsx("span",{className:`
                  mt-2 text-xs font-medium text-center
                  ${l?"text-solace-green":""}
                  ${o?"text-solace-dark-green":""}
                  ${!l&&!o?"text-gray-500":""}
                `,children:r.title})]},r.id)})})]})}function J({children:e,onClick:t,disabled:n=!1,variant:r="primary",type:s="button",className:l=""}){const o="py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",a={primary:"bg-solace-green hover:bg-solace-dark-green text-white focus:ring-solace-green disabled:bg-solace-green/50",secondary:"bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500 disabled:bg-gray-100 disabled:text-gray-400",outline:"border border-gray-300 hover:bg-gray-50 text-gray-700 focus:ring-solace-green disabled:text-gray-400"};return i.jsx("button",{type:s,className:`${o} ${a[r]} ${l}`,onClick:t,disabled:n,children:e})}const kr=()=>i.jsx("svg",{className:"w-4 h-4 mr-1.5 text-green-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),jr={quick:{title:"Get Started Quickly",timeEstimate:"2 minutes",timeColor:"green",description:"Simple setup with recommended defaults",features:["Connect AI provider","Uses sensible defaults for everything else"]},advanced:{title:"Advanced Setup",timeEstimate:"10 minutes",timeColor:"blue",description:"Full control over all configuration options",features:["Set namespace for topic prefixes","Specify broker settings","Connect AI provider","Configure main orchestrator","Configure Web UI Gateway"]}},xi=["Ready-to-use Solace Agent Mesh with basic capabilities","Chat interface for immediate testing","Foundation for adding more agents later"],yi=({pathType:e,isSelected:t,onSelect:n})=>{const r=jr[e];return i.jsxs("div",{role:"button",tabIndex:0,className:`
        border rounded-lg p-6 cursor-pointer transition-all
        ${t?"border-solace-blue bg-solace-light-blue/10 shadow-md":"border-gray-200 hover:border-solace-blue/50 hover:bg-gray-50"}
      `,onClick:n,onKeyDown:s=>s.key==="Enter"&&n(),children:[i.jsxs("div",{className:"flex justify-between items-start mb-4",children:[i.jsx("h3",{className:"text-xl font-bold text-solace-blue",children:r.title}),i.jsx("span",{className:`bg-${r.timeColor}-100 text-${r.timeColor}-800 text-xs font-medium px-2.5 py-0.5 rounded`,children:r.timeEstimate})]}),i.jsx("p",{className:"text-gray-600 mb-4",children:r.description}),i.jsx("div",{children:i.jsx("ul",{className:"space-y-2 text-sm text-gray-600",children:r.features.map(s=>i.jsxs("li",{className:"flex items-center",children:[i.jsx(kr,{}),s]},s))})})]})};function bi({data:e,updateData:t,onNext:n}){const[r,s]=S.useState(e.setupPath??null),l=a=>{s(a),t({setupPath:a})},o=()=>{r&&n()};return i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:Object.keys(jr).map(a=>i.jsx(yi,{pathType:a,isSelected:r===a,onSelect:()=>l(a)},a))}),i.jsxs("div",{className:"mt-6 p-4 border rounded-lg",children:[i.jsx("h3",{className:"text-lg font-semibold text-solace-blue mb-3",children:"What you'll get after setup:"}),i.jsx("ul",{className:"space-y-2 text-gray-700",children:xi.map(a=>i.jsxs("li",{className:"flex items-center",children:[i.jsx(kr,{}),a]},a))})]}),i.jsx("div",{className:"mt-8 flex justify-end",children:i.jsx(J,{onClick:o,disabled:!r,children:"Continue"})})]})}function M({label:e,htmlFor:t,helpText:n,error:r,required:s=!1,children:l}){return i.jsxs("div",{className:"mb-4",children:[i.jsxs("label",{htmlFor:t,className:"block text-sm font-medium text-gray-700 mb-1",children:[e,s&&i.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),i.jsx("div",{className:"mt-1",children:l}),n&&i.jsx("p",{className:"mt-1 text-sm text-gray-500",children:n}),r&&i.jsx("p",{className:"mt-1 text-sm text-red-600",children:r})]})}function Y({id:e,name:t,value:n,onChange:r,placeholder:s="",required:l=!1,disabled:o=!1,type:a="text",className:d="",onKeyDown:c}){return i.jsx("input",{id:e,name:t||e,type:a,value:n,onChange:r,onKeyDown:c,placeholder:s,required:l,disabled:o,className:`
        w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm 
        focus:outline-none focus:ring-blue-500 focus:border-blue-500
        disabled:bg-gray-100 disabled:text-gray-500
        ${d}
      `})}function Ce({children:e,className:t=""}){return i.jsx("div",{className:`p-4 bg-blue-50 rounded-md ${t}`,children:i.jsx("p",{className:"text-sm text-blue-800",children:e})})}function Sr({children:e,className:t=""}){return i.jsx("div",{className:`p-4 bg-yellow-50 rounded-md ${t}`,children:i.jsx("p",{className:"text-sm text-yellow-800",children:e})})}function _i({children:e,variant:t="info",className:n=""}){const r={info:"bg-blue-50 text-blue-800",success:"bg-green-50 text-green-800",error:"bg-red-50 text-red-800",loading:"bg-blue-50 text-blue-800"};return i.jsx("div",{className:`p-3 rounded-md ${r[t]} ${n}`,children:i.jsx("p",{className:"text-sm",children:e})})}function vi({data:e,updateData:t,onNext:n,onPrevious:r}){var o;const s=a=>{t({[a.target.name]:a.target.value})},l=a=>{a.preventDefault(),n()};return i.jsxs("form",{onSubmit:l,children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx(Ce,{className:"mb-4",children:"The namespace is a unique identifier that will be prefixed to all your event topics in the Solace Agent Mesh. Choose something meaningful to your organization or project."}),i.jsx(M,{label:"Project Namespace",htmlFor:"namespace",helpText:"Any simple text identifier that makes sense for your project (e.g., 'my-project', 'acme-corp')",required:!0,children:i.jsx(Y,{id:"namespace",name:"namespace",value:e.namespace,onChange:s,placeholder:"Enter a namespace (e.g., my-project)",required:!0})})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:r,variant:"outline",disabled:!0,children:"Previous"}),i.jsx(J,{type:"submit",disabled:!((o=e.namespace)!=null&&o.trim()),children:"Next"})]})]})}function re({id:e,options:t,value:n,onChange:r,name:s,required:l=!1,disabled:o=!1,className:a=""}){return i.jsxs("div",{className:"relative",children:[i.jsx("select",{id:e,name:s||e,value:n,onChange:r,required:l,disabled:o,className:`
          w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm 
          focus:outline-none focus:ring-blue-500 focus:border-blue-500 
          disabled:bg-gray-100 disabled:text-gray-500
          appearance-none
          pr-10
          ${a}
        `,children:t.map(d=>i.jsx("option",{value:d.value,children:d.label},d.value))}),i.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2",children:i.jsx("svg",{className:"h-6 w-6 text-gray-500",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:i.jsx("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})}const wi=[{value:"solace",label:"Existing Solace Pub/Sub+ broker"},{value:"container",label:"New local Solace PubSub+ broker container"},{value:"dev_mode",label:"Dev mode (simplified setup)"}],ki=[{value:"podman",label:"Podman"},{value:"docker",label:"Docker"}],bn=({message:e})=>{const t=/(https?:\/\/[^\s]+)/g,n=e.split(t);return i.jsx("span",{children:n.map((r,s)=>r.match(t)?i.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline",children:r},s):r)})};function ji({data:e,updateData:t,onNext:n,onPrevious:r}){const[s,l]=S.useState({}),[o,a]=S.useState(!1),[d,c]=S.useState({isRunning:!1,success:e.container_started===!0,message:e.container_started?"Container already started successfully":""});S.useEffect(()=>{!e.container_engine&&e.broker_type==="container"&&t({container_engine:"podman"}),e.container_engine&&e.broker_type!=="container"&&t({container_engine:""}),e.broker_type!=="dev_mode"?t({dev_mode:!1}):e.broker_type==="dev_mode"&&t({dev_mode:!0})},[e.broker_type]);const u=N=>{t({[N.target.name]:N.target.value})},m=()=>{const N={};let T=!0;return _==="solace"&&(e.broker_url||(N.broker_url="Broker URL is required",T=!1),e.broker_vpn||(N.broker_vpn="VPN name is required",T=!1),e.broker_username||(N.broker_username="Username is required",T=!1)),_==="container"&&!d.success&&(N.container="You must successfully run the container before proceeding",T=!1),l(N),T},h=async()=>{a(!0),c({isRunning:!0,success:!1,message:"Starting container..."});try{const T=await(await fetch("api/runcontainer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({container_engine:e.container_engine})})).json();if(T.status==="success")c({isRunning:!1,success:!0,message:T.message??"Container started successfully!"}),t({container_engine:e.container_engine,container_started:!0});else{const D=T.message??"Failed to start container. Please try again.";c({isRunning:!1,success:!1,message:i.jsx(bn,{message:D})}),t({container_started:!1})}}catch(N){const T=N instanceof Error?N.message:"An unexpected error occurred";c({isRunning:!1,success:!1,message:i.jsx(bn,{message:T})}),t({container_started:!1})}finally{a(!1)}},p=N=>{N.preventDefault(),m()&&(_==="container"&&(e.broker_url="ws://localhost:8008",e.broker_vpn="default",e.broker_username="default",e.broker_password="default"),n())},_=e.broker_type,w=_==="solace",C=_==="container",f=()=>d.isRunning?"loading":d.success?"success":"error",v=()=>o?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Starting Container..."]}):d.success?i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Container Running"]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download and Run Container"]});return i.jsxs("form",{onSubmit:p,children:[i.jsxs("div",{className:"space-y-6",children:[i.jsx(M,{label:"Broker Type",htmlFor:"broker_type",required:!0,children:i.jsx(re,{id:"broker_type",name:"broker_type",options:wi,value:_,onChange:u,disabled:d.success&&e.broker_type==="container"})}),w&&i.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[i.jsx(Ce,{className:"mb-4",children:"Connect to an existing Solace PubSub+ broker running locally or in the cloud. You will need your broker credentials."}),i.jsx(M,{label:"Broker URL",htmlFor:"broker_url",error:s.broker_url,required:!0,children:i.jsx(Y,{id:"broker_url",name:"broker_url",value:e.broker_url||"",onChange:u,placeholder:"ws://localhost:8008"})}),i.jsx(M,{label:"VPN Name",htmlFor:"broker_vpn",error:s.broker_vpn,required:!0,children:i.jsx(Y,{id:"broker_vpn",name:"broker_vpn",value:e.broker_vpn||"",onChange:u,placeholder:"default"})}),i.jsx(M,{label:"Username",htmlFor:"broker_username",error:s.broker_username,required:!0,children:i.jsx(Y,{id:"broker_username",name:"broker_username",value:e.broker_username||"",onChange:u,placeholder:"default"})}),i.jsx(M,{label:"Password",htmlFor:"broker_password",error:s.broker_password,children:i.jsx(Y,{id:"broker_password",name:"broker_password",type:"password",value:e.broker_password||"",onChange:u,placeholder:"Enter password"})})]}),C&&i.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md",children:[i.jsx(Ce,{className:"mb-4",children:"This option will download and run a local Solace PubSub+ broker container on your machine using Docker or Podman. You need to have Docker or Podman installed on your system."}),i.jsx(M,{label:"Container Engine",htmlFor:"container_engine",helpText:"Select the container engine installed on your system",required:!0,children:i.jsx(re,{id:"container_engine",name:"container_engine",options:ki,value:e.container_engine??"",onChange:u,disabled:d.isRunning||d.success})}),s.container&&i.jsx("div",{className:"text-sm text-red-600 mt-1 bg-red-50 p-2 border-l-4 border-red-500",children:s.container}),d.message&&i.jsx(_i,{variant:f(),children:d.message}),i.jsx("div",{className:"relative",children:i.jsxs("div",{className:"flex flex-col",children:[i.jsx(J,{onClick:h,disabled:o||d.success,variant:"primary",type:"button",className:"flex items-center justify-center gap-2",children:v()}),d.success&&i.jsxs("div",{className:"mt-2 flex items-center text-sm text-green-600",children:[i.jsx("svg",{className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Container is running. You may proceed to the next step."]}),!d.success&&!o&&!d.message&&i.jsxs("div",{className:"mt-2 flex items-center text-sm text-blue-600",children:[i.jsxs("svg",{className:"h-4 w-4 mr-1",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"8"})]}),"You must start the container before proceeding to the next step"]})]})})]}),_==="dev_mode"&&i.jsxs(Sr,{children:[i.jsx("strong",{children:"Warning:"})," Dev mode runs everything in a single process and is not recommended for production use."]})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:r,variant:"outline",type:"button",children:"Previous"}),i.jsxs(J,{type:"submit",disabled:o||_==="container"&&!d.success,variant:_==="container"&&!d.success?"secondary":"primary",children:[_==="container"&&!d.success&&!o&&i.jsxs("span",{className:"flex items-center",children:[i.jsx("svg",{className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Run Container First"]}),!(_==="container"&&!d.success&&!o)&&"Next"]})]})]})}function Si({title:e="Confirmation Required",message:t,onConfirm:n,onCancel:r}){return i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:i.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:e}),i.jsx("p",{className:"mb-6 text-gray-700",children:t}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx(J,{variant:"outline",onClick:r,children:"Cancel"}),i.jsx(J,{onClick:n,children:"Continue"})]})]})})}function Nr({id:e,name:t,value:n,onChange:r,placeholder:s="",required:l=!1,disabled:o=!1,className:a="",suggestions:d,onFocus:c,fetchSuggestions:u,showLoadingIndicator:m=!1}){const[h,p]=S.useState(!1),[_,w]=S.useState([]),[C,f]=S.useState(!1),v=S.useRef(null),N=S.useRef(null);S.useEffect(()=>{if(d&&d.length>0){const j=d.filter(b=>b!=null).filter(b=>b.toLowerCase().includes((n||"").toLowerCase()));w(j)}else w([])},[n,d]),S.useEffect(()=>{const j=b=>{v.current&&!v.current.contains(b.target)&&N.current&&!N.current.contains(b.target)&&p(!1)};return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[]);const T=async()=>{if(c&&c(),u)try{f(!0);const j=await u();j&&j.length>0&&w(j)}catch(j){console.error("Error fetching suggestions:",j)}finally{f(!1)}},D=()=>{p(!0)},y=j=>{var I;r({target:{name:t||e,value:j}}),p(!1),(I=v.current)==null||I.focus()};return i.jsxs("div",{className:"relative w-full",children:[i.jsx("input",{ref:v,id:e,name:t||e,type:"text",value:n||"",onChange:r,onFocus:T,onClick:D,placeholder:s,required:l,disabled:o,className:`
          w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm
          focus:outline-none focus:ring-blue-500 focus:border-blue-500
          disabled:bg-gray-100 disabled:text-gray-500
          ${a}
        `,autoComplete:"off"}),C&&m&&i.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:i.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-solace-green"})}),h&&_.length>0&&i.jsx("div",{ref:N,className:"absolute z-10 w-full mt-1 border bg-white border-gray-300 rounded-md shadow-lg max-h-60 overflow-auto",children:i.jsx("ul",{children:_.map((j,b)=>i.jsx("li",{onClick:()=>y(j),onKeyDown:I=>I.key==="Enter"&&y(j),className:"px-3 py-2 cursor-pointer hover:bg-stone-300",tabIndex:0,children:j},b))})})]})}const _n={openai:"https://api.openai.com/v1",anthropic:"https://api.anthropic.com",google:"https://generativelanguage.googleapis.com/v1beta/openai",aws:"https://bedrock-runtime.us-east-1.amazonaws.com",cohere:"https://api.cohere.ai/compatibility/v1"},Ni=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google Gemini"},{value:"azure",label:"Azure"},{value:"openai_compatible",label:"OpenAI Compatible Provider"}],Cr={openai:"openai",anthropic:"anthropic",google:"openai",openai_compatible:"openai",azure:"azure"},Ci={openai:["o3-mini","o3-mini-high","o3-mini-low","o1","o1-preview","o1-mini","gpt-4.5-preview","gpt-4o","gpt-4o-mini"],anthropic:["claude-3-7-sonnet-20250219","claude-3-5-sonnet-20241022","claude-3-5-haiku-20241022","claude-3-opus-20240229","claude-3-haiku-20240307"],google:["gemini-2.0-flash-001","gemini-2.0-pro-exp-02-05","gemini-2.0-flash-lite-001","gemini-2.0-flash-thinking-exp-01-21","gemini-1.5-flash-002","gemini-1.5-pro-002"],bedrock:["amazon.nova-pro-v1:0","amazon.nova-pro-latency-optimized-v1:0","amazon.nova-lite-v1:0","amazon.nova-micro-v1:0","anthropic.claude-3-7-sonnet-20250219-v1:0","anthropic.claude-3-5-sonnet-20241022-v2:0","anthropic.claude-3-5-haiku-20241022-v1:0","anthropic.claude-3-5-sonnet-20240620-v1:0","anthropic.claude-3-opus-20240229-v1:0","anthropic.claude-3-sonnet-20240229-v1:0","anthropic.claude-3-haiku-20240307-v1:0"],custom:[]};async function Ai(e,t){try{const n=e.endsWith("/")?e:`${e}/`,r=await fetch(`${n}v1/models`,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to fetch models: ${r.status}`);const s=await r.json();return s.data&&Array.isArray(s.data)?s.data.filter(l=>l.id).map(l=>l.id):s.models&&Array.isArray(s.models)?s.models.filter(l=>l.id??l.name).map(l=>l.id??l.name):Array.isArray(s)?s.filter(l=>l.id??l.name).map(l=>l.id??l.name):[]}catch(n){return console.error("Error fetching models:",n),[]}}const Ar=(e,t)=>e.includes("/")?e:`${Cr[t]||t}/${e}`;function Er({data:e,updateData:t,onNext:n,onPrevious:r}){const[s,l]=S.useState({}),[o,a]=S.useState(!1),[d,c]=S.useState(null),[u,m]=S.useState(!1),[h,p]=S.useState([]),[_,w]=S.useState(!1),[C,f]=S.useState(null);S.useEffect(()=>{console.log(e.setupPath);const j={};e.llm_provider||(j.llm_provider="openai"),Object.keys(j).length>0&&t(j)},[e,t]),S.useEffect(()=>{if(e.llm_provider){const j={};if(C!==null&&C!==e.llm_provider){if(j.llm_model_name="",e.llm_provider!=="openai_compatible"){const b=_n[e.llm_provider]||"";j.llm_endpoint_url=b}else j.llm_endpoint_url="";Object.keys(j).length>0&&t(j)}f(e.llm_provider)}},[e.llm_provider,C,t]),S.useEffect(()=>{e.llm_provider&&e.llm_provider!=="openai_compatible"?p(Ci[e.llm_provider]||[]):p([])},[e.llm_provider]);const v=j=>{t({[j.target.name]:j.target.value})},N=S.useCallback(async()=>{if(e.llm_provider==="openai_compatible"&&e.llm_endpoint_url&&e.llm_api_key){w(!0);try{const j=await Ai(e.llm_endpoint_url,e.llm_api_key);p(j)}catch(j){console.error("Error fetching models:",j)}finally{w(!1)}}return[]},[e.llm_provider,e.llm_endpoint_url,e.llm_api_key]),T=()=>{const j={};let b=!0;return e.llm_provider||(j.llm_provider="LLM provider is required",b=!1),e.llm_provider==="openai_compatible"&&!e.llm_endpoint_url&&(j.llm_endpoint_url="LLM endpoint is required for OpenAI compatible endpoint}",b=!1),e.llm_model_name||(j.llm_model_name="LLM model name is required",b=!1),e.llm_api_key||(j.llm_api_key="LLM API key is required",b=!1),l(j),b},D=async()=>{a(!0),c(null);try{const j=e.llm_provider!=="openai_compatible"&&_n[e.llm_provider]||e.llm_endpoint_url,b=Ar(e.llm_model_name,e.llm_provider),B=await(await fetch("/api/test_llm_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:b,api_key:e.llm_api_key,base_url:j})})).json();B.status==="success"?(a(!1),n()):(c(B.message??"Failed to test LLM configuration"),m(!0),a(!1))}catch(j){c(j instanceof Error?`Error: ${j.message}`:"An unexpected error occurred while testing the LLM configuration"),m(!0),a(!1)}},y=j=>{j.preventDefault(),T()&&D()};return i.jsxs("form",{onSubmit:y,children:[i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{className:"mb-4",children:'Configure your AI service provider for language models. To use a LLM provider not in the dropdown choose "OpenAI Compatible Provider" and enter your base URL, API key and model name.'}),i.jsxs("div",{className:"border-b border-gray-200 pb-4 mb-4",children:[i.jsx("h3",{className:"text-lg font-medium mb-4 text-gray-700 font-semibold",children:"Language Model Configuration"}),i.jsx(M,{label:"LLM Provider",htmlFor:"llm_provider",error:s.llm_provider,required:!0,children:i.jsx(re,{id:"llm_provider",name:"llm_provider",value:e.llm_provider||"",onChange:v,options:Ni})}),(e.llm_provider==="openai_compatible"||e.llm_provider==="azure")&&i.jsx(M,{label:"LLM Endpoint URL",htmlFor:"llm_endpoint_url",error:s.llm_endpoint_url,required:!0,children:i.jsx(Y,{id:"llm_endpoint_url",name:"llm_endpoint_url",value:e.llm_endpoint_url,onChange:v,placeholder:"https://api.example.com/v1"})}),i.jsx(M,{label:"LLM API Key",htmlFor:"llm_api_key",error:s.llm_api_key,required:!0,children:i.jsx(Y,{id:"llm_api_key",name:"llm_api_key",type:"password",value:e.llm_api_key,onChange:v,placeholder:"Enter your API key"})}),e.llm_provider==="azure"&&i.jsxs(Sr,{className:"mb-4",children:[i.jsx("strong",{children:"Important:"}),' For Azure, in the "LLM Model Name" field, enter your ',i.jsx("strong",{children:"deployment name"})," (not the underlying model name). Your Azure deployment name is the name you assigned when you deployed the model in Azure OpenAI Service. For more details, refer to the"," ",i.jsx("a",{href:"https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Azure documentation"}),"."]}),i.jsx(M,{label:"LLM Model Name",htmlFor:"llm_model_name",error:s.llm_model_name,helpText:"Select or type a model name",required:!0,children:i.jsx(Nr,{id:"llm_model_name",name:"llm_model_name",value:e.llm_model_name,onChange:v,placeholder:"Select or type a model name",suggestions:h,onFocus:e.llm_provider==="openai_compatible"?N:void 0,showLoadingIndicator:_})})]})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:r,disabled:e.setupPath==="quick",variant:"outline",children:"Previous"}),i.jsx(J,{type:"submit",children:"Next"})]}),o&&i.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:i.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full text-center",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Testing LLM Configuration"}),i.jsx("div",{className:"flex justify-center mb-4",children:i.jsx("div",{className:"animate-spin rounded-full h-10 w-10 border-b-2 border-solace-green"})}),i.jsx("p",{children:"Please wait while we test your LLM configuration..."})]})}),u&&i.jsx(Si,{title:"Connection Test Failed",message:`We couldn't connect to your AI provider: ${d}
          Please check your API key, model name, and endpoint URL (if applicable).
          Do you want to skip this check and continue anyway?`,onConfirm:()=>{m(!1),n()},onCancel:()=>{m(!1)}})]})}const Ne=({id:e,label:t,values:n,onChange:r,placeholder:s,helpText:l,error:o,required:a,inputButtonText:d="Add",inputPlaceholder:c="Type and press Add..."})=>{const[u,m]=S.useState(""),h=C=>{m(C.target.value)},p=()=>{if(u.trim()!==""){if(n.includes(u.trim())){m("");return}r([...n,u.trim()]),m("")}},_=C=>{r(n.filter(f=>f!==C))},w=C=>{C.key==="Enter"&&(C.preventDefault(),p())};return i.jsxs(M,{label:t,htmlFor:e,helpText:l,error:o,required:a,children:[i.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[i.jsx(Y,{id:e,name:e,value:u,onChange:h,onKeyDown:w,placeholder:c,className:"flex-grow"}),i.jsx(J,{onClick:p,variant:"secondary",type:"button",children:d})]}),n.length>0&&i.jsx("div",{className:"flex flex-wrap gap-2 mt-2 p-2 border border-gray-200 rounded-md min-h-[40px]",children:n.map((C,f)=>i.jsxs("div",{className:"flex items-center bg-gray-100 text-gray-700 text-sm font-medium px-3 py-1 rounded-full",children:[i.jsx("span",{children:C}),i.jsx("button",{type:"button",onClick:()=>_(C),className:"ml-2 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":`Remove ${C}`,children:"×"})]},f))}),n.length===0&&s&&i.jsx("div",{className:"mt-2 p-2 border border-dashed border-gray-300 rounded-md min-h-[40px] flex items-center justify-center",children:i.jsx("p",{className:"text-sm text-gray-400",children:s})})]})};function ye({id:e,checked:t,onChange:n,label:r,disabled:s=!1,className:l=""}){const o=a=>{n(a.target.checked)};return i.jsxs("div",{className:`flex items-center ${l}`,children:[i.jsx("input",{id:e,type:"checkbox",checked:t,onChange:o,disabled:s,className:"h-4 w-4 text-solace-green focus:ring-solace-green border-gray-300 rounded"}),r&&i.jsx("label",{htmlFor:e,className:"ml-2 block text-sm text-gray-700",children:r})]})}const Ei=[{value:"memory",label:"Memory: Store session data in memory"},{value:"vertex_rag",label:"Vertex RAG: Use Google Vertex AI for RAG capabilities"}],Ii=[{value:"PERSISTENT",label:"Persistent: Keep session history indefinitely"},{value:"RUN_BASED",label:"Run-based: Clear session history after each run"}],Pi=[{value:"memory",label:"Memory: Store artifacts in memory (temporary)"},{value:"filesystem",label:"Filesystem: Store artifacts on disk"},{value:"gcs",label:"GCS: Store artifacts in Google Cloud Storage"}],Ti=[{value:"namespace",label:"Namespace: Share artifacts within the namespace"},{value:"app",label:"App: Isolate artifacts by app name"},{value:"custom",label:"Custom: Use a custom scope identifier"}],Fi=[{value:"ignore",label:"Ignore: Do not include artifacts in messages"},{value:"embed",label:"Embed: Include base64 data in messages"},{value:"reference",label:"Reference: Include fetch URI in messages"}];function Mi({data:e,updateData:t,onNext:n,onPrevious:r}){const[s,l]=S.useState({}),[o,a]=S.useState(!1),d=(A,G)=>{if(A==null)return G;if(Array.isArray(A))return A.map(se=>String(se).trim()).filter(se=>se.length>0);const ae=String(A).trim();return ae===""?[]:ae.split(",").map(se=>se.trim()).filter(se=>se.length>0)},[c,u]=S.useState(e.agent_name||"OrchestratorAgent"),[m,h]=S.useState(e.supports_streaming!==!1),[p,_]=S.useState(e.session_service_type||"memory"),[w,C]=S.useState(e.session_service_behavior||"PERSISTENT"),[f,v]=S.useState(e.artifact_service_type||"filesystem"),[N,T]=S.useState(e.artifact_service_base_path||"/tmp/samv2"),[D,y]=S.useState(e.artifact_service_scope||"namespace"),[j,b]=S.useState(e.artifact_handling_mode||"reference"),[I,B]=S.useState(e.enable_embed_resolution!==!1),[F,L]=S.useState(e.enable_artifact_content_instruction!==!1),[z,R]=S.useState(e.agent_card_description||"The Orchestrator component. It manages tasks and coordinates multi-agent workflows."),[U,Z]=S.useState(d(e.agent_card_default_input_modes,["text"])),[O,q]=S.useState(d(e.agent_card_default_output_modes,["text","file"])),[X,g]=S.useState(e.agent_discovery_enabled!==!1),[ee,ie]=S.useState(e.agent_card_publishing_interval||10),[x,oe]=S.useState(d(e.inter_agent_communication_allow_list,["*"])),[we,te]=S.useState(d(e.inter_agent_communication_deny_list,[])),[ke,xe]=S.useState(e.inter_agent_communication_timeout||180);S.useEffect(()=>{o||(e.agent_name&&u(e.agent_name),e.supports_streaming!==void 0&&h(e.supports_streaming),e.session_service_type&&_(e.session_service_type),e.session_service_behavior&&C(e.session_service_behavior),e.artifact_service_type&&v(e.artifact_service_type),e.artifact_service_base_path&&T(e.artifact_service_base_path),e.artifact_service_scope&&y(e.artifact_service_scope),e.artifact_handling_mode&&b(e.artifact_handling_mode),e.enable_embed_resolution!==void 0&&B(e.enable_embed_resolution),e.enable_artifact_content_instruction!==void 0&&L(e.enable_artifact_content_instruction),e.agent_card_description&&R(e.agent_card_description),e.agent_card_default_input_modes!==void 0&&Z(d(e.agent_card_default_input_modes,["text"])),e.agent_card_default_output_modes!==void 0&&q(d(e.agent_card_default_output_modes,["text","file"])),e.agent_discovery_enabled!==void 0&&g(e.agent_discovery_enabled),e.agent_card_publishing_interval&&ie(e.agent_card_publishing_interval),e.inter_agent_communication_allow_list!==void 0&&oe(d(e.inter_agent_communication_allow_list,["*"])),e.inter_agent_communication_deny_list!==void 0&&te(d(e.inter_agent_communication_deny_list,[])),e.inter_agent_communication_timeout&&xe(e.inter_agent_communication_timeout),a(!0))},[e,o]);const Ae=A=>{u(A.target.value),t({agent_name:A.target.value})},Ee=A=>{h(A),t({supports_streaming:A})},Le=A=>{_(A.target.value),t({session_service_type:A.target.value})},wt=A=>{C(A.target.value),t({session_service_behavior:A.target.value})},kt=A=>{v(A.target.value),t({artifact_service_type:A.target.value})},jt=A=>{T(A.target.value),t({artifact_service_base_path:A.target.value})},rt=A=>{y(A.target.value),t({artifact_service_scope:A.target.value})},it=A=>{b(A.target.value),t({artifact_handling_mode:A.target.value})},st=A=>{B(A),t({enable_embed_resolution:A})},St=A=>{L(A),t({enable_artifact_content_instruction:A})},lt=A=>{R(A.target.value),t({agent_card_description:A.target.value})},ot=A=>{Z(A),t({agent_card_default_input_modes:A})},Nt=A=>{q(A),t({agent_card_default_output_modes:A})},Ct=A=>{g(A),t({agent_discovery_enabled:A})},At=A=>{ie(Number(A.target.value)),t({agent_card_publishing_interval:Number(A.target.value)})},Et=A=>{oe(A),t({inter_agent_communication_allow_list:A})},It=A=>{te(A),t({inter_agent_communication_deny_list:A})},k=A=>{xe(Number(A.target.value)),t({inter_agent_communication_timeout:Number(A.target.value)})},P=()=>{const A={};let G=!0;return c?/^[a-zA-Z0-9_]+$/.test(c)||(A.agentName="Agent name can only contain letters, numbers, and underscores.",G=!1):(A.agentName="Agent name is required",G=!1),f==="filesystem"&&!N&&(A.artifactBasePath="Artifact base path is required for filesystem service",G=!1),(!ee||ee<=0)&&(A.cardPublishingInterval="Publishing interval must be a positive number",G=!1),(!ke||ke<=0)&&(A.communicationTimeout="Communication timeout must be a positive number",G=!1),l(A),G},V=A=>{A.preventDefault(),P()&&n()};return i.jsxs("form",{onSubmit:V,children:[i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{className:"mb-4",children:"Configure the main orchestrator for your Solace Agent Mesh system. This will set up the agent that orchestrates communication between components."}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsx("div",{className:"col-span-2",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Basic Configuration"})}),i.jsx(M,{label:"Agent Name",htmlFor:"agent_name",error:s.agentName,required:!0,helpText:"The name can only contain letters, numbers, and underscores.",children:i.jsx(Y,{id:"agent_name",value:c,onChange:Ae,placeholder:"OrchestratorAgent",required:!0})}),i.jsx(M,{label:"Supports Streaming",htmlFor:"supports_streaming",helpText:"Enable streaming support for the agent",children:i.jsx(ye,{id:"supports_streaming",checked:m,onChange:Ee,label:"Enable streaming support"})}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Session Service"})}),i.jsx(M,{label:"Session Service Type",htmlFor:"session_service_type",required:!0,children:i.jsx(re,{id:"session_service_type",options:Ei,value:p,onChange:Le})}),i.jsx(M,{label:"Session Behavior",htmlFor:"session_behavior",required:!0,children:i.jsx(re,{id:"session_behavior",options:Ii,value:w,onChange:wt})}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Artifact Service"})}),i.jsx(M,{label:"Artifact Service Type",htmlFor:"artifact_service_type",required:!0,children:i.jsx(re,{id:"artifact_service_type",options:Pi,value:f,onChange:kt})}),f==="filesystem"&&i.jsx(M,{label:"Artifact Base Path",htmlFor:"artifact_base_path",error:s.artifactBasePath,required:!0,children:i.jsx(Y,{id:"artifact_base_path",value:N,onChange:jt,placeholder:"/tmp/samv2"})}),i.jsx(M,{label:"Artifact Scope",htmlFor:"artifact_scope",required:!0,children:i.jsx(re,{id:"artifact_scope",options:Ti,value:D,onChange:rt})}),i.jsx(M,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",required:!0,children:i.jsx(re,{id:"artifact_handling_mode",options:Fi,value:j,onChange:it})}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Feature Flags"})}),i.jsx(M,{label:"Enable Embed Resolution",htmlFor:"enable_embed_resolution",children:i.jsx(ye,{id:"enable_embed_resolution",checked:I,onChange:st,label:"Enable embed resolution"})}),i.jsx(M,{label:"Enable Artifact Content Instruction",htmlFor:"enable_artifact_content_instruction",children:i.jsx(ye,{id:"enable_artifact_content_instruction",checked:F,onChange:St,label:"Enable artifact content instruction"})}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Agent Card"})}),i.jsx("div",{className:"col-span-2",children:i.jsx(M,{label:"Agent Card Description",htmlFor:"agent_card_description",required:!0,children:i.jsx(Y,{id:"agent_card_description",value:z,onChange:lt,placeholder:"A helpful assistant accessed via a custom endpoint, capable of delegating tasks."})})}),i.jsx(Ne,{id:"default_input_modes",label:"Default Input Modes",values:U,onChange:ot,helpText:"Enter input modes (e.g., text). Press Enter or comma to add.",placeholder:"No input modes added yet.",inputPlaceholder:"e.g., text"}),i.jsx(Ne,{id:"default_output_modes",label:"Default Output Modes",values:O,onChange:Nt,helpText:"Enter output modes (e.g., text, file). Press Enter or comma to add.",placeholder:"No output modes added yet.",inputPlaceholder:"e.g., text, file"}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Agent Discovery"})}),i.jsx(M,{label:"Enable Agent Discovery",htmlFor:"agent_discovery_enabled",children:i.jsx(ye,{id:"agent_discovery_enabled",checked:X,onChange:Ct,label:"Enable agent discovery"})}),i.jsx(M,{label:"Card Publishing Interval",htmlFor:"card_publishing_interval",error:s.cardPublishingInterval,helpText:"Interval in seconds for publishing agent card",required:!0,children:i.jsx(Y,{id:"card_publishing_interval",type:"number",value:ee.toString(),onChange:At,placeholder:"10"})}),i.jsx("div",{className:"col-span-2 mt-4",children:i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Inter-Agent Communication"})}),i.jsx(Ne,{id:"allow_list",label:"Allow List",values:x,onChange:Et,helpText:"Agent name patterns to allow delegation to (e.g., *, SpecificAgent*). Press Enter or comma to add.",placeholder:"No allow list patterns added.",inputPlaceholder:"e.g., *"}),i.jsx(Ne,{id:"deny_list",label:"Deny List",values:we,onChange:It,helpText:"Agent name patterns to deny delegation to. Press Enter or comma to add.",placeholder:"No deny list patterns added.",inputPlaceholder:"e.g., RiskyAgent*"}),i.jsx(M,{label:"Communication Timeout",htmlFor:"communication_timeout",error:s.communicationTimeout,helpText:"Timeout in seconds for inter-agent communication",required:!0,children:i.jsx(Y,{id:"communication_timeout",type:"number",value:ke.toString(),onChange:k,placeholder:"30"})})]})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:r,variant:"outline",children:"Previous"}),i.jsx(J,{type:"submit",children:"Next"})]})]})}function Li({data:e,updateData:t,onNext:n,onPrevious:r}){const[s,l]=S.useState({});S.useEffect(()=>{const u={add_webui_gateway:e.add_webui_gateway??!1,webui_session_secret_key:e.webui_session_secret_key??"",webui_fastapi_host:e.webui_fastapi_host??"127.0.0.1",webui_fastapi_port:e.webui_fastapi_port??8e3,webui_enable_embed_resolution:e.webui_enable_embed_resolution??!0,webui_frontend_welcome_message:e.webui_frontend_welcome_message??"",webui_frontend_bot_name:e.webui_frontend_bot_name??"Solace Agent Mesh",webui_frontend_collect_feedback:e.webui_frontend_collect_feedback??!1},m={};for(const h in u)e[h]===void 0&&u[h]!==void 0&&(m[h]=u[h]);Object.keys(m).length>0&&t(m)},[]);const o=u=>{const{name:m,value:h,type:p}=u.target;t(p==="number"?{[m]:h===""?"":Number(h)}:{[m]:h})},a=(u,m)=>{t({[u]:m})},d=()=>{const u={};let m=!0;return e.add_webui_gateway&&(e.webui_session_secret_key||(u.webui_session_secret_key="Session Secret Key is required.",m=!1),e.webui_fastapi_host||(u.webui_fastapi_host="FastAPI Host is required.",m=!1),e.webui_fastapi_port===void 0||e.webui_fastapi_port===""?(u.webui_fastapi_port="FastAPI Port is required.",m=!1):(isNaN(Number(e.webui_fastapi_port))||Number(e.webui_fastapi_port)<=0)&&(u.webui_fastapi_port="FastAPI Port must be a positive number.",m=!1)),l(u),m},c=u=>{u.preventDefault(),d()&&n()};return i.jsxs("form",{onSubmit:c,children:[i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{className:"mb-4",children:"Optionally, configure a Web UI Gateway to interact with your Solace Agent Mesh. This provides a Web UI chat interface."}),i.jsx(M,{label:"",htmlFor:"add_webui_gateway",children:i.jsx(ye,{id:"add_webui_gateway",checked:e.add_webui_gateway||!1,onChange:u=>a("add_webui_gateway",u),label:"Add Web UI Gateway"})}),e.add_webui_gateway&&i.jsxs("div",{className:"space-y-4 p-4 border border-gray-200 rounded-md mt-4",children:[i.jsx("h3",{className:"text-md font-medium text-gray-800 mb-3",children:"Web UI Gateway Configuration"}),i.jsx(M,{label:"Session Secret Key",htmlFor:"webui_session_secret_key",error:s.webui_session_secret_key,required:!0,children:i.jsx(Y,{id:"webui_session_secret_key",name:"webui_session_secret_key",type:"password",value:e.webui_session_secret_key||"",onChange:o,placeholder:"Enter a strong secret key"})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsx(M,{label:"FastAPI Host",htmlFor:"webui_fastapi_host",error:s.webui_fastapi_host,required:!0,children:i.jsx(Y,{id:"webui_fastapi_host",name:"webui_fastapi_host",value:e.webui_fastapi_host||"127.0.0.1",onChange:o,placeholder:"127.0.0.1"})}),i.jsx(M,{label:"FastAPI Port",htmlFor:"webui_fastapi_port",error:s.webui_fastapi_port,required:!0,children:i.jsx(Y,{id:"webui_fastapi_port",name:"webui_fastapi_port",type:"number",value:e.webui_fastapi_port===void 0?"":String(e.webui_fastapi_port),onChange:o,placeholder:"8000"})})]}),i.jsx(M,{label:"",htmlFor:"webui_enable_embed_resolution",children:i.jsx(ye,{id:"webui_enable_embed_resolution",checked:e.webui_enable_embed_resolution||!1,onChange:u=>a("webui_enable_embed_resolution",u),label:"Enable Embed Resolution in Web UI"})}),i.jsx("h4",{className:"text-sm font-medium text-gray-700 mt-3 mb-2",children:"Frontend Customization"}),i.jsx(M,{label:"Frontend Welcome Message",htmlFor:"webui_frontend_welcome_message",error:s.webui_frontend_welcome_message,children:i.jsx(Y,{id:"webui_frontend_welcome_message",name:"webui_frontend_welcome_message",value:e.webui_frontend_welcome_message||"",onChange:o,placeholder:"Welcome to the Solace Agent Mesh!"})}),i.jsx(M,{label:"Frontend Bot Name",htmlFor:"webui_frontend_bot_name",error:s.webui_frontend_bot_name,children:i.jsx(Y,{id:"webui_frontend_bot_name",name:"webui_frontend_bot_name",value:e.webui_frontend_bot_name||"Solace Agent Mesh",onChange:o,placeholder:"Solace Agent Mesh"})}),i.jsx(M,{label:"",htmlFor:"webui_frontend_collect_feedback",children:i.jsx(ye,{id:"webui_frontend_collect_feedback",checked:e.webui_frontend_collect_feedback||!1,onChange:u=>a("webui_frontend_collect_feedback",u),label:"Enable Feedback Collection in Frontend"})})]})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:r,variant:"outline",type:"button",children:"Previous"}),i.jsx(J,{type:"submit",children:"Next"})]})]})}const Ri=["llm","ai","api","url","vpn"],Oi=["broker_password","llm_api_key","webui_session_secret_key"],vn={Project:["namespace"],Broker:["dev_mode","broker_type","broker_url","broker_vpn","broker_username","broker_password"],"AI Provider":["llm_model_name","llm_endpoint_url","llm_api_key"],Orchestrator:["agent_name","supports_streaming","session_service_type","session_service_behavior","artifact_service_type","artifact_service_base_path","artifact_service_scope","artifact_handling_mode","enable_embed_resolution","enable_artifact_content_instruction","agent_card_description","agent_card_default_input_modes","agent_card_default_output_modes","agent_discovery_enabled","agent_card_publishing_interval","inter_agent_communication_allow_list","inter_agent_communication_deny_list","inter_agent_communication_timeout"],"Web UI":["add_webui_gateway","webui_frontend_welcome_message","webui_frontend_bot_name","webui_frontend_collect_feedback","webui_session_secret_key","webui_fastapi_host","webui_fastapi_port","webui_enable_embed_resolution"]};function Ir({data:e,updateData:t,onPrevious:n}){const[r,s]=S.useState(!1),[l,o]=S.useState(null),a=f=>f===void 0||f===""||Array.isArray(f)&&f.length===0,d=f=>f.split("_").map(v=>Ri.includes(v.toLowerCase())?v.toUpperCase():v.charAt(0).toUpperCase()+v.slice(1)).join(" "),c=(f,v)=>Oi.includes(f)||f.toUpperCase().includes("API_KEY")?v&&v.length>0?"••••••••":"Not provided":typeof v=="boolean"?v?"Yes":"No":Array.isArray(v)?v.join(", "):v&&v.toString().length>0?v.toString():"Not provided",u=f=>{switch(f){case"solace":return"Existing Solace Pub/Sub+ broker";case"container":return"New local Solace PubSub+ broker container (podman/docker)";case"dev_mode":return"Run in 'dev mode' - all in one process (not recommended for production)";default:return f}},m=()=>{const f=e.dev_mode;return f!==void 0?null:i.jsxs("div",{children:[i.jsxs("div",{className:"mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Type:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:u(f)})]}),f==="container"&&i.jsx("div",{className:"pl-4 border-l-2 border-gray-300 mb-2",children:i.jsxs("div",{className:"flex mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Container Engine:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:e.container_engine??"Docker"})]})}),(f==="solace"||f==="container")&&i.jsxs("div",{className:"pl-4 border-l-2 border-gray-300",children:[i.jsxs("div",{className:"flex mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Broker URL:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:e.broker_url})]}),i.jsxs("div",{className:"flex mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Broker VPN:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:e.broker_vpn})]}),i.jsxs("div",{className:"flex mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Username:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:e.broker_username})]}),i.jsxs("div",{className:"flex mb-1",children:[i.jsx("span",{className:"text-gray-600",children:"Password:"}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:c("broker_password",e.broker_password)})]})]})]})},h=(f,v)=>v.some(T=>!a(e[T]))?i.jsxs("div",{className:"pb-4 mb-4 border-b border-gray-300 last:border-0 last:mb-0 last:pb-0",children:[i.jsx("h4",{className:"font-semibold text-solace-blue mb-3",children:f}),i.jsx("div",{className:"space-y-3",children:v.map(T=>a(e[T])?null:T==="dev_mode"?i.jsx("div",{children:m()},T):i.jsxs("div",{className:"flex mb-1",children:[i.jsxs("span",{className:"text-gray-600",children:[d(T),":"]}),i.jsx("span",{className:"font-medium text-gray-900 ml-2",children:c(T,e[T])})]},T))})]},f):null,p=f=>{f.namespace&&!f.namespace.endsWith("/")&&(f.namespace+="/"),f.container_started&&delete f.container_started,f.llm_provider&&(f.llm_provider=Cr[f.llm_provider]),f.llm_model_name&&f.llm_provider&&(f.llm_model_name=Ar(f.llm_model_name,f.llm_provider),delete f.llm_provider),f.broker_type==="container"&&(f.broker_type="solace")},_=async(f=!0)=>{p(e),console.log("Submitting configuration:",e);try{const v=await fetch("api/save_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f?{...e,force:!0}:e)}),N=await v.json();if(!v.ok)throw new Error(`HTTP error ${v.status}: ${N.message??"Unknown error"}`);if(N.status==="success"){console.log("Configuration sent successfully!"),t({showSuccess:!0});try{const T=await fetch("api/shutdown",{method:"POST"});T.ok?console.log("Shutdown request sent successfully"):console.warn("Shutdown request failed:",T.status)}catch(T){console.error("Error sending shutdown request:",T)}}else throw new Error(N.message??"Failed to save configuration")}catch(v){o(v instanceof Error?v.message:"An unknown error occurred"),console.error("Error saving configuration:",v)}finally{s(!1)}},w=async()=>{s(!0),o(null),await _()},C=f=>{f.preventDefault(),w()};return i.jsx("div",{className:"space-y-6",children:i.jsxs("form",{onSubmit:C,children:[i.jsx("div",{className:"bg-gray-100 border border-gray-300 rounded-md p-5 space-y-4",children:e.setupPath==="quick"?h("AI Provider",vn["AI Provider"]):Object.entries(vn).map(([f,v])=>h(f,v))}),l&&i.jsxs("div",{className:"p-4 bg-red-50 text-red-700 rounded-md border border-red-200",children:[i.jsx("p",{className:"font-medium",children:"Error initializing project"}),i.jsx("p",{children:l})]}),i.jsxs("div",{className:"mt-8 flex justify-end space-x-4",children:[i.jsx(J,{onClick:n,variant:"outline",type:"button",children:"Previous"}),i.jsx(J,{type:"submit",disabled:r,children:r?i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i.jsx("span",{children:"Initializing..."})]}):"Initialize Project"})]})]})})}const zi=({icon:e,title:t,description:n,time:r,link:s})=>i.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"block bg-white rounded-lg shadow-sm border border-gray-100 hover:shadow-md transition-all duration-200 hover:border-solace-blue/30 group h-full",children:i.jsxs("div",{className:"p-5 flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:"text-2xl mr-3",children:e}),i.jsx("h4",{className:"text-lg font-medium text-gray-800 group-hover:text-solace-blue transition-colors",children:t})]}),i.jsx("div",{className:"bg-gray-100 text-gray-600 px-3 py-1 rounded-full text-xs font-medium",children:r})]}),i.jsx("p",{className:"text-gray-600 text-sm flex-grow mb-4",children:n}),i.jsx("div",{className:"mt-auto flex justify-end",children:i.jsxs("span",{className:"text-solace-blue text-sm font-medium flex items-center group-hover:translate-x-1 transition-transform",children:["View Tutorial",i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 ml-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})})]})}),Di=({icon:e,title:t,description:n,link:r})=>i.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex p-4 bg-gray-50 hover:bg-gray-100 rounded-lg border border-gray-200 transition-colors group",children:[i.jsx("div",{className:"mr-4 bg-solace-blue bg-opacity-10 p-3 rounded-lg text-solace-blue group-hover:bg-opacity-20",children:e}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-gray-800",children:t}),i.jsx("p",{className:"text-sm text-gray-600",children:n})]})]});function Bi({text:e}){const[t,n]=S.useState(!1),r=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch(l){console.error("Failed to copy text:",l)}},s=()=>t?i.jsx("svg",{className:"w-5 h-5 text-green-500 transition-all duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):i.jsx("svg",{className:"w-5 h-5 transition-all duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})});return i.jsx("button",{onClick:r,className:"text-white transition-colors opacity-100","aria-label":t?"Copied":"Copy to clipboard",children:s()})}function sn({title:e,message:t,initTab:n}){const[r,s]=S.useState(n??"getting-started"),l=3,o=r==="getting-started"?0:r==="tutorials"?1:2,a="Operation Successful!",d="Your configuration has been saved. You're now ready to proceed.",c=f=>f===0?"tutorials":f===1?"documentation":"getting-started",u=f=>f===1?"getting-started":f===2?"tutorials":"documentation",m=()=>{if(o<l-1){const f=c(o);s(f)}},h=()=>{if(o>0){const f=u(o);s(f)}},p=f=>{const v="px-4 py-3 text-sm font-medium ";return r===f?v+"text-solace-blue border-b-2 border-solace-blue":v+"text-gray-500 hover:text-solace-blue"},_=[{icon:"🌤️",title:"Weather Agent",description:"Build an agent that gives Solace Agent Mesh the ability to access real-time weather information.",time:"~5 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/custom-agent"},{icon:"🗃️",title:"SQL Database Integration",description:"Enable Solace Agent Mesh to answer company-specific questions using a sample coffee company database.",time:"~10-15 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/sql-database"},{icon:"🧠",title:"MCP Integration",description:"Integrating a Model Context Protocol (MCP) Server into Solace Agent Mesh.",time:"~10-15 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/mcp-integration"},{icon:"💬",title:"Slack Integration",description:"Chat with Solace Agent Mesh directly from Slack.",time:"~20-30 min",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/slack-integration"}],w=[{icon:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),title:"Getting Started",description:"Introduction and basic concepts",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/introduction/"},{icon:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),title:"Architecture",description:"System architecture and design",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/component-overview"},{icon:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),title:"Tutorials",description:"Step-by-step guides",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/tutorials/event-mesh-gateway"},{icon:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),title:"User Guides",description:"User Guides for various components",link:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/user-guide/solace-ai-connector"}],C=()=>r==="getting-started"?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[i.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",viewBox:"0 0 20 20",fill:"currentColor",children:i.jsx("path",{d:"M11 3a1 1 0 10-2 0v1a1 1 0 102 0V3zM15.657 5.757a1 1 0 00-1.414-1.414l-.707.707a1 1 0 001.414 1.414l.707-.707zM18 10a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM5.05 6.464A1 1 0 106.464 5.05l-.707-.707a1 1 0 00-1.414 1.414l.707.707zM5 10a1 1 0 01-1 1H3a1 1 0 110-2h1a1 1 0 011 1zM8 16v-1h4v1a2 2 0 11-4 0zM12 14c.015-.34.208-.646.477-.859a4 4 0 10-4.954 0c.27.213.462.519.476.859h4.002z"})}),"Your Configuration Files"]}),i.jsx("p",{className:"text-gray-600 mb-4",children:"Your configurations have been saved in the following files:"}),i.jsxs("div",{className:"flex space-x-4 mb-4",children:[i.jsxs("div",{className:"bg-gray-50 px-4 py-3 rounded-md border border-gray-200 flex-1 flex items-center",children:[i.jsx("code",{className:"text-solace-blue font-mono",children:".env"}),i.jsx("span",{className:"ml-3 text-gray-500 text-sm",children:"Environment variables"})]}),i.jsxs("div",{className:"bg-gray-50 px-4 py-3 rounded-md border border-gray-200 flex-1 flex items-center",children:[i.jsx("code",{className:"text-solace-blue font-mono",children:"configs/shared_config.yaml"}),i.jsx("span",{className:"ml-3 text-gray-500 text-sm",children:"Config file"})]})]})]}),i.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[i.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",viewBox:"0 0 20 20",fill:"currentColor",children:i.jsx("path",{fillRule:"evenodd",d:"M12.316 3.051a1 1 0 01.633 1.265l-4 12a1 1 0 11-1.898-.632l4-12a1 1 0 011.265-.633zM5.707 6.293a1 1 0 010 1.414L3.414 10l2.293 2.293a1 1 0 11-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0zm8.586 0a1 1 0 011.414 0l3 3a1 1 0 010 1.414l-3 3a1 1 0 11-1.414-1.414L16.586 10l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"})}),"Start the Service"]}),i.jsx("p",{className:"text-gray-600 mb-4",children:"To start Solace Agent Mesh directly, run:"}),i.jsxs("div",{className:"bg-gray-800 text-gray-200 p-4 rounded-md font-mono text-sm mb-4 flex items-center justify-between group relative",children:[i.jsx("code",{children:"sam run"}),i.jsx(Bi,{text:"sam run"})]}),i.jsxs("p",{className:"text-gray-600",children:["You can use"," ",i.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:"sam"})," as a shorthand for"," ",i.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:"solace-agent-mesh"})," ","in all commands."]})]})]}):r==="tutorials"?i.jsxs("div",{children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-800 mb-2",children:"Hands-on Tutorials"}),i.jsx("p",{className:"text-gray-600",children:"Ready to go further? Here are some practical tutorials to help you leverage the full potential of Solace Agent Mesh."})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.map(f=>i.jsx(zi,{icon:f.icon,title:f.title,description:f.description,time:f.time,link:f.link},f.title))})]}):i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-sm border border-gray-100",children:[i.jsxs("h3",{className:"text-lg font-medium text-gray-800 mb-4 flex items-center",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-solace-blue",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),"Documentation Resources"]}),i.jsx("p",{className:"text-gray-600 mb-6",children:"Explore our comprehensive documentation to get the most out of Solace Agent Mesh:"}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:w.map(f=>i.jsx(Di,{icon:f.icon,title:f.title,description:f.description,link:f.link},f.title))}),i.jsx("div",{className:"mt-6 text-center",children:i.jsxs("a",{href:"https://solacelabs.github.io/solace-agent-mesh/docs/documentation/getting-started/introduction/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-5 py-2 rounded-md bg-solace-blue text-white hover:bg-solace-blue-dark transition-colors",children:["View Documentation",i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 ml-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})]})})]}),i.jsxs("div",{className:"p-6 bg-gradient-to-b from-solace-blue-light to-blue-50 rounded-lg text-center",children:[i.jsx("h3",{className:"text-lg font-medium text-solace-blue mb-2",children:"Connect with the Community"}),i.jsx("p",{className:"text-gray-600 mb-4",children:"Solace Agent Mesh is open source! We welcome contributions and discussions from the community."}),i.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row justify-center items-stretch gap-4",children:[i.jsxs("a",{href:"https://github.com/SolaceLabs/solace-agent-mesh",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-1/2 p-4 rounded-md bg-white text-solace-blue border border-solace-blue hover:bg-solace-blue hover:text-white transition-colors flex flex-col items-center justify-center group",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",className:"mb-2 text-solace-blue group-hover:text-white transition-colors",children:i.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z",fill:"currentColor"})}),i.jsx("span",{className:"font-medium",children:"GitHub Repository"})]}),i.jsxs("a",{href:"https://solace.community/c/solace-agent-mesh/16",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-1/2 p-4 rounded-md bg-white text-solace-blue border border-solace-blue hover:bg-solace-blue hover:text-white transition-colors flex flex-col items-center justify-center group",children:[i.jsx("img",{src:"data:image/png;data:image/png;base64,[encoded data, 7860 characters]",alt:"Solace Community Forum Logo",className:"max-h-8 mb-2 object-contain"}),i.jsx("span",{className:"font-medium",children:"Community Forum"})]})]})]})]});return i.jsxs("div",{className:"max-w-5xl mx-auto",children:[i.jsxs("div",{className:"p-8 bg-gradient-to-br from-green-50 to-blue-50 rounded-xl mb-8 text-center relative overflow-hidden",children:[i.jsxs("div",{className:"relative z-10",children:[i.jsx("div",{className:"inline-block bg-green-100 p-3 rounded-full mb-4",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-10 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),i.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:e||a}),i.jsx("p",{className:"text-gray-600 mb-6 max-w-2xl mx-auto",children:t||d}),i.jsxs("div",{className:"inline-flex items-center px-4 py-2 bg-solace-blue text-white rounded-full shadow-sm",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 10.586V7z",clipRule:"evenodd"})}),"Configuration saved successfully"]})]}),i.jsx("div",{className:"absolute top-0 right-0 -mt-10 -mr-10 h-40 w-40 bg-green-200 opacity-50 rounded-full"}),i.jsx("div",{className:"absolute bottom-0 left-0 -mb-10 -ml-10 h-32 w-32 bg-green-200 opacity-50 rounded-full"})]}),i.jsxs("div",{className:"flex items-center mb-6 border-b",children:[i.jsxs("div",{className:"flex-1 flex",children:[i.jsx("button",{onClick:()=>s("getting-started"),className:p("getting-started"),children:"Getting Started"}),i.jsx("button",{onClick:()=>s("tutorials"),className:p("tutorials"),children:"Tutorials"}),i.jsx("button",{onClick:()=>s("documentation"),className:p("documentation"),children:"Documentation"})]}),i.jsxs("div",{className:"text-gray-500 text-sm mr-4 flex items-center",children:["Page ",o+1," of ",l]})]}),C(),i.jsxs("div",{className:"mt-8 flex justify-between items-center",children:[i.jsx("div",{className:"text-sm text-gray-500",children:i.jsxs("span",{className:"md:hidden",children:["Page ",o+1," of ",l]})}),i.jsxs("div",{className:"flex space-x-4",children:[i.jsx(J,{onClick:h,variant:"outline",type:"button",disabled:o===0,children:"Previous"}),i.jsx(J,{onClick:m,type:"button",disabled:o===l-1,children:"Next"})]})]})]})}const Pt={id:"path-selection",title:"Setup Path",description:"Choose your setup path",component:bi},wn=[{id:"project-setup",title:"Project Structure",description:"Set up your project namespace",component:vi},{id:"broker-setup",title:"Broker Setup",description:"Configure your Solace PubSub+ broker connection",component:ji},{id:"ai-provider-setup",title:"AI Provider",description:"Configure your AI services",component:Er},{id:"orchestrator-setup",title:"Orchestrator",description:"Configure your main orchestrator",component:Mi},{id:"webui-gateway-setup",title:"Web UI Gateway",description:"Configure the optional Web UI Gateway",component:Li},{id:"completion",title:"Review & Submit",description:"Finalize your configuration",component:Ir}],kn=[{id:"ai-provider-setup",title:"AI Provider",description:"Configure your AI services",component:Er},{id:"completion",title:"Review & Submit",description:"Finalize your configuration",component:Ir}];function qi(){const[e,t]=S.useState(0),[n,r]=S.useState({}),[s,l]=S.useState(!1),[o,a]=S.useState(null),[d,c]=S.useState(null),[u,m]=S.useState(!1),[h,p]=S.useState([Pt]);S.useEffect(()=>{d&&(l(!0),fetch(`/api/default_options?path=${d}`).then(y=>{if(!y.ok)throw new Error("Failed to fetch default options");return y.json()}).then(y=>{if(y!=null&&y.default_options){const j=y.default_options;_(j),r(b=>({...b,...j})),l(!1)}else throw new Error("Invalid response format")}).catch(y=>{console.error("Error fetching default options:",y),a("Failed to connect to server, is the init process still running?"),l(!1)}))},[d]);const _=y=>{y.llm_model_name&&delete y.llm_model_name,y.embedding_model_name&&delete y.embedding_model_name};S.useEffect(()=>{d==="quick"?p([Pt,...kn]):d==="advanced"&&p([Pt,...wn])},[d]);const w=h[e],C=y=>{y.setupPath&&y.setupPath!==d&&c(y.setupPath),y.showSuccess===!0&&m(!0),r(j=>({...j,...y}))},f=()=>{e<h.length-1&&t(e+1)},v=()=>{e>0&&t(e-1)};if(s&&e>0)return i.jsxs("div",{className:"max-w-4xl mx-auto p-6 flex flex-col items-center justify-center min-h-[400px]",children:[i.jsx("h1",{className:"text-3xl font-bold mb-8 text-solace-blue",children:"Solace Agent Mesh Initialization"}),i.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 w-full text-center",children:[i.jsxs("div",{className:"animate-pulse flex flex-col items-center",children:[i.jsx("div",{className:"h-4 w-1/2 bg-gray-200 rounded mb-4"}),i.jsx("div",{className:"h-10 w-3/4 bg-gray-200 rounded"})]}),i.jsx("p",{className:"mt-4",children:"Loading configuration options..."})]})]});if(o)return i.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[i.jsx("h1",{className:"text-3xl font-bold mb-8 text-center text-solace-blue",children:"Solace Agent Mesh Initialization"}),i.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[i.jsxs("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-4",role:"alert",children:[i.jsx("p",{className:"font-bold",children:"Error"}),i.jsx("p",{children:o})]}),i.jsx("div",{className:"mt-4 flex justify-center",children:i.jsx("button",{onClick:()=>window.location.reload(),className:"bg-solace-blue hover:bg-blue-700 text-white font-bold py-2 px-4 rounded",children:"Retry"})})]})]});if(u)return i.jsx("div",{className:"max-w-4xl mx-auto p-6",children:i.jsx(sn,{title:"Solace Agent Mesh Initialized Successfully!",message:"Your project configuration has been saved. You are now ready to start building and running agents."})});const N=w==null?void 0:w.component;if(!N)return i.jsx("div",{className:"text-center p-10 text-red-600",children:"Error: Setup step not found."});const T=e>0,D=()=>d==="quick"?kn:d==="advanced"?wn:[];return i.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[i.jsx("h1",{className:"text-3xl font-bold mb-8 text-center text-solace-blue",children:"Solace Agent Mesh Initialization"}),T&&i.jsx("div",{className:"mb-8",children:i.jsx(rn,{steps:D(),currentStepIndex:e>0?e-1:0,onStepClick:()=>{}})}),i.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 mb-6",children:[i.jsx("h2",{className:"text-xl font-bold mb-2 text-solace-blue",children:w.title}),i.jsx("p",{className:"text-gray-600 mb-6",children:w.description}),i.jsx(N,{data:n,updateData:C,onNext:f,onPrevious:v})]})]})}const Ui=[{value:"planning",label:"Planning Model (*planning_model)"},{value:"general",label:"General Model (*general_model)"},{value:"image_gen",label:"Image Generation Model (*image_gen_model)"},{value:"report_gen",label:"Report Generation Model (*report_gen_model)"},{value:"multimodal",label:"Multimodal Model (*multimodal_model)"},{value:"gemini_pro",label:"Gemini Pro Model (*gemini_pro_model)"}],Hi=({data:e,updateData:t,onNext:n,onPrevious:r})=>{const s=a=>{const{name:d,value:c,type:u}=a.target,m=u==="checkbox"?a.target.checked:c;t({[d]:m})},l=()=>{if(!e.agent_name||e.agent_name.trim()===""){alert("Agent Name is required.");return}let a=e.instruction;if(typeof a=="string"&&a.includes("__AGENT_NAME__")){const d=e.agent_name;a=a.replace(/__AGENT_NAME__/g,d),t({instruction:a})}n()},o=e.instruction||`You are a helpful assistant named ${e.agent_name||"NewAgent"}, accessed via a custom endpoint.`;return i.jsxs("div",{className:"space-y-6",children:[i.jsx(M,{label:"Agent Name",htmlFor:"agent_name",required:!0,helpText:"Unique name for this agent (will be PascalCase by the system).",children:i.jsx(Y,{id:"agent_name",name:"agent_name",value:e.agent_name||"",onChange:s,placeholder:"MyNewAgent",required:!0})}),i.jsx(M,{label:"A2A Namespace",htmlFor:"namespace",helpText:"A2A topic namespace (e.g., myorg/dev). Can use ${NAMESPACE} for environment variable.",children:i.jsx(Y,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:s,placeholder:"${NAMESPACE}"})}),i.jsx(M,{label:"Model Type",htmlFor:"model_type",required:!0,children:i.jsx(re,{id:"model_type",name:"model_type",value:e.model_type||"planning",onChange:s,options:Ui})}),i.jsx(M,{label:"Instruction",htmlFor:"instruction",helpText:"System instruction for the agent. Use __AGENT_NAME__ to refer to the agent's name.",children:i.jsx("textarea",{id:"instruction",name:"instruction",value:e.instruction!==void 0?e.instruction:o.replace("__AGENT_NAME__",e.agent_name||"NewAgent"),onChange:s,rows:4,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"You are a helpful assistant..."})}),i.jsx(M,{label:"",htmlFor:"supports_streaming",children:i.jsx(ye,{id:"supports_streaming",checked:e.supports_streaming===void 0?!0:!!e.supports_streaming,onChange:a=>t({supports_streaming:a}),label:"Supports Streaming (host capability for A2A tasks/sendSubscribe)"})}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",disabled:!0,children:"Previous"}),i.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},mt="use_default_shared_session",pt="use_default_shared_artifact",Vi=[{value:mt,label:"Use Default (from shared_config.yaml)"},{value:"memory",label:"Memory (In-Process)"},{value:"vertex_rag",label:"Vertex RAG (Google Cloud)"}],Wi=[{value:"PERSISTENT",label:"Persistent (Retains history across runs)"},{value:"RUN_BASED",label:"Run-based (Clears history after each run)"}],Gi=[{value:pt,label:"Use Default (from shared_config.yaml)"},{value:"memory",label:"Memory (In-Process, temporary)"},{value:"filesystem",label:"Filesystem (Local disk storage)"},{value:"gcs",label:"Google Cloud Storage (GCS)"}],Ji=[{value:"namespace",label:"Namespace (Shared by all agents in namespace)"},{value:"app",label:"App (Isolated to this agent instance)"}],Yi=({data:e,updateData:t,onNext:n,onPrevious:r})=>{const s=c=>{const{name:u,value:m}=c.target,h={[u]:m};u==="session_service_type"?m===mt?h.session_service_behavior=void 0:e.session_service_behavior||(h.session_service_behavior="PERSISTENT"):u==="artifact_service_type"&&(m===pt?(h.artifact_service_base_path=void 0,h.artifact_service_scope=void 0):(e.artifact_service_scope||(h.artifact_service_scope="namespace"),m==="filesystem"&&!e.artifact_service_base_path&&(h.artifact_service_base_path="/tmp/samv2"))),t(h)},l=c=>{t({[c.target.name]:c.target.value})},o=()=>{if(e.artifact_service_type==="filesystem"&&(!e.artifact_service_base_path||e.artifact_service_base_path.trim()==="")){alert("Artifact Service Base Path is required when type is Filesystem and not using default.");return}n()},a=e.session_service_type!==mt,d=e.artifact_service_type!==pt;return i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{children:"Configure how your agent stores session history and handles artifacts (files). You can use default settings from a shared project configuration or define them specifically for this agent."}),i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Session Service"}),i.jsx(M,{label:"Session Service Configuration",htmlFor:"session_service_type",required:!0,children:i.jsx(re,{id:"session_service_type",name:"session_service_type",value:e.session_service_type||mt,onChange:s,options:Vi})}),a&&i.jsx(M,{label:"Session Service Behavior",htmlFor:"session_service_behavior",required:!0,children:i.jsx(re,{id:"session_service_behavior",name:"session_service_behavior",value:e.session_service_behavior||"PERSISTENT",onChange:l,options:Wi})}),i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4 mt-8",children:"Artifact Service"}),i.jsx(M,{label:"Artifact Service Configuration",htmlFor:"artifact_service_type",required:!0,children:i.jsx(re,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||pt,onChange:s,options:Gi})}),d&&e.artifact_service_type==="filesystem"&&i.jsx(M,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:!0,helpText:"Base directory path for filesystem artifact storage.",children:i.jsx(Y,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"/tmp/samv2",onChange:l,placeholder:"/tmp/samv2",required:!0})}),d&&i.jsx(M,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:!0,children:i.jsx(re,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"namespace",onChange:l,options:Ji})}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),i.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},Pr=({title:e,onClose:t,children:n})=>i.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center p-4",children:i.jsxs("div",{className:"relative bg-white w-full max-w-2xl mx-auto rounded-lg shadow-xl p-6",children:[i.jsxs("div",{className:"flex justify-between items-center border-b pb-3 mb-4",children:[i.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:e}),i.jsx("button",{onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center","aria-label":"Close modal",children:i.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),i.jsx("div",{children:n})]})}),Tt={id:void 0,tool_type:"",tool_name:"",tool_description:"",group_name:"",component_module:"",function_name:"",component_base_path:"",connection_params_str:"{}",environment_variables_str:"{}",tool_config_str:"{}",connection_params:void 0,environment_variables:void 0,required_scopes:[],tool_config:void 0},Te=(e,t=void 0)=>{if(e===void 0||e.trim()===""||e.trim()==="{}")return t;try{const n=JSON.parse(e);return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:t}catch(n){return console.warn("Failed to parse JSON string:",e,n),t}},Xi=({data:e,updateData:t,onNext:n,onPrevious:r,availableTools:s})=>{const[l,o]=S.useState(!1),[a,d]=S.useState(Tt),[c,u]=S.useState("initial"),[m,h]=S.useState(null),[p,_]=S.useState({}),w=Array.isArray(e.tools)?e.tools:[],C=()=>{d({...Tt,id:Date.now().toString()}),h(null),_({}),u("initial"),o(!0)},f=b=>{b.tool_type==="builtin-group"?u("builtin-group"):b.tool_type==="builtin"?u("builtin-tool"):u("custom");const I={...Tt,...b,id:b.id||Date.now().toString(),tool_type:b.tool_type||"",connection_params_str:b.connection_params?JSON.stringify(b.connection_params,null,2):"{}",environment_variables_str:b.environment_variables?JSON.stringify(b.environment_variables,null,2):"{}",tool_config_str:b.tool_config?JSON.stringify(b.tool_config,null,2):"{}",required_scopes:Array.isArray(b.required_scopes)?b.required_scopes:[]};d(I),h(b.id||null),_({}),o(!0)},v=b=>{const{name:I,value:B}=b.target;if(d(F=>({...F,[I]:B})),I==="connection_params_str"||I==="environment_variables_str"||I==="tool_config_str")if(B.trim()===""||B.trim()==="{}")_(F=>({...F,[I]:void 0}));else try{const F=JSON.parse(B);typeof F!="object"||F===null||Array.isArray(F)?_(L=>({...L,[I]:"Must be a valid JSON object."})):I==="connection_params_str"&&(!F.type||!F.command||!F.args)?_(L=>({...L,[I]:"Connection parameters must include type, command, and args."})):_(L=>({...L,[I]:void 0}))}catch{_(L=>({...L,[I]:"Invalid JSON format."}))}},N=(b,I)=>{d(B=>({...B,[b]:I}))},T=()=>{const b={};if(a.tool_type||(b.tool_type="Tool type is required."),a.tool_type==="builtin-group"?a.group_name||(b.group_name="Group name is required."):a.tool_type==="builtin"?a.tool_name||(b.tool_name="Tool name is required."):a.tool_type==="python"?(a.component_module||(b.component_module="Component module is required."),a.function_name||(b.function_name="Function name is required.")):a.tool_type==="mcp"&&(!a.connection_params_str||a.connection_params_str.trim()==="{}")&&(b.connection_params_str="Connection parameters are required for MCP tools."),a.connection_params_str)try{Te(a.connection_params_str,void 0)}catch{b.connection_params_str="Invalid JSON format for Connection Parameters."}if(a.environment_variables_str)try{Te(a.environment_variables_str,void 0)}catch{b.environment_variables_str="Invalid JSON format for Environment Variables."}if(a.tool_config_str)try{Te(a.tool_config_str,void 0)}catch{b.tool_config_str="Invalid JSON format for Tool Config."}return _(b),Object.keys(b).length===0},D=()=>{if(!T())return;const b={id:a.id||Date.now().toString(),tool_type:a.tool_type};let I;switch(a.tool_type){case"builtin-group":I={...b,group_name:a.group_name};break;case"builtin":I={...b,tool_name:a.tool_name};break;case"python":I={...b,tool_name:a.tool_name||void 0,tool_description:a.tool_description||void 0,component_module:a.component_module||void 0,function_name:a.function_name||void 0,component_base_path:a.component_base_path||void 0,tool_config:Te(a.tool_config_str,void 0),required_scopes:a.required_scopes||[]};break;case"mcp":I={...b,tool_name:a.tool_name||void 0,connection_params:Te(a.connection_params_str,void 0),environment_variables:Te(a.environment_variables_str,void 0),tool_config:Te(a.tool_config_str,void 0),required_scopes:a.required_scopes||[]};break;default:o(!1);return}let B;m?B=w.map(F=>F.id===m?I:F):B=[...w,I],t({tools:B}),o(!1),h(null)},y=b=>{b&&t({tools:w.filter(I=>I.id!==b)})},j=b=>{const I=[];return b.tool_type==="builtin-group"?I.push(`Group: ${b.group_name}`):b.tool_name?I.push(`Name: ${b.tool_name}`):b.tool_type==="python"&&b.function_name&&I.push(`Func: ${b.function_name}`),b.component_module&&I.push(`Module: ${b.component_module}`),I.join(", ")||"No details"};return i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{children:"Define custom tools for your agent. Tools can be Python functions, MCP servers, or built-in ADK capabilities. The final tools configuration will be submitted as a list of tool objects."}),i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Custom Tools"}),i.jsx(J,{onClick:C,variant:"secondary",children:"+ Add Tool"}),w.length>0?i.jsx("div",{className:"mt-4 space-y-3",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 border",children:[i.jsx("thead",{className:"bg-gray-50",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),i.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Details"}),i.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),i.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:w.map((b,I)=>i.jsxs("tr",{children:[i.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-700",children:b.tool_type}),i.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm text-gray-500 max-w-xs truncate",title:j(b),children:j(b)}),i.jsxs("td",{className:"px-4 py-2 whitespace-nowrap text-sm space-x-2",children:[i.jsx(J,{onClick:()=>f(b),variant:"outline",children:"Edit"}),i.jsx(J,{onClick:()=>y(b.id),variant:"outline",className:"text-red-600 border-red-300 hover:bg-red-50",children:"Delete"})]})]},b.id||I))})]})}):i.jsx("p",{className:"text-gray-500 mt-4",children:"No tools configured yet."}),l&&i.jsx(Pr,{title:m?"Edit Tool":"Add New Tool",onClose:()=>o(!1),children:i.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto p-1",children:[c==="initial"&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-sm text-gray-600",children:"What kind of tool do you want to add?"}),i.jsx(J,{onClick:()=>{d(b=>({...b,tool_type:"builtin-group"})),u("builtin-group")},variant:"secondary",className:"w-full justify-start",children:"Group of Built-in Tools"}),i.jsx(J,{onClick:()=>{d(b=>({...b,tool_type:"builtin"})),u("builtin-tool")},variant:"secondary",className:"w-full justify-start",children:"Single Built-in Tool"}),i.jsx(J,{onClick:()=>{d(b=>({...b,tool_type:"python"})),u("custom")},variant:"secondary",className:"w-full justify-start",children:"Python Tool"}),i.jsx(J,{onClick:()=>{d(b=>({...b,tool_type:"mcp"})),u("custom")},variant:"secondary",className:"w-full justify-start",children:"MCP Tool"})]}),c==="builtin-group"&&i.jsx(M,{label:"Built-in Tool Group",htmlFor:"group_name",error:p.group_name,required:!0,children:i.jsx(re,{id:"group_name",name:"group_name",value:a.group_name||"",onChange:v,options:[{value:"",label:"Select a group..."},...s&&"groups"in s&&s.groups?Object.keys(s.groups).map(b=>({value:b,label:`${b.replace(/_/g," ").replace(/\b\w/g,I=>I.toUpperCase())} - ${s.groups[b].description}`})):[]]})}),c==="builtin-tool"&&i.jsx(M,{label:"Built-in Tool Name",htmlFor:"tool_name",error:p.tool_name,required:!0,children:i.jsx(Nr,{id:"tool_name",name:"tool_name",value:a.tool_name||"",onChange:v,suggestions:s&&"tools"in s&&s.tools?Object.keys(s.tools):[],placeholder:"Select a built-in tool..."})}),c==="custom"&&i.jsxs(i.Fragment,{children:[a.tool_type==="python"&&i.jsxs(i.Fragment,{children:[i.jsx(M,{label:"Tool Name (Optional)",htmlFor:"tool_name",error:p.tool_name,helpText:"Optional: A descriptive name for this Python tool. Overwrites the python function name",children:i.jsx(Y,{id:"tool_name",name:"tool_name",value:a.tool_name||"",onChange:v})}),i.jsx(M,{label:"Tool Description (Optional)",htmlFor:"tool_description",error:p.tool_description,helpText:"Optional: A brief description of what this tool does. Overwrites the python function docs",children:i.jsx(Y,{id:"tool_description",name:"tool_description",value:a.tool_description||"",onChange:v,placeholder:"e.g., Fetch user profile data"})}),i.jsx(M,{label:"Component Module",htmlFor:"component_module",error:p.component_module,required:!0,children:i.jsx(Y,{id:"component_module",name:"component_module",value:a.component_module||"",onChange:v,placeholder:"e.g., my_agent.custom_tools"})}),i.jsx(M,{label:"Function Name",htmlFor:"function_name",error:p.function_name,required:!0,children:i.jsx(Y,{id:"function_name",name:"function_name",value:a.function_name||"",onChange:v,placeholder:"e.g., my_tool_function"})}),i.jsx(M,{label:"Component Base Path (Optional)",htmlFor:"component_base_path",error:p.component_base_path,helpText:"Base path for module resolution if not in PYTHONPATH.",children:i.jsx(Y,{id:"component_base_path",name:"component_base_path",value:a.component_base_path||"",onChange:v,placeholder:"e.g., src/plugins"})})]}),a.tool_type==="mcp"&&i.jsxs(i.Fragment,{children:[i.jsx(M,{label:"MCP Tool Name (Optional)",htmlFor:"tool_name",error:p.tool_name,helpText:"Name of the specific MCP tool (optional if using all tools from MCP server)",children:i.jsx(Y,{id:"tool_name",name:"tool_name",value:a.tool_name||"",onChange:v})}),i.jsx(M,{label:"Connection Parameters (JSON)",htmlFor:"connection_params_str",error:p.connection_params_str,helpText:'E.g., {"type": "stdio", "command": "cmd", "args":[]}',children:i.jsx("textarea",{id:"connection_params_str",name:"connection_params_str",rows:4,value:a.connection_params_str||"{}",onChange:v,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})}),i.jsx(M,{label:"Environment Variables (JSON, Optional)",htmlFor:"environment_variables_str",error:p.environment_variables_str,children:i.jsx("textarea",{id:"environment_variables_str",name:"environment_variables_str",rows:3,value:a.environment_variables_str||"{}",onChange:v,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})})]})]}),(c==="builtin-tool"||c==="custom")&&i.jsxs(i.Fragment,{children:[i.jsx(Ne,{id:"required_scopes",label:"Required Scopes (Optional)",values:a.required_scopes||[],onChange:b=>N("required_scopes",b),helpText:"Enter required OAuth scopes and press Add.",placeholder:"No scopes added yet.",inputPlaceholder:"e.g., read:profile"}),i.jsx(M,{label:"Tool Config (JSON, Optional)",htmlFor:"tool_config_str",error:p.tool_config_str,helpText:"Tool-specific configuration like API keys, model names etc.",children:i.jsx("textarea",{id:"tool_config_str",name:"tool_config_str",rows:3,value:a.tool_config_str||"{}",onChange:v,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm font-mono text-xs"})})]}),c!=="initial"&&i.jsxs("div",{className:"flex justify-end space-x-2 mt-6 pt-4 border-t",children:[i.jsx(J,{onClick:()=>o(!1),variant:"outline",children:"Cancel"}),i.jsx(J,{onClick:D,children:m?"Update Tool":"Add Tool"})]})]})}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[i.jsx(J,{type:"button",onClick:r,variant:"outline",children:"Previous"}),i.jsx(J,{type:"button",onClick:n,children:"Next"})]})]})},Qi=[{value:"ignore",label:"Ignore (Do not include artifacts in A2A messages)"},{value:"embed",label:"Embed (Include base64 artifact data in A2A messages)"},{value:"reference",label:"Reference (Include artifact fetch URI in A2A messages)"}],$i=({data:e,updateData:t,onNext:n,onPrevious:r})=>i.jsxs("div",{className:"space-y-6",children:[i.jsx(Ce,{children:"Configure various features and behaviors for your agent, such as built-in tools and how artifacts are handled."}),i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Built-in Tools & Features"}),i.jsx(M,{label:"Artifact Handling Mode",htmlFor:"artifact_handling_mode",helpText:"How artifacts created by this agent are represented in A2A messages.",children:i.jsx(re,{id:"artifact_handling_mode",name:"artifact_handling_mode",value:e.artifact_handling_mode||"ignore",onChange:s=>t({artifact_handling_mode:s.target.value}),options:Qi})}),i.jsxs("div",{className:"space-y-3 mt-4",children:[i.jsx(M,{label:"",htmlFor:"enable_embed_resolution",children:i.jsx(ye,{id:"enable_embed_resolution",checked:e.enable_embed_resolution===void 0?!0:!!e.enable_embed_resolution,onChange:s=>t({enable_embed_resolution:s}),label:"Enable Embed Resolution (for dynamic content like state, math in prompts)"})}),i.jsx(M,{label:"",htmlFor:"enable_artifact_content_instruction",children:i.jsx(ye,{id:"enable_artifact_content_instruction",checked:e.enable_artifact_content_instruction===void 0?!0:!!e.enable_artifact_content_instruction,onChange:s=>t({enable_artifact_content_instruction:s}),label:"Enable Artifact Content Instruction (for late-stage artifact content embedding)"})})]}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),i.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]}),Ki=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})}),Zi=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),es=({data:e,updateData:t,onNext:n,onPrevious:r})=>{const[s,l]=S.useState(!1),[o,a]=S.useState(null),[d,c]=S.useState(null),[u,m]=S.useState({}),[h,p]=S.useState(null);S.useEffect(()=>{s&&(o?(m(o),c(o.id)):(m({}),c(null)),p(null))},[o,s]);const _=y=>{const{name:j,value:b,type:I}=y.target,B=I==="checkbox"?y.target.checked:b;t({[j]:B})},w=y=>{const{name:j,value:b}=y.target;m(I=>({...I,[j]:b}))},C=()=>{if(!u.id||u.id.trim()===""||!u.name||u.name.trim()===""||!u.description||u.description.trim()===""){p("Skill ID, Name, and Description are required and cannot be empty.");return}p(null);const y=Array.isArray(e.agent_card_skills)?[...e.agent_card_skills]:[],j=u.id,b=y.findIndex(I=>I.id===j);if(o){if(d!==j&&b!==-1){p(`Skill ID "${j}" already exists. Please use a unique ID.`);return}const I=y.findIndex(B=>B.id===d);if(I!==-1)y[I]={...u};else{p("Error finding the original skill to update.");return}}else{if(b!==-1){p(`Skill ID "${j}" already exists. Please use a unique ID.`);return}y.push({...u})}t({agent_card_skills:y}),l(!1),a(null),c(null)},f=y=>{a(y),l(!0)},v=()=>{a(null),l(!0)},N=y=>{const j=Array.isArray(e.agent_card_skills)?e.agent_card_skills:[];t({agent_card_skills:j.filter(b=>b.id!==y)})},T=y=>{const{name:j,value:b}=y.target;t({[j]:b===""?void 0:Number(b)})},D="A helpful assistant capable of complex tasks.";return i.jsxs("div",{className:"space-y-6",children:[i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4",children:"Agent Card & Discovery"}),i.jsx(M,{label:"Agent Card Description",htmlFor:"agent_card_description",helpText:"A concise description of the agent's capabilities.",children:i.jsx("textarea",{id:"agent_card_description",name:"agent_card_description",rows:3,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",value:e.agent_card_description||D,onChange:_,placeholder:D})}),i.jsx(Ne,{id:"agent_card_default_input_modes",label:"Default Input Modes",values:e.agent_card_default_input_modes||[],onChange:y=>t({agent_card_default_input_modes:y}),helpText:"Enter input modes (e.g., text, file) and press Add.",placeholder:"No input modes added yet.",inputPlaceholder:"e.g., text"}),i.jsx(Ne,{id:"agent_card_default_output_modes",label:"Default Output Modes",values:e.agent_card_default_output_modes||[],onChange:y=>t({agent_card_default_output_modes:y}),helpText:"Enter output modes (e.g., text, file) and press Add.",placeholder:"No output modes added yet.",inputPlaceholder:"e.g., file"}),i.jsxs(M,{label:"Skills",htmlFor:"add_skill_button",children:[i.jsx("div",{className:"mb-2",children:i.jsx(J,{type:"button",variant:"outline",onClick:v,children:"Add New Skill"})}),e.agent_card_skills&&e.agent_card_skills.length>0?i.jsx("div",{className:"overflow-x-auto border rounded-md",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 text-sm",children:[i.jsx("thead",{className:"bg-gray-50",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"ID"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Name"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Description"}),i.jsx("th",{className:"px-3 py-2 text-left font-medium text-gray-500 tracking-wider",children:"Actions"})]})}),i.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.agent_card_skills.map(y=>i.jsxs("tr",{children:[i.jsx("td",{className:"px-3 py-2 whitespace-nowrap font-mono text-xs",children:y.id}),i.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:y.name}),i.jsx("td",{className:"px-3 py-2 break-words max-w-xs",children:y.description}),i.jsxs("td",{className:"px-3 py-2 whitespace-nowrap space-x-2",children:[i.jsx(J,{variant:"secondary",onClick:()=>f(y),"aria-label":"Edit skill",children:i.jsx(Ki,{})}),i.jsx(J,{variant:"secondary",onClick:()=>N(y.id),className:"text-red-600 hover:text-red-800","aria-label":"Delete skill",children:i.jsx(Zi,{})})]})]},y.id))})]})}):i.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"No skills defined yet."})]}),i.jsx("h3",{className:"text-xl font-semibold text-gray-800 border-b pb-2 mb-4 mt-8",children:"Discovery & Communication"}),i.jsx(M,{label:"Agent Card Publishing Interval (seconds)",htmlFor:"agent_card_publishing_interval",helpText:"Set to 0 to disable periodic publishing.",children:i.jsx(Y,{id:"agent_card_publishing_interval",name:"agent_card_publishing_interval",type:"number",value:e.agent_card_publishing_interval===void 0?"10":String(e.agent_card_publishing_interval),onChange:T,placeholder:"10"})}),i.jsx(M,{label:"",htmlFor:"agent_discovery_enabled",children:i.jsx(ye,{id:"agent_discovery_enabled",checked:e.agent_discovery_enabled===void 0?!1:!!e.agent_discovery_enabled,onChange:y=>t({agent_discovery_enabled:y}),label:"Enable Agent Discovery (allows this agent to find and delegate to peers)"})}),i.jsx(Ne,{id:"inter_agent_communication_allow_list",label:"Inter-Agent Allow List",values:e.inter_agent_communication_allow_list||[],onChange:y=>t({inter_agent_communication_allow_list:y}),helpText:"Agent name patterns to allow delegation to (e.g., *, SpecificAgent*).",placeholder:"No allow list patterns added.",inputPlaceholder:"e.g., *"}),i.jsx(Ne,{id:"inter_agent_communication_deny_list",label:"Inter-Agent Deny List",values:e.inter_agent_communication_deny_list||[],onChange:y=>t({inter_agent_communication_deny_list:y}),helpText:"Agent name patterns to deny delegation to.",placeholder:"No deny list patterns added.",inputPlaceholder:"e.g., RiskyAgent*"}),i.jsx(M,{label:"Inter-Agent Request Timeout (seconds)",htmlFor:"inter_agent_communication_timeout",children:i.jsx(Y,{id:"inter_agent_communication_timeout",name:"inter_agent_communication_timeout",type:"number",value:e.inter_agent_communication_timeout===void 0?"30":String(e.inter_agent_communication_timeout),onChange:T,placeholder:"30"})}),s&&i.jsx(Pr,{onClose:()=>{l(!1),a(null),c(null)},title:o?"Edit Skill":"Add New Skill",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(M,{label:"Skill ID (e.g., function_name)",htmlFor:"skill_id",required:!0,helpText:"Unique identifier for the skill.",children:i.jsx(Y,{id:"skill_id",name:"id",value:u.id||"",onChange:w,placeholder:"e.g., getWeather",disabled:!1})}),i.jsx(M,{label:"Skill Name (Display Name)",htmlFor:"skill_name",required:!0,children:i.jsx(Y,{id:"skill_name",name:"name",value:u.name||"",onChange:w,placeholder:"e.g., Data Analysis"})}),i.jsx(M,{label:"Skill Description",htmlFor:"skill_description",required:!0,children:i.jsx("textarea",{id:"skill_description",name:"description",rows:3,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",value:u.description||"",onChange:w,placeholder:"e.g., Can analyze CSV data and generate reports."})}),h&&i.jsx("p",{className:"text-sm text-red-600",children:h}),i.jsxs("div",{className:"flex justify-end space-x-2 pt-2",children:[i.jsx(J,{type:"button",variant:"secondary",onClick:()=>{l(!1),a(null),c(null)},children:"Cancel"}),i.jsx(J,{type:"button",onClick:C,children:o?"Update Skill":"Add Skill"})]})]})}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),i.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-white bg-solace-blue rounded-md shadow-sm hover:bg-solace-blue-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue",children:"Next"})]})]})},ts=({data:e,updateData:t,onPrevious:n,serverUrl:r=""})=>{const s=async()=>{console.log("Submitting agent configuration:",e);try{const l=JSON.parse(JSON.stringify(e));if(!Array.isArray(l.agent_card_skills)&&l.agent_card_skills_str)try{const c=JSON.parse(l.agent_card_skills_str);Array.isArray(c)?l.agent_card_skills=c:(console.warn("Parsed agent_card_skills_str was not an array, ensuring agent_card_skills is empty array."),l.agent_card_skills=[])}catch(c){console.warn("Could not parse agent_card_skills_str as JSON, ensuring agent_card_skills is empty array.",c),l.agent_card_skills=[]}else Array.isArray(l.agent_card_skills)||(l.agent_card_skills=[]);delete l.agent_card_skills_str,Array.isArray(l.tools)&&(l.tools=l.tools.map(c=>{const u={};return c.tool_type&&(u.tool_type=c.tool_type),c.tool_name&&(u.tool_name=c.tool_name),c.tool_description&&(u.tool_description=c.tool_description),c.group_name&&(u.group_name=c.group_name),c.component_module&&(u.component_module=c.component_module),c.function_name&&(u.function_name=c.function_name),c.component_base_path&&(u.component_base_path=c.component_base_path),c.connection_params&&(u.connection_params=c.connection_params),c.environment_variables&&(u.environment_variables=c.environment_variables),c.required_scopes&&c.required_scopes.length>0&&(u.required_scopes=c.required_scopes),c.tool_config&&(u.tool_config=c.tool_config),u.tool_type?u:(console.error("Tool is missing tool_type:",c),null)}).filter(c=>c!==null));const o={agent_name_input:e.agent_name,config:l},a=await fetch(`${r}/api/save_agent_config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),d=await a.json();a.ok&&d.status==="success"?(setTimeout(async()=>{try{await fetch(`${r}/api/shutdown`,{method:"POST"})}catch{}},200),t&&t({showSuccessScreen_agent:!0})):alert(`Error saving agent: ${d.message||"Unknown error"}`)}catch(l){alert(`Failed to save agent: ${l instanceof Error?l.message:String(l)}`)}};return i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Review and Submit Agent Configuration"}),i.jsx("pre",{className:"bg-gray-100 p-3 rounded overflow-x-auto text-xs max-h-96",children:JSON.stringify(e,null,2)}),i.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[i.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-solace-blue-dark",children:"Previous"}),i.jsx("button",{onClick:s,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500",children:"Save Agent & Finish"})]})]})},at=[{id:"agent-basic",title:"Basic Info",description:"Name, model, instruction",component:Hi},{id:"agent-services",title:"Services",description:"Session & artifact services",component:Yi},{id:"agent-features",title:"Features",description:"Enable built-in features",component:$i},{id:"agent-tools",title:"Custom Tools",description:"Define custom tools for the agent",component:Xi},{id:"agent-card",title:"Agent Card & Comms",description:"Discovery and communication settings",component:es},{id:"agent-review",title:"Review & Submit",description:"Review and save configuration",component:ts}];function ns(){var w;const[e,t]=S.useState(0),[n,r]=S.useState({}),[s,l]=S.useState(!0),[o,a]=S.useState(null),[d,c]=S.useState([]),u="";S.useEffect(()=>{Promise.all([fetch("/api/form_schema?type=agent"),fetch("/api/available_tools")]).then(async([C,f])=>{if(!C.ok)throw new Error(`Failed to fetch agent form schema (status: ${C.status})`);if(!f.ok)throw new Error(`Failed to fetch available tools (status: ${f.status})`);const v=await C.json(),N=await f.json();if((v==null?void 0:v.status)!=="success"||!(v!=null&&v.defaults))throw new Error((v==null?void 0:v.message)||"Invalid response for agent form schema");if((N==null?void 0:N.status)!=="success")throw new Error((N==null?void 0:N.message)||"Invalid response for available tools");c(N);const T=v.defaults,D={...T,agent_card_default_input_modes:(T.agent_card_default_input_modes_str||"text").split(",").map(y=>y.trim()).filter(Boolean),agent_card_default_output_modes:(T.agent_card_default_output_modes_str||"text,file").split(",").map(y=>y.trim()).filter(Boolean),inter_agent_communication_allow_list:(T.inter_agent_communication_allow_list_str||"*").split(",").map(y=>y.trim()).filter(Boolean),inter_agent_communication_deny_list:(T.inter_agent_communication_deny_list_str||"").split(",").map(y=>y.trim()).filter(Boolean),agent_card_skills_str:T.agent_card_skills_str||"[]",agent_card_skills:[],tools:Array.isArray(T.tools)?T.tools:[],showSuccessScreen_agent:!1};delete D.agent_card_default_input_modes_str,delete D.agent_card_default_output_modes_str,delete D.inter_agent_communication_allow_list_str,delete D.inter_agent_communication_deny_list_str;try{const y=JSON.parse(D.agent_card_skills_str||"[]");Array.isArray(y)&&(D.agent_card_skills=y.filter(j=>typeof j=="object"&&j!==null&&"id"in j&&typeof j.id=="string"&&"name"in j&&typeof j.name=="string"&&"description"in j&&typeof j.description=="string"))}catch(y){console.warn("Could not parse agent_card_skills_str from defaults:",y),D.agent_card_skills=[]}r(D)}).catch(C=>{console.error("Error fetching initial data:",C),a(`Failed to load agent configuration form: ${C instanceof Error?C.message:String(C)}`)}).finally(()=>l(!1))},[]);const m=S.useCallback(C=>{r(f=>({...f,...C}))},[]);S.useEffect(()=>{if(s)return;const C=[];C.push({id:"default-artifact-management",tool_type:"builtin-group",group_name:"artifact_management"}),m({tools:C})},[m,s]);const h=S.useCallback(()=>{e<at.length-1&&t(C=>C+1)},[e]),p=S.useCallback(()=>{e>0&&t(C=>C-1)},[e]);if(s)return i.jsx("div",{className:"text-center p-10",children:"Loading agent configuration form..."});if(o)return i.jsx("div",{className:"text-center p-10 text-red-600",children:i.jsxs("p",{children:["Error: ",o]})});if(n.showSuccessScreen_agent){let C="Agent Configured Successfully!";return n.agent_name&&(C=`Agent "${n.agent_name}" configured successfully!`),i.jsx("div",{className:"max-w-2xl mx-auto p-6",children:i.jsx(sn,{title:C,message:"Your new agent configuration has been saved.",initTab:"tutorials"})})}const _=(w=at[e])==null?void 0:w.component;return _?i.jsxs("div",{className:"max-w-2xl mx-auto p-4",children:[i.jsx("h2",{className:"text-2xl font-bold mb-6 text-center text-solace-purple",children:"Add New Agent"}),at.length>1&&i.jsx("div",{className:"mb-8",children:i.jsx(rn,{steps:at,currentStepIndex:e})}),i.jsx("div",{className:"bg-white rounded-lg shadow-xl p-6 min-h-[500px]",children:i.jsx(_,{data:n,updateData:m,onNext:h,onPrevious:p,serverUrl:u,availableTools:d})})]}):i.jsxs("div",{className:"text-center p-10 text-red-600",children:["Error: Configuration step not found for index ",e,"."]})}var Tr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},jn=Fe.createContext&&Fe.createContext(Tr),rs=["attr","size","title"];function is(e,t){if(e==null)return{};var n=ss(e,t),r,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)r=l[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ss(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ft(){return ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ft.apply(this,arguments)}function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sn(Object(n),!0).forEach(function(r){ls(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ls(e,t,n){return t=os(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function os(e){var t=as(e,"string");return typeof t=="symbol"?t:t+""}function as(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fr(e){return e&&e.map((t,n)=>Fe.createElement(t.tag,gt({key:n},t.attr),Fr(t.child)))}function qe(e){return t=>Fe.createElement(cs,ft({attr:gt({},e.attr)},t),Fr(e.child))}function cs(e){var t=n=>{var{attr:r,size:s,title:l}=e,o=is(e,rs),a=s||n.size||"1em",d;return n.className&&(d=n.className),e.className&&(d=(d?d+" ":"")+e.className),Fe.createElement("svg",ft({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:d,style:gt(gt({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&Fe.createElement("title",null,l),e.children)};return jn!==void 0?Fe.createElement(jn.Consumer,null,n=>t(n)):t(Tr)}function us(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"},child:[]},{tag:"polyline",attr:{points:"3.27 6.96 12 12.01 20.73 6.96"},child:[]},{tag:"line",attr:{x1:"12",y1:"22.08",x2:"12",y2:"12"},child:[]}]})(e)}function ds(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},child:[]},{tag:"polyline",attr:{points:"22 4 12 14.01 9 11.01"},child:[]}]})(e)}function ms(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"},child:[]},{tag:"rect",attr:{x:"9",y:"9",width:"6",height:"6"},child:[]},{tag:"line",attr:{x1:"9",y1:"1",x2:"9",y2:"4"},child:[]},{tag:"line",attr:{x1:"15",y1:"1",x2:"15",y2:"4"},child:[]},{tag:"line",attr:{x1:"9",y1:"20",x2:"9",y2:"23"},child:[]},{tag:"line",attr:{x1:"15",y1:"20",x2:"15",y2:"23"},child:[]},{tag:"line",attr:{x1:"20",y1:"9",x2:"23",y2:"9"},child:[]},{tag:"line",attr:{x1:"20",y1:"14",x2:"23",y2:"14"},child:[]},{tag:"line",attr:{x1:"1",y1:"9",x2:"4",y2:"9"},child:[]},{tag:"line",attr:{x1:"1",y1:"14",x2:"4",y2:"14"},child:[]}]})(e)}function ps(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"18",cy:"18",r:"3"},child:[]},{tag:"circle",attr:{cx:"6",cy:"6",r:"3"},child:[]},{tag:"path",attr:{d:"M6 21V9a9 9 0 0 0 9 9"},child:[]}]})(e)}function hs(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"2",y:"2",width:"20",height:"8",rx:"2",ry:"2"},child:[]},{tag:"rect",attr:{x:"2",y:"14",width:"20",height:"8",rx:"2",ry:"2"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"6.01",y2:"6"},child:[]},{tag:"line",attr:{x1:"6",y1:"18",x2:"6.01",y2:"18"},child:[]}]})(e)}function fs(e){return qe({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"},child:[]},{tag:"line",attr:{x1:"7",y1:"7",x2:"7.01",y2:"7"},child:[]}]})(e)}const Nn=({variant:e="secondary",className:t,children:n,...r})=>i.jsx("button",{...r,className:`px-3 py-1.5 text-xs rounded font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ${e==="primary"?"bg-green-500 hover:bg-green-600 text-white dark:bg-green-600 dark:hover:bg-green-700":"bg-gray-200 hover:bg-gray-300 text-gray-700 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-200"} ${t||""}`,children:n}),Cn=({label:e,value:t,icon:n})=>t==null||typeof t=="string"&&!t.trim()?null:i.jsxs("div",{className:"flex items-center text-xs mb-1",children:[i.jsxs("div",{className:"flex items-center font-medium text-gray-500 dark:text-gray-400 w-20 flex-shrink-0",children:[n&&i.jsx("span",{className:"mr-1.5",children:n}),e,":"]}),i.jsx("div",{className:"text-gray-700 dark:text-gray-200 truncate",title:t,children:t})]}),gs=({plugin:e,onReadMore:t,onInstall:n})=>{const r=e.pyproject.description||"No description available.",s=l=>{switch(l==null?void 0:l.toLowerCase()){case"agent":return i.jsx(ms,{size:12});case"gateway":return i.jsx(hs,{size:12});default:return i.jsx(fs,{size:12})}};return i.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-xl rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden flex flex-col h-[280px]",children:[i.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700",children:[i.jsxs("div",{className:"flex items-center min-w-0",children:[i.jsx(us,{className:"w-5 h-5 text-blue-500 dark:text-blue-400 mr-2 flex-shrink-0"}),i.jsx("h2",{className:"text-md font-semibold text-gray-800 dark:text-gray-100 truncate",title:e.pyproject.name,children:e.pyproject.name})]}),e.is_official&&i.jsx("span",{title:"Verified Official Plugin",className:"ml-2 flex-shrink-0",children:i.jsx(ds,{className:"w-4 h-4 text-green-500 dark:text-green-400"})})]}),i.jsxs("div",{className:"p-3 space-y-2 overflow-y-auto flex-grow scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-gray-100 dark:scrollbar-track-gray-700",children:[i.jsx(Cn,{label:"Version",value:e.pyproject.version,icon:i.jsx(ps,{size:12})}),i.jsx(Cn,{label:"Type",value:e.pyproject.plugin_type||"custom",icon:s(e.pyproject.plugin_type)}),i.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 line-clamp-3",title:r,children:r})]}),i.jsxs("div",{className:"flex justify-end space-x-2 p-2 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700",children:[i.jsx(Nn,{onClick:t,variant:"secondary",children:"More"}),i.jsx(Nn,{onClick:n,variant:"primary",children:"Install"})]})]})};function xs(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ys=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bs=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_s={};function An(e,t){return(_s.jsx?bs:ys).test(e)}const vs=/[ \t\n\f\r]/g;function ws(e){return typeof e=="object"?e.type==="text"?En(e.value):!1:En(e)}function En(e){return e.replace(vs,"")===""}class tt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}tt.prototype.normal={};tt.prototype.property={};tt.prototype.space=void 0;function Mr(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new tt(n,r,t)}function Gt(e){return e.toLowerCase()}class de{constructor(t,n){this.attribute=n,this.property=t}}de.prototype.attribute="";de.prototype.booleanish=!1;de.prototype.boolean=!1;de.prototype.commaOrSpaceSeparated=!1;de.prototype.commaSeparated=!1;de.prototype.defined=!1;de.prototype.mustUseProperty=!1;de.prototype.number=!1;de.prototype.overloadedBoolean=!1;de.prototype.property="";de.prototype.spaceSeparated=!1;de.prototype.space=void 0;let ks=0;const W=Me(),ne=Me(),Jt=Me(),E=Me(),$=Me(),De=Me(),he=Me();function Me(){return 2**++ks}const Yt=Object.freeze(Object.defineProperty({__proto__:null,boolean:W,booleanish:ne,commaOrSpaceSeparated:he,commaSeparated:De,number:E,overloadedBoolean:Jt,spaceSeparated:$},Symbol.toStringTag,{value:"Module"})),Ft=Object.keys(Yt);class ln extends de{constructor(t,n,r,s){let l=-1;if(super(t,n),In(this,"space",s),typeof r=="number")for(;++l<Ft.length;){const o=Ft[l];In(this,Ft[l],(r&Yt[o])===Yt[o])}}}ln.prototype.defined=!0;function In(e,t,n){n&&(e[t]=n)}function Ue(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const l=new ln(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Gt(r)]=r,n[Gt(l.attribute)]=r}return new tt(t,n,e.space)}const Lr=Ue({properties:{ariaActiveDescendant:null,ariaAtomic:ne,ariaAutoComplete:null,ariaBusy:ne,ariaChecked:ne,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:$,ariaCurrent:null,ariaDescribedBy:$,ariaDetails:null,ariaDisabled:ne,ariaDropEffect:$,ariaErrorMessage:null,ariaExpanded:ne,ariaFlowTo:$,ariaGrabbed:ne,ariaHasPopup:null,ariaHidden:ne,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$,ariaLevel:E,ariaLive:null,ariaModal:ne,ariaMultiLine:ne,ariaMultiSelectable:ne,ariaOrientation:null,ariaOwns:$,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:ne,ariaReadOnly:ne,ariaRelevant:null,ariaRequired:ne,ariaRoleDescription:$,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:ne,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Rr(e,t){return t in e?e[t]:t}function Or(e,t){return Rr(e,t.toLowerCase())}const js=Ue({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:De,acceptCharset:$,accessKey:$,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:$,autoFocus:W,autoPlay:W,blocking:$,capture:null,charSet:null,checked:W,cite:null,className:$,cols:E,colSpan:null,content:null,contentEditable:ne,controls:W,controlsList:$,coords:E|De,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Jt,draggable:ne,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:$,height:E,hidden:Jt,high:E,href:null,hrefLang:null,htmlFor:$,httpEquiv:$,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:$,itemRef:$,itemScope:W,itemType:$,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:E,pattern:null,ping:$,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:$,required:W,reversed:W,rows:E,rowSpan:E,sandbox:$,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:ne,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:ne,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:ne,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:Or}),Ss=Ue({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:he,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:$,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:De,g2:De,glyphName:De,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:he,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:E,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:he,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:he,rev:he,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:he,requiredFeatures:he,requiredFonts:he,requiredFormats:he,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:he,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:he,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:he,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Rr}),zr=Ue({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Dr=Ue({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Or}),Br=Ue({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Ns={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Cs=/[A-Z]/g,Pn=/-[a-z]/g,As=/^data[-\w.:]+$/i;function Es(e,t){const n=Gt(t);let r=t,s=de;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&As.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Pn,Ps);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Pn.test(l)){let o=l.replace(Cs,Is);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=ln}return new s(r,t)}function Is(e){return"-"+e.toLowerCase()}function Ps(e){return e.charAt(1).toUpperCase()}const Ts=Mr([Lr,js,zr,Dr,Br],"html"),on=Mr([Lr,Ss,zr,Dr,Br],"svg");function Fs(e){return e.join(" ").trim()}var Oe={},Mt,Tn;function Ms(){if(Tn)return Mt;Tn=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,d=`
`,c="/",u="*",m="",h="comment",p="declaration";Mt=function(w,C){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];C=C||{};var f=1,v=1;function N(z){var R=z.match(t);R&&(f+=R.length);var U=z.lastIndexOf(d);v=~U?z.length-U:v+z.length}function T(){var z={line:f,column:v};return function(R){return R.position=new D(z),b(),R}}function D(z){this.start=z,this.end={line:f,column:v},this.source=C.source}D.prototype.content=w;function y(z){var R=new Error(C.source+":"+f+":"+v+": "+z);if(R.reason=z,R.filename=C.source,R.line=f,R.column=v,R.source=w,!C.silent)throw R}function j(z){var R=z.exec(w);if(R){var U=R[0];return N(U),w=w.slice(U.length),R}}function b(){j(n)}function I(z){var R;for(z=z||[];R=B();)R!==!1&&z.push(R);return z}function B(){var z=T();if(!(c!=w.charAt(0)||u!=w.charAt(1))){for(var R=2;m!=w.charAt(R)&&(u!=w.charAt(R)||c!=w.charAt(R+1));)++R;if(R+=2,m===w.charAt(R-1))return y("End of comment missing");var U=w.slice(2,R-2);return v+=2,N(U),w=w.slice(R),v+=2,z({type:h,comment:U})}}function F(){var z=T(),R=j(r);if(R){if(B(),!j(s))return y("property missing ':'");var U=j(l),Z=z({type:p,property:_(R[0].replace(e,m)),value:U?_(U[0].replace(e,m)):m});return j(o),Z}}function L(){var z=[];I(z);for(var R;R=F();)R!==!1&&(z.push(R),I(z));return z}return b(),L()};function _(w){return w?w.replace(a,m):m}return Mt}var Fn;function Ls(){if(Fn)return Oe;Fn=1;var e=Oe&&Oe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.default=n;var t=e(Ms());function n(r,s){var l=null;if(!r||typeof r!="string")return l;var o=(0,t.default)(r),a=typeof s=="function";return o.forEach(function(d){if(d.type==="declaration"){var c=d.property,u=d.value;a?s(c,u,d):u&&(l=l||{},l[c]=u)}}),l}return Oe}var Ge={},Mn;function Rs(){if(Mn)return Ge;Mn=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(c){return!c||n.test(c)||e.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},d=function(c,u){return u===void 0&&(u={}),l(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,a):c=c.replace(r,a),c.replace(t,o))};return Ge.camelCase=d,Ge}var Je,Ln;function Os(){if(Ln)return Je;Ln=1;var e=Je&&Je.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Ls()),n=Rs();function r(s,l){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(a,d){a&&d&&(o[(0,n.camelCase)(a,l)]=d)}),o}return r.default=r,Je=r,Je}var zs=Os();const Ds=wr(zs),Bs=qs("start");function qs(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Us(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rn(e.position):"start"in e||"end"in e?Rn(e):"line"in e||"column"in e?Xt(e):""}function Xt(e){return On(e&&e.line)+":"+On(e&&e.column)}function Rn(e){return Xt(e&&e.start)+"-"+Xt(e&&e.end)}function On(e){return e&&typeof e=="number"?e:1}let le=class extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(o=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?l.ruleId=r:(l.source=r.slice(0,d),l.ruleId=r.slice(d+1))}if(!l.place&&l.ancestors&&l.ancestors){const d=l.ancestors[l.ancestors.length-1];d&&(l.place=d.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=a?a.line:void 0,this.name=Us(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual,this.expected,this.note,this.url}};le.prototype.file="";le.prototype.name="";le.prototype.reason="";le.prototype.message="";le.prototype.stack="";le.prototype.column=void 0;le.prototype.line=void 0;le.prototype.ancestors=void 0;le.prototype.cause=void 0;le.prototype.fatal=void 0;le.prototype.place=void 0;le.prototype.ruleId=void 0;le.prototype.source=void 0;const an={}.hasOwnProperty,Hs=new Map,Vs=/[A-Z]/g,Ws=new Set(["table","tbody","thead","tfoot","tr"]),Gs=new Set(["td","th"]),qr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Js(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=tl(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=el(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?on:Ts,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=Ur(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function Ur(e,t,n){if(t.type==="element")return Ys(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Xs(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $s(e,t,n);if(t.type==="mdxjsEsm")return Qs(e,t);if(t.type==="root")return Ks(e,t,n);if(t.type==="text")return Zs(e,t)}function Ys(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=on,e.schema=s),e.ancestors.push(t);const l=Vr(e,t.tagName,!1),o=nl(e,t);let a=un(e,t);return Ws.has(t.tagName)&&(a=a.filter(function(d){return typeof d=="string"?!ws(d):!0})),Hr(e,o,l,t),cn(o,a),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function Xs(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}et(e,t.position)}function Qs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);et(e,t.position)}function $s(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=on,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:Vr(e,t.name,!0),o=rl(e,t),a=un(e,t);return Hr(e,o,l,t),cn(o,a),e.ancestors.pop(),e.schema=r,e.create(t,l,o,n)}function Ks(e,t,n){const r={};return cn(r,un(e,t)),e.create(t,e.Fragment,r,n)}function Zs(e,t){return t.value}function Hr(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function el(e,t,n){return r;function r(s,l,o,a){const c=Array.isArray(o.children)?n:t;return a?c(l,o,a):c(l,o)}}function tl(e,t){return n;function n(r,s,l,o){const a=Array.isArray(l.children),d=Bs(r);return t(s,l,o,a,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function nl(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&an.call(t.properties,s)){const l=il(e,s,t.properties[s]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Gs.has(t.tagName)?r=a:n[o]=a}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function rl(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else et(e,t.position);else{const s=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else et(e,t.position);else l=r.value===null?!0:r.value;n[s]=l}return n}function un(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Hs;for(;++r<t.children.length;){const l=t.children[r];let o;if(e.passKeys){const d=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(d){const c=s.get(d)||0;o=d+"-"+c,s.set(d,c+1)}}const a=Ur(e,l,o);a!==void 0&&n.push(a)}return n}function il(e,t,n){const r=Es(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?xs(n):Fs(n)),r.property==="style"){let s=typeof n=="object"?n:sl(e,String(n));return e.stylePropertyNameCase==="css"&&(s=ll(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?Ns[r.property]||r.property:r.attribute,n]}}function sl(e,t){try{return Ds(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new le("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=qr+"#cannot-parse-style-attribute",s}}function Vr(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,o;for(;++l<s.length;){const a=An(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}r=o}else r=An(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return an.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);et(e)}function et(e,t){const n=new le("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=qr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ll(e){const t={};let n;for(n in e)an.call(e,n)&&(t[ol(n)]=e[n]);return t}function ol(e){let t=e.replace(Vs,al);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function al(e){return"-"+e.toLowerCase()}const Lt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},cl={};function ul(e,t){const n=cl,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wr(e,r,s)}function Wr(e,t,n){if(dl(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zn(e.children,t,n)}return Array.isArray(e)?zn(e,t,n):""}function zn(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=Wr(e[s],t,n);return r.join("")}function dl(e){return!!(e&&typeof e=="object")}const Dn=document.createElement("i");function dn(e){const t="&"+e+";";Dn.innerHTML=t;const n=Dn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ve(e,t,n,r){const s=e.length;let l=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);l<r.length;)o=r.slice(l,l+1e4),o.unshift(t,0),e.splice(...o),l+=1e4,t+=1e4}function ge(e,t){return e.length>0?(ve(e,e.length,0,t),e):t}const Bn={}.hasOwnProperty;function ml(e){const t={};let n=-1;for(;++n<e.length;)pl(t,e[n]);return t}function pl(e,t){let n;for(n in t){const s=(Bn.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let o;if(l)for(o in l){Bn.call(s,o)||(s[o]=[]);const a=l[o];hl(s[o],Array.isArray(a)?a:a?[a]:[])}}}function hl(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ve(e,0,0,r)}function Gr(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Be(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _e=Pe(/[A-Za-z]/),fe=Pe(/[\dA-Za-z]/),fl=Pe(/[#-'*+\--9=?A-Z^-~]/);function Qt(e){return e!==null&&(e<32||e===127)}const $t=Pe(/\d/),gl=Pe(/[\dA-Fa-f]/),xl=Pe(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function ue(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}const yl=Pe(new RegExp("\\p{P}|\\p{S}","u")),bl=Pe(/\s/);function Pe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let o="";if(l===37&&fe(e.charCodeAt(n+1))&&fe(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(n+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),s=1):o="�"}else o=String.fromCharCode(l);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function K(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(d){return Q(d)?(e.enter(n),a(d)):t(d)}function a(d){return Q(d)&&l++<s?(e.consume(d),a):(e.exit(n),t(d))}}const _l={tokenize:vl};function vl(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),K(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),l(a)}function l(a){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return H(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}const wl={tokenize:kl},qn={tokenize:jl};function kl(e){const t=this,n=[];let r=0,s,l,o;return a;function a(N){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,d,c)(N)}return c(N)}function d(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const T=t.events.length;let D=T,y;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){y=t.events[D][1].end;break}f(r);let j=T;for(;j<t.events.length;)t.events[j][1].end={...y},j++;return ve(t.events,D+1,0,t.events.slice(T)),t.events.length=j,c(N)}return a(N)}function c(N){if(r===n.length){if(!s)return h(N);if(s.currentConstruct&&s.currentConstruct.concrete)return _(N);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qn,u,m)(N)}function u(N){return s&&v(),f(r),h(N)}function m(N){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,_(N)}function h(N){return t.containerState={},e.attempt(qn,p,_)(N)}function p(N){return r++,n.push([t.currentConstruct,t.containerState]),h(N)}function _(N){if(N===null){s&&v(),f(0),e.consume(N);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),w(N)}function w(N){if(N===null){C(e.exit("chunkFlow"),!0),f(0),e.consume(N);return}return H(N)?(e.consume(N),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(N),w)}function C(N,T){const D=t.sliceStream(N);if(T&&D.push(null),N.previous=l,l&&(l.next=N),l=N,s.defineSkip(N.start),s.write(D),t.parser.lazy[N.start.line]){let y=s.events.length;for(;y--;)if(s.events[y][1].start.offset<o&&(!s.events[y][1].end||s.events[y][1].end.offset>o))return;const j=t.events.length;let b=j,I,B;for(;b--;)if(t.events[b][0]==="exit"&&t.events[b][1].type==="chunkFlow"){if(I){B=t.events[b][1].end;break}I=!0}for(f(r),y=j;y<t.events.length;)t.events[y][1].end={...B},y++;ve(t.events,b+1,0,t.events.slice(j)),t.events.length=y}}function f(N){let T=n.length;for(;T-- >N;){const D=n[T];t.containerState=D[1],D[0].exit.call(t,e)}n.length=N}function v(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function jl(e,t,n){return K(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Un(e){if(e===null||ue(e)||bl(e))return 1;if(yl(e))return 2}function mn(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Kt={name:"attention",resolveAll:Sl,tokenize:Nl};function Sl(e,t){let n=-1,r,s,l,o,a,d,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},h={...e[n][1].start};Hn(m,-d),Hn(h,d),o={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},a={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},l={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ge(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=ge(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",l,t]]),c=ge(c,mn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=ge(c,[["exit",l,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=ge(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,ve(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Nl(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Un(r);let l;return o;function o(d){return l=d,e.enter("attentionSequence"),a(d)}function a(d){if(d===l)return e.consume(d),a;const c=e.exit("attentionSequence"),u=Un(d),m=!u||u===2&&s||n.includes(d),h=!s||s===2&&u||n.includes(r);return c._open=!!(l===42?m:m&&(s||!h)),c._close=!!(l===42?h:h&&(u||!m)),t(d)}}function Hn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Cl={name:"autolink",tokenize:Al};function Al(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(p){return _e(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||fe(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,d):(p===43||p===45||p===46||fe(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function d(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Qt(p)?n(p):(e.consume(p),d)}function c(p){return p===64?(e.consume(p),u):fl(p)?(e.consume(p),c):n(p)}function u(p){return fe(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||fe(p))&&r++<63){const _=p===45?h:m;return e.consume(p),_}return n(p)}}const bt={partial:!0,tokenize:El};function El(e,t,n){return r;function r(l){return Q(l)?K(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||H(l)?t(l):n(l)}}const Jr={continuation:{tokenize:Pl},exit:Tl,name:"blockQuote",tokenize:Il};function Il(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return n(o)}function l(o){return Q(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Pl(e,t,n){const r=this;return s;function s(o){return Q(o)?K(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(Jr,t,n)(o)}}function Tl(e){e.exit("blockQuote")}const Yr={name:"characterEscape",tokenize:Fl};function Fl(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return xl(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const Xr={name:"characterReference",tokenize:Ml};function Ml(e,t,n){const r=this;let s=0,l,o;return a;function a(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),l=31,o=fe,u(m))}function c(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=gl,u):(e.enter("characterReferenceValue"),l=7,o=$t,u(m))}function u(m){if(m===59&&s){const h=e.exit("characterReferenceValue");return o===fe&&!dn(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&s++<l?(e.consume(m),u):n(m)}}const Vn={partial:!0,tokenize:Rl},Wn={concrete:!0,name:"codeFenced",tokenize:Ll};function Ll(e,t,n){const r=this,s={partial:!0,tokenize:D};let l=0,o=0,a;return d;function d(y){return c(y)}function c(y){const j=r.events[r.events.length-1];return l=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,a=y,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(y)}function u(y){return y===a?(o++,e.consume(y),u):o<3?n(y):(e.exit("codeFencedFenceSequence"),Q(y)?K(e,m,"whitespace")(y):m(y))}function m(y){return y===null||H(y)?(e.exit("codeFencedFence"),r.interrupt?t(y):e.check(Vn,w,T)(y)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||H(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(y)):Q(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),K(e,p,"whitespace")(y)):y===96&&y===a?n(y):(e.consume(y),h)}function p(y){return y===null||H(y)?m(y):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||H(y)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(y)):y===96&&y===a?n(y):(e.consume(y),_)}function w(y){return e.attempt(s,T,C)(y)}function C(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),f}function f(y){return l>0&&Q(y)?K(e,v,"linePrefix",l+1)(y):v(y)}function v(y){return y===null||H(y)?e.check(Vn,w,T)(y):(e.enter("codeFlowValue"),N(y))}function N(y){return y===null||H(y)?(e.exit("codeFlowValue"),v(y)):(e.consume(y),N)}function T(y){return e.exit("codeFenced"),t(y)}function D(y,j,b){let I=0;return B;function B(U){return y.enter("lineEnding"),y.consume(U),y.exit("lineEnding"),F}function F(U){return y.enter("codeFencedFence"),Q(U)?K(y,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):L(U)}function L(U){return U===a?(y.enter("codeFencedFenceSequence"),z(U)):b(U)}function z(U){return U===a?(I++,y.consume(U),z):I>=o?(y.exit("codeFencedFenceSequence"),Q(U)?K(y,R,"whitespace")(U):R(U)):b(U)}function R(U){return U===null||H(U)?(y.exit("codeFencedFence"),j(U)):b(U)}}}function Rl(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Rt={name:"codeIndented",tokenize:zl},Ol={partial:!0,tokenize:Dl};function zl(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),K(e,l,"linePrefix",5)(c)}function l(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?d(c):H(c)?e.attempt(Ol,o,d)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||H(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function d(c){return e.exit("codeIndented"),t(c)}}function Dl(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):K(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):H(o)?s(o):n(o)}}const Bl={name:"codeText",previous:Ul,resolve:ql,tokenize:Hl};function ql(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Ul(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Hl(e,t,n){let r=0,s,l;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),a(m)}function a(m){return m===96?(e.consume(m),r++,a):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(l=e.enter("codeTextSequence"),s=0,u(m)):H(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),c(m))}function c(m){return m===null||m===32||m===96||H(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),c)}function u(m){return m===96?(e.consume(m),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",c(m))}}class Vl{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Ye(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ye(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ye(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ye(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ye(this.left,n.reverse())}}}function Ye(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Qr(e){const t={};let n=-1,r,s,l,o,a,d,c;const u=new Vl(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,l=0,l<d.length&&d[l][1].type==="lineEndingBlank"&&(l+=2),l<d.length&&d[l][1].type==="content"))for(;++l<d.length&&d[l][1].type!=="content";)d[l][1].type==="chunkText"&&(d[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Wl(u,n)),n=t[n],c=!0);else if(r[1]._container){for(l=n,s=void 0;l--;)if(o=u.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return ve(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Wl(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const l=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,d=[],c={};let u,m,h=-1,p=n,_=0,w=0;const C=[w];for(;p;){for(;e.get(++s)[1]!==p;);l.push(s),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),m&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(w=h+1,C.push(w),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),h=C.length;h--;){const f=a.slice(C[h],C[h+1]),v=l.pop();d.push([v,v+f.length-1]),e.splice(v,2,f)}for(d.reverse(),h=-1;++h<d.length;)c[_+d[h][0]]=_+d[h][1],_+=d[h][1]-d[h][0]-1;return c}const Gl={resolve:Yl,tokenize:Xl},Jl={partial:!0,tokenize:Ql};function Yl(e){return Qr(e),e}function Xl(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?l(a):H(a)?e.check(Jl,o,l)(a):(e.consume(a),s)}function l(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Ql(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),K(e,l,"linePrefix")}function l(o){if(o===null||H(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function $r(e,t,n,r,s,l,o,a,d){const c=d||Number.POSITIVE_INFINITY;let u=0;return m;function m(f){return f===60?(e.enter(r),e.enter(s),e.enter(l),e.consume(f),e.exit(l),h):f===null||f===32||f===41||Qt(f)?n(f):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),w(f))}function h(f){return f===62?(e.enter(l),e.consume(f),e.exit(l),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===62?(e.exit("chunkString"),e.exit(a),h(f)):f===null||f===60||H(f)?n(f):(e.consume(f),f===92?_:p)}function _(f){return f===60||f===62||f===92?(e.consume(f),p):p(f)}function w(f){return!u&&(f===null||f===41||ue(f))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(f)):u<c&&f===40?(e.consume(f),u++,w):f===41?(e.consume(f),u--,w):f===null||f===32||f===40||Qt(f)?n(f):(e.consume(f),f===92?C:w)}function C(f){return f===40||f===41||f===92?(e.consume(f),w):w(f)}}function Kr(e,t,n,r,s,l){const o=this;let a=0,d;return c;function c(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(l),u}function u(p){return a>999||p===null||p===91||p===93&&!d||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(l),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||H(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),d||(d=!Q(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,m):m(p)}}function Zr(e,t,n,r,s,l){let o;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,d):n(h)}function d(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(l),c(h))}function c(h){return h===o?(e.exit(l),d(o)):h===null?n(h):H(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),K(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||H(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?m:u)}function m(h){return h===o||h===92?(e.consume(h),u):u(h)}}function $e(e,t){let n;return r;function r(s){return H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Q(s)?K(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const $l={name:"definition",tokenize:Zl},Kl={partial:!0,tokenize:eo};function Zl(e,t,n){const r=this;let s;return l;function l(p){return e.enter("definition"),o(p)}function o(p){return Kr.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=Be(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),d):n(p)}function d(p){return ue(p)?$e(e,c)(p):c(p)}function c(p){return $r(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Kl,m,m)(p)}function m(p){return Q(p)?K(e,h,"whitespace")(p):h(p)}function h(p){return p===null||H(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function eo(e,t,n){return r;function r(a){return ue(a)?$e(e,s)(a):n(a)}function s(a){return Zr(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return Q(a)?K(e,o,"whitespace")(a):o(a)}function o(a){return a===null||H(a)?t(a):n(a)}}const to={name:"hardBreakEscape",tokenize:no};function no(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return H(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const ro={name:"headingAtx",resolve:io,tokenize:so};function io(e,t){let n=e.length-2,r=3,s,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ve(e,r,n-r+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function so(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),l(u)}function l(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||ue(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),d(u)):u===null||H(u)?(e.exit("atxHeading"),t(u)):Q(u)?K(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function d(u){return u===35?(e.consume(u),d):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ue(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const lo=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gn=["pre","script","style","textarea"],oo={concrete:!0,name:"htmlFlow",resolveTo:uo,tokenize:mo},ao={partial:!0,tokenize:ho},co={partial:!0,tokenize:po};function uo(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function mo(e,t,n){const r=this;let s,l,o,a,d;return c;function c(x){return u(x)}function u(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),m}function m(x){return x===33?(e.consume(x),h):x===47?(e.consume(x),l=!0,w):x===63?(e.consume(x),s=3,r.interrupt?t:g):_e(x)?(e.consume(x),o=String.fromCharCode(x),C):n(x)}function h(x){return x===45?(e.consume(x),s=2,p):x===91?(e.consume(x),s=5,a=0,_):_e(x)?(e.consume(x),s=4,r.interrupt?t:g):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:g):n(x)}function _(x){const oe="CDATA[";return x===oe.charCodeAt(a++)?(e.consume(x),a===oe.length?r.interrupt?t:L:_):n(x)}function w(x){return _e(x)?(e.consume(x),o=String.fromCharCode(x),C):n(x)}function C(x){if(x===null||x===47||x===62||ue(x)){const oe=x===47,we=o.toLowerCase();return!oe&&!l&&Gn.includes(we)?(s=1,r.interrupt?t(x):L(x)):lo.includes(o.toLowerCase())?(s=6,oe?(e.consume(x),f):r.interrupt?t(x):L(x)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):l?v(x):N(x))}return x===45||fe(x)?(e.consume(x),o+=String.fromCharCode(x),C):n(x)}function f(x){return x===62?(e.consume(x),r.interrupt?t:L):n(x)}function v(x){return Q(x)?(e.consume(x),v):B(x)}function N(x){return x===47?(e.consume(x),B):x===58||x===95||_e(x)?(e.consume(x),T):Q(x)?(e.consume(x),N):B(x)}function T(x){return x===45||x===46||x===58||x===95||fe(x)?(e.consume(x),T):D(x)}function D(x){return x===61?(e.consume(x),y):Q(x)?(e.consume(x),D):N(x)}function y(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),d=x,j):Q(x)?(e.consume(x),y):b(x)}function j(x){return x===d?(e.consume(x),d=null,I):x===null||H(x)?n(x):(e.consume(x),j)}function b(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ue(x)?D(x):(e.consume(x),b)}function I(x){return x===47||x===62||Q(x)?N(x):n(x)}function B(x){return x===62?(e.consume(x),F):n(x)}function F(x){return x===null||H(x)?L(x):Q(x)?(e.consume(x),F):n(x)}function L(x){return x===45&&s===2?(e.consume(x),Z):x===60&&s===1?(e.consume(x),O):x===62&&s===4?(e.consume(x),ee):x===63&&s===3?(e.consume(x),g):x===93&&s===5?(e.consume(x),X):H(x)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(ao,ie,z)(x)):x===null||H(x)?(e.exit("htmlFlowData"),z(x)):(e.consume(x),L)}function z(x){return e.check(co,R,ie)(x)}function R(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),U}function U(x){return x===null||H(x)?z(x):(e.enter("htmlFlowData"),L(x))}function Z(x){return x===45?(e.consume(x),g):L(x)}function O(x){return x===47?(e.consume(x),o="",q):L(x)}function q(x){if(x===62){const oe=o.toLowerCase();return Gn.includes(oe)?(e.consume(x),ee):L(x)}return _e(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),q):L(x)}function X(x){return x===93?(e.consume(x),g):L(x)}function g(x){return x===62?(e.consume(x),ee):x===45&&s===2?(e.consume(x),g):L(x)}function ee(x){return x===null||H(x)?(e.exit("htmlFlowData"),ie(x)):(e.consume(x),ee)}function ie(x){return e.exit("htmlFlow"),t(x)}}function po(e,t,n){const r=this;return s;function s(o){return H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):n(o)}function l(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function ho(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(bt,t,n)}}const fo={name:"htmlText",tokenize:go};function go(e,t,n){const r=this;let s,l,o;return a;function a(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),d}function d(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),D):g===63?(e.consume(g),N):_e(g)?(e.consume(g),b):n(g)}function c(g){return g===45?(e.consume(g),u):g===91?(e.consume(g),l=0,_):_e(g)?(e.consume(g),v):n(g)}function u(g){return g===45?(e.consume(g),p):n(g)}function m(g){return g===null?n(g):g===45?(e.consume(g),h):H(g)?(o=m,O(g)):(e.consume(g),m)}function h(g){return g===45?(e.consume(g),p):m(g)}function p(g){return g===62?Z(g):g===45?h(g):m(g)}function _(g){const ee="CDATA[";return g===ee.charCodeAt(l++)?(e.consume(g),l===ee.length?w:_):n(g)}function w(g){return g===null?n(g):g===93?(e.consume(g),C):H(g)?(o=w,O(g)):(e.consume(g),w)}function C(g){return g===93?(e.consume(g),f):w(g)}function f(g){return g===62?Z(g):g===93?(e.consume(g),f):w(g)}function v(g){return g===null||g===62?Z(g):H(g)?(o=v,O(g)):(e.consume(g),v)}function N(g){return g===null?n(g):g===63?(e.consume(g),T):H(g)?(o=N,O(g)):(e.consume(g),N)}function T(g){return g===62?Z(g):N(g)}function D(g){return _e(g)?(e.consume(g),y):n(g)}function y(g){return g===45||fe(g)?(e.consume(g),y):j(g)}function j(g){return H(g)?(o=j,O(g)):Q(g)?(e.consume(g),j):Z(g)}function b(g){return g===45||fe(g)?(e.consume(g),b):g===47||g===62||ue(g)?I(g):n(g)}function I(g){return g===47?(e.consume(g),Z):g===58||g===95||_e(g)?(e.consume(g),B):H(g)?(o=I,O(g)):Q(g)?(e.consume(g),I):Z(g)}function B(g){return g===45||g===46||g===58||g===95||fe(g)?(e.consume(g),B):F(g)}function F(g){return g===61?(e.consume(g),L):H(g)?(o=F,O(g)):Q(g)?(e.consume(g),F):I(g)}function L(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),s=g,z):H(g)?(o=L,O(g)):Q(g)?(e.consume(g),L):(e.consume(g),R)}function z(g){return g===s?(e.consume(g),s=void 0,U):g===null?n(g):H(g)?(o=z,O(g)):(e.consume(g),z)}function R(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||ue(g)?I(g):(e.consume(g),R)}function U(g){return g===47||g===62||ue(g)?I(g):n(g)}function Z(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function O(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),q}function q(g){return Q(g)?K(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):X(g)}function X(g){return e.enter("htmlTextData"),o(g)}}const pn={name:"labelEnd",resolveAll:_o,resolveTo:vo,tokenize:wo},xo={tokenize:ko},yo={tokenize:jo},bo={tokenize:So};function _o(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&ve(e,0,e.length,n),e}function vo(e,t){let n=e.length,r=0,s,l,o,a;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const d={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",d,t],["enter",c,t]],a=ge(a,e.slice(l+1,l+r+3)),a=ge(a,[["enter",u,t]]),a=ge(a,mn(t.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),t)),a=ge(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=ge(a,e.slice(o+1)),a=ge(a,[["exit",d,t]]),ve(e,l,e.length,a),e}function wo(e,t,n){const r=this;let s=r.events.length,l,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){l=r.events[s][1];break}return a;function a(h){return l?l._inactive?m(h):(o=r.parser.defined.includes(Be(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),d):n(h)}function d(h){return h===40?e.attempt(xo,u,o?u:m)(h):h===91?e.attempt(yo,u,o?c:m)(h):o?u(h):m(h)}function c(h){return e.attempt(bo,u,m)(h)}function u(h){return t(h)}function m(h){return l._balanced=!0,n(h)}}function ko(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return ue(m)?$e(e,l)(m):l(m)}function l(m){return m===41?u(m):$r(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return ue(m)?$e(e,d)(m):u(m)}function a(m){return n(m)}function d(m){return m===34||m===39||m===40?Zr(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):u(m)}function c(m){return ue(m)?$e(e,u)(m):u(m)}function u(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function jo(e,t,n){const r=this;return s;function s(a){return Kr.call(r,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return r.parser.defined.includes(Be(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function So(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const No={name:"labelStartImage",resolveAll:pn.resolveAll,tokenize:Co};function Co(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ao={name:"labelStartLink",resolveAll:pn.resolveAll,tokenize:Eo};function Eo(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Ot={name:"lineEnding",tokenize:Io};function Io(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),K(e,t,"linePrefix")}}const ht={name:"thematicBreak",tokenize:Po};function Po(e,t,n){let r=0,s;return l;function l(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),d(c)):r>=3&&(c===null||H(c))?(e.exit("thematicBreak"),t(c)):n(c)}function d(c){return c===s?(e.consume(c),r++,d):(e.exit("thematicBreakSequence"),Q(c)?K(e,a,"whitespace")(c):a(c))}}const ce={continuation:{tokenize:Lo},exit:Oo,name:"list",tokenize:Mo},To={partial:!0,tokenize:zo},Fo={partial:!0,tokenize:Ro};function Mo(e,t,n){const r=this,s=r.events[r.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const _=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:$t(p)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ht,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(p)}return n(p)}function d(p){return $t(p)&&++o<10?(e.consume(p),d):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(bt,r.interrupt?n:u,e.attempt(To,h,m))}function u(p){return r.containerState.initialBlankLine=!0,l++,h(p)}function m(p){return Q(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Lo(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(bt,s,l);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,K(e,t,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!Q(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Fo,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,K(e,e.attempt(ce,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Ro(e,t,n){const r=this;return K(e,s,"listItemIndent",r.containerState.size+1);function s(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(l):n(l)}}function Oo(e){e.exit(this.containerState.type)}function zo(e,t,n){const r=this;return K(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const o=r.events[r.events.length-1];return!Q(l)&&o&&o[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Jn={name:"setextUnderline",resolveTo:Do,tokenize:Bo};function Do(e,t){let n=e.length,r,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",o,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Bo(e,t,n){const r=this;let s;return l;function l(c){let u=r.events.length,m;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){m=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Q(c)?K(e,d,"lineSuffix")(c):d(c))}function d(c){return c===null||H(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const qo={tokenize:Uo};function Uo(e){const t=this,n=e.attempt(bt,r,e.attempt(this.parser.constructs.flowInitial,s,K(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Gl,s)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Ho={resolveAll:ti()},Vo=ei("string"),Wo=ei("text");function ei(e){return{resolveAll:ti(e==="text"?Go:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],l=n.attempt(s,o,a);return o;function o(u){return c(u)?l(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),d}function d(u){return c(u)?(n.exit("data"),l(u)):(n.consume(u),d)}function c(u){if(u===null)return!0;const m=s[u];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ti(e){return t;function t(n,r){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,r):n}}function Go(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let l=s.length,o=-1,a=0,d;for(;l--;){const c=s[l];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)d=!0,a++;else if(c!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||d||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Jo={42:ce,43:ce,45:ce,48:ce,49:ce,50:ce,51:ce,52:ce,53:ce,54:ce,55:ce,56:ce,57:ce,62:Jr},Yo={91:$l},Xo={[-2]:Rt,[-1]:Rt,32:Rt},Qo={35:ro,42:ht,45:[Jn,ht],60:oo,61:Jn,95:ht,96:Wn,126:Wn},$o={38:Xr,92:Yr},Ko={[-5]:Ot,[-4]:Ot,[-3]:Ot,33:No,38:Xr,42:Kt,60:[Cl,fo],91:Ao,92:[to,Yr],93:pn,95:Kt,96:Bl},Zo={null:[Kt,Ho]},ea={null:[42,95]},ta={null:[]},na=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ea,contentInitial:Yo,disable:ta,document:Jo,flow:Qo,flowInitial:Xo,insideSpan:Zo,string:$o,text:Ko},Symbol.toStringTag,{value:"Module"}));function ra(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let o=[],a=[];const d={attempt:j(D),check:j(y),consume:v,enter:N,exit:T,interrupt:j(y,{interrupt:!0})},c={code:null,containerState:{},defineSkip:w,events:[],now:_,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let u=t.tokenize.call(c,d);return t.resolveAll&&l.push(t),c;function m(F){return o=ge(o,F),C(),o[o.length-1]!==null?[]:(b(t,0),c.events=mn(l,c.events,c),c.events)}function h(F,L){return sa(p(F),L)}function p(F){return ia(o,F)}function _(){const{_bufferIndex:F,_index:L,line:z,column:R,offset:U}=r;return{_bufferIndex:F,_index:L,line:z,column:R,offset:U}}function w(F){s[F.line]=F.column,B()}function C(){let F;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<L.length;)f(L.charCodeAt(r._bufferIndex));else f(L)}}function f(F){u=u(F)}function v(F){H(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,B()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function N(F,L){const z=L||{};return z.type=F,z.start=_(),c.events.push(["enter",z,c]),a.push(z),z}function T(F){const L=a.pop();return L.end=_(),c.events.push(["exit",L,c]),L}function D(F,L){b(F,L.from)}function y(F,L){L.restore()}function j(F,L){return z;function z(R,U,Z){let O,q,X,g;return Array.isArray(R)?ie(R):"tokenize"in R?ie([R]):ee(R);function ee(te){return ke;function ke(xe){const Ae=xe!==null&&te[xe],Ee=xe!==null&&te.null,Le=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Ee)?Ee:Ee?[Ee]:[]];return ie(Le)(xe)}}function ie(te){return O=te,q=0,te.length===0?Z:x(te[q])}function x(te){return ke;function ke(xe){return g=I(),X=te,te.partial||(c.currentConstruct=te),te.name&&c.parser.constructs.disable.null.includes(te.name)?we():te.tokenize.call(L?Object.assign(Object.create(c),L):c,d,oe,we)(xe)}}function oe(te){return F(X,g),U}function we(te){return g.restore(),++q<O.length?x(O[q]):Z}}}function b(F,L){F.resolveAll&&!l.includes(F)&&l.push(F),F.resolve&&ve(c.events,L,c.events.length-L,F.resolve(c.events.slice(L),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function I(){const F=_(),L=c.previous,z=c.currentConstruct,R=c.events.length,U=Array.from(a);return{from:R,restore:Z};function Z(){r=F,c.previous=L,c.currentConstruct=z,c.events.length=R,a=U,B()}}function B(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function ia(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,l)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[s].slice(0,l))}return o}function sa(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const l=e[n];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(l)}s=l===-2,r.push(o)}return r.join("")}function la(e){const r={constructs:ml([na,...(e||{}).extensions||[]]),content:s(_l),defined:[],document:s(wl),flow:s(qo),lazy:{},string:s(Vo),text:s(Wo)};return r;function s(l){return o;function o(a){return ra(r,l,a)}}}function oa(e){for(;!Qr(e););return e}const Yn=/[\0\t\n\r]/g;function aa(){let e=1,t="",n=!0,r;return s;function s(l,o,a){const d=[];let c,u,m,h,p;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(Yn.lastIndex=m,c=Yn.exec(l),h=c&&c.index!==void 0?c.index:l.length,p=l.charCodeAt(h),!c){t=l.slice(m);break}if(p===10&&m===h&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),m<h&&(d.push(l.slice(m,h)),e+=h-m),p){case 0:{d.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,d.push(-2);e++<u;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return a&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const ca=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ua(e){return e.replace(ca,da)}function da(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return Gr(n.slice(l?2:1),l?16:10)}return dn(n)||e}function Ke(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Xn(e.position):"start"in e||"end"in e?Xn(e):"line"in e||"column"in e?Zt(e):""}function Zt(e){return Qn(e&&e.line)+":"+Qn(e&&e.column)}function Xn(e){return Zt(e&&e.start)+"-"+Zt(e&&e.end)}function Qn(e){return e&&typeof e=="number"?e:1}const ni={}.hasOwnProperty;function ma(e,t,n){return typeof t!="string"&&(n=t,t=void 0),pa(n)(oa(la(n).document().write(aa()(e,t,!0))))}function pa(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(lt),autolinkProtocol:I,autolinkEmail:I,atxHeading:l(rt),blockQuote:l(Ee),characterEscape:I,characterReference:I,codeFenced:l(Le),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(Le,o),codeText:l(wt,o),codeTextData:I,data:I,codeFlowValue:I,definition:l(kt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(jt),hardBreakEscape:l(it),hardBreakTrailing:l(it),htmlFlow:l(st,o),htmlFlowData:I,htmlText:l(st,o),htmlTextData:I,image:l(St),label:o,link:l(lt),listItem:l(Nt),listItemValue:h,listOrdered:l(ot,m),listUnordered:l(ot),paragraph:l(Ct),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(rt),strong:l(At),thematicBreak:l(It)},exit:{atxHeading:d(),atxHeadingSequence:D,autolink:d(),autolinkEmail:Ae,autolinkProtocol:xe,blockQuote:d(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:te,characterReference:ke,codeFenced:d(C),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:_,codeFlowValue:B,codeIndented:d(f),codeText:d(U),codeTextData:B,data:B,definition:d(),definitionDestinationString:T,definitionLabelString:v,definitionTitleString:N,emphasis:d(),hardBreakEscape:d(L),hardBreakTrailing:d(L),htmlFlow:d(z),htmlFlowData:B,htmlText:d(R),htmlTextData:B,image:d(O),label:X,labelText:q,lineEnding:F,link:d(Z),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:oe,resourceDestinationString:g,resourceTitleString:ee,resource:ie,setextHeading:d(b),setextHeadingLineSequence:j,setextHeadingText:y,strong:d(),thematicBreak:d()}};ri(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(k){let P={type:"root",children:[]};const V={stack:[P],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},A=[];let G=-1;for(;++G<k.length;)if(k[G][1].type==="listOrdered"||k[G][1].type==="listUnordered")if(k[G][0]==="enter")A.push(G);else{const ae=A.pop();G=s(k,ae,G)}for(G=-1;++G<k.length;){const ae=t[k[G][0]];ni.call(ae,k[G][1].type)&&ae[k[G][1].type].call(Object.assign({sliceSerialize:k[G][2].sliceSerialize},V),k[G][1])}if(V.tokenStack.length>0){const ae=V.tokenStack[V.tokenStack.length-1];(ae[1]||$n).call(V,void 0,ae[0])}for(P.position={start:Ie(k.length>0?k[0][1].start:{line:1,column:1,offset:0}),end:Ie(k.length>0?k[k.length-2][1].end:{line:1,column:1,offset:0})},G=-1;++G<t.transforms.length;)P=t.transforms[G](P)||P;return P}function s(k,P,V){let A=P-1,G=-1,ae=!1,se,je,Ve,We;for(;++A<=V;){const pe=k[A];switch(pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pe[0]==="enter"?G++:G--,We=void 0;break}case"lineEndingBlank":{pe[0]==="enter"&&(se&&!We&&!G&&!Ve&&(Ve=A),We=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:We=void 0}if(!G&&pe[0]==="enter"&&pe[1].type==="listItemPrefix"||G===-1&&pe[0]==="exit"&&(pe[1].type==="listUnordered"||pe[1].type==="listOrdered")){if(se){let Re=A;for(je=void 0;Re--;){const Se=k[Re];if(Se[1].type==="lineEnding"||Se[1].type==="lineEndingBlank"){if(Se[0]==="exit")continue;je&&(k[je][1].type="lineEndingBlank",ae=!0),Se[1].type="lineEnding",je=Re}else if(!(Se[1].type==="linePrefix"||Se[1].type==="blockQuotePrefix"||Se[1].type==="blockQuotePrefixWhitespace"||Se[1].type==="blockQuoteMarker"||Se[1].type==="listItemIndent"))break}Ve&&(!je||Ve<je)&&(se._spread=!0),se.end=Object.assign({},je?k[je][1].start:pe[1].end),k.splice(je||A,0,["exit",se,pe[2]]),A++,V++}if(pe[1].type==="listItemPrefix"){const Re={type:"listItem",_spread:!1,start:Object.assign({},pe[1].start),end:void 0};se=Re,k.splice(A,0,["enter",Re,pe[2]]),A++,V++,Ve=void 0,We=!0}}}return k[P][1]._spread=ae,V}function l(k,P){return V;function V(A){a.call(this,k(A),A),P&&P.call(this,A)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(k,P,V){this.stack[this.stack.length-1].children.push(k),this.stack.push(k),this.tokenStack.push([P,V||void 0]),k.position={start:Ie(P.start),end:void 0}}function d(k){return P;function P(V){k&&k.call(this,V),c.call(this,V)}}function c(k,P){const V=this.stack.pop(),A=this.tokenStack.pop();if(A)A[0].type!==k.type&&(P?P.call(this,k,A[0]):(A[1]||$n).call(this,k,A[0]));else throw new Error("Cannot close `"+k.type+"` ("+Ke({start:k.start,end:k.end})+"): it’s not open");V.position.end=Ie(k.end)}function u(){return ul(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(k){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(k),10),this.data.expectingFirstListItemValue=void 0}}function p(){const k=this.resume(),P=this.stack[this.stack.length-1];P.lang=k}function _(){const k=this.resume(),P=this.stack[this.stack.length-1];P.meta=k}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function f(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k.replace(/(\r?\n|\r)$/g,"")}function v(k){const P=this.resume(),V=this.stack[this.stack.length-1];V.label=P,V.identifier=Be(this.sliceSerialize(k)).toLowerCase()}function N(){const k=this.resume(),P=this.stack[this.stack.length-1];P.title=k}function T(){const k=this.resume(),P=this.stack[this.stack.length-1];P.url=k}function D(k){const P=this.stack[this.stack.length-1];if(!P.depth){const V=this.sliceSerialize(k).length;P.depth=V}}function y(){this.data.setextHeadingSlurpLineEnding=!0}function j(k){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(k).codePointAt(0)===61?1:2}function b(){this.data.setextHeadingSlurpLineEnding=void 0}function I(k){const V=this.stack[this.stack.length-1].children;let A=V[V.length-1];(!A||A.type!=="text")&&(A=Et(),A.position={start:Ie(k.start),end:void 0},V.push(A)),this.stack.push(A)}function B(k){const P=this.stack.pop();P.value+=this.sliceSerialize(k),P.position.end=Ie(k.end)}function F(k){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=P.children[P.children.length-1];V.position.end=Ie(k.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(P.type)&&(I.call(this,k),B.call(this,k))}function L(){this.data.atHardBreak=!0}function z(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function R(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function U(){const k=this.resume(),P=this.stack[this.stack.length-1];P.value=k}function Z(){const k=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=P,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function O(){const k=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=P,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function q(k){const P=this.sliceSerialize(k),V=this.stack[this.stack.length-2];V.label=ua(P),V.identifier=Be(P).toLowerCase()}function X(){const k=this.stack[this.stack.length-1],P=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const A=k.children;V.children=A}else V.alt=P}function g(){const k=this.resume(),P=this.stack[this.stack.length-1];P.url=k}function ee(){const k=this.resume(),P=this.stack[this.stack.length-1];P.title=k}function ie(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function oe(k){const P=this.resume(),V=this.stack[this.stack.length-1];V.label=P,V.identifier=Be(this.sliceSerialize(k)).toLowerCase(),this.data.referenceType="full"}function we(k){this.data.characterReferenceType=k.type}function te(k){const P=this.sliceSerialize(k),V=this.data.characterReferenceType;let A;V?(A=Gr(P,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):A=dn(P);const G=this.stack[this.stack.length-1];G.value+=A}function ke(k){const P=this.stack.pop();P.position.end=Ie(k.end)}function xe(k){B.call(this,k);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(k)}function Ae(k){B.call(this,k);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(k)}function Ee(){return{type:"blockquote",children:[]}}function Le(){return{type:"code",lang:null,meta:null,value:""}}function wt(){return{type:"inlineCode",value:""}}function kt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function jt(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function it(){return{type:"break"}}function st(){return{type:"html",value:""}}function St(){return{type:"image",title:null,url:"",alt:null}}function lt(){return{type:"link",title:null,url:"",children:[]}}function ot(k){return{type:"list",ordered:k.type==="listOrdered",start:null,spread:k._spread,children:[]}}function Nt(k){return{type:"listItem",spread:k._spread,checked:null,children:[]}}function Ct(){return{type:"paragraph",children:[]}}function At(){return{type:"strong",children:[]}}function Et(){return{type:"text",value:""}}function It(){return{type:"thematicBreak"}}}function Ie(e){return{line:e.line,column:e.column,offset:e.offset}}function ri(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ri(e,r):ha(e,r)}}function ha(e,t){let n;for(n in t)if(ni.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function $n(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ke({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ke({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ke({start:t.start,end:t.end})+") is still open")}function fa(e){const t=this;t.parser=n;function n(r){return ma(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ga(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xa(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function ya(e,t){const n=t.value?t.value+`
`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function ba(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _a(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function va(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=He(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=l+1,a+=1,e.footnoteCounts.set(r,a);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,d);const c={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,c),e.applyData(t,c)}function wa(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ka(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ii(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function ja(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ii(e,t);const s={src:He(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function Sa(e,t){const n={src:He(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Na(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Ca(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ii(e,t);const s={href:He(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function Aa(e,t){const n={href:He(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ea(e,t,n){const r=e.all(t),s=n?Ia(n):si(t),l={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let m;u&&u.type==="element"&&u.tagName==="p"?m=u:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const d=r[r.length-1];d&&(s||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:l,children:o};return e.patch(t,c),e.applyData(t,c)}function Ia(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=si(n[r])}return t}function si(e){const t=e.spread;return t??e.children.length>1}function Pa(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function Ta(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fa(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ma(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const li=ai("end"),oi=ai("start");function ai(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function La(e){const t=oi(e),n=li(e);if(t&&n)return{start:t,end:n}}function Ra(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=oi(t.children[1]),d=li(t.children[t.children.length-1]);a&&d&&(o.position={start:a,end:d}),s.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function Oa(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let d=-1;const c=[];for(;++d<a;){const m=t.children[d],h={},p=o?o[d]:void 0;p&&(h.align=p);let _={type:"element",tagName:l,properties:h,children:[]};m&&(_.children=e.all(m),e.patch(m,_),_=e.applyData(m,_)),c.push(_)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function za(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Kn=9,Zn=32;function Da(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const l=[];for(;r;)l.push(er(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return l.push(er(t.slice(s),s>0,!1)),l.join("")}function er(e,t,n){let r=0,s=e.length;if(t){let l=e.codePointAt(r);for(;l===Kn||l===Zn;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(s-1);for(;l===Kn||l===Zn;)s--,l=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Ba(e,t){const n={type:"text",value:Da(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function qa(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Ua={blockquote:ga,break:xa,code:ya,delete:ba,emphasis:_a,footnoteReference:va,heading:wa,html:ka,imageReference:ja,image:Sa,inlineCode:Na,linkReference:Ca,link:Aa,listItem:Ea,list:Pa,paragraph:Ta,root:Fa,strong:Ma,table:Ra,tableCell:za,tableRow:Oa,text:Ba,thematicBreak:qa,toml:ct,yaml:ct,definition:ct,footnoteDefinition:ct};function ct(){}const ci=-1,_t=0,Ze=1,xt=2,hn=3,fn=4,gn=5,xn=6,ui=7,di=8,tr=typeof self=="object"?self:globalThis,Ha=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),r=s=>{if(e.has(s))return e.get(s);const[l,o]=t[s];switch(l){case _t:case ci:return n(o,s);case Ze:{const a=n([],s);for(const d of o)a.push(r(d));return a}case xt:{const a=n({},s);for(const[d,c]of o)a[r(d)]=r(c);return a}case hn:return n(new Date(o),s);case fn:{const{source:a,flags:d}=o;return n(new RegExp(a,d),s)}case gn:{const a=n(new Map,s);for(const[d,c]of o)a.set(r(d),r(c));return a}case xn:{const a=n(new Set,s);for(const d of o)a.add(r(d));return a}case ui:{const{name:a,message:d}=o;return n(new tr[a](d),s)}case di:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new tr[l](o),s)};return r},nr=e=>Ha(new Map,e)(0),ze="",{toString:Va}={},{keys:Wa}=Object,Xe=e=>{const t=typeof e;if(t!=="object"||!e)return[_t,t];const n=Va.call(e).slice(8,-1);switch(n){case"Array":return[Ze,ze];case"Object":return[xt,ze];case"Date":return[hn,ze];case"RegExp":return[fn,ze];case"Map":return[gn,ze];case"Set":return[xn,ze];case"DataView":return[Ze,n]}return n.includes("Array")?[Ze,n]:n.includes("Error")?[ui,n]:[xt,n]},ut=([e,t])=>e===_t&&(t==="function"||t==="symbol"),Ga=(e,t,n,r)=>{const s=(o,a)=>{const d=r.push(o)-1;return n.set(a,d),d},l=o=>{if(n.has(o))return n.get(o);let[a,d]=Xe(o);switch(a){case _t:{let u=o;switch(d){case"bigint":a=di,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);u=null;break;case"undefined":return s([ci],o)}return s([a,u],o)}case Ze:{if(d){let h=o;return d==="DataView"?h=new Uint8Array(o.buffer):d==="ArrayBuffer"&&(h=new Uint8Array(o)),s([d,[...h]],o)}const u=[],m=s([a,u],o);for(const h of o)u.push(l(h));return m}case xt:{if(d)switch(d){case"BigInt":return s([d,o.toString()],o);case"Boolean":case"Number":case"String":return s([d,o.valueOf()],o)}if(t&&"toJSON"in o)return l(o.toJSON());const u=[],m=s([a,u],o);for(const h of Wa(o))(e||!ut(Xe(o[h])))&&u.push([l(h),l(o[h])]);return m}case hn:return s([a,o.toISOString()],o);case fn:{const{source:u,flags:m}=o;return s([a,{source:u,flags:m}],o)}case gn:{const u=[],m=s([a,u],o);for(const[h,p]of o)(e||!(ut(Xe(h))||ut(Xe(p))))&&u.push([l(h),l(p)]);return m}case xn:{const u=[],m=s([a,u],o);for(const h of o)(e||!ut(Xe(h)))&&u.push(l(h));return m}}const{message:c}=o;return s([a,{name:d,message:c}],o)};return l},rr=(e,{json:t,lossy:n}={})=>{const r=[];return Ga(!(t||n),!!t,new Map,r)(e),r},yt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nr(rr(e,t)):structuredClone(e):(e,t)=>nr(rr(e,t));function Ja(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Ya(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Xa(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Ja,r=e.options.footnoteBackLabel||Ya,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let d=-1;for(;++d<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[d]);if(!c)continue;const u=e.all(c),m=String(c.identifier).toUpperCase(),h=He(m.toLowerCase());let p=0;const _=[],w=e.footnoteCounts.get(m);for(;w!==void 0&&++p<=w;){_.length>0&&_.push({type:"text",value:" "});let v=typeof n=="string"?n:n(d,p);typeof v=="string"&&(v={type:"text",value:v}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const C=u[u.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const v=C.children[C.children.length-1];v&&v.type==="text"?v.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(..._)}else u.push(..._);const f={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,f),a.push(f)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...yt(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const mi=function(e){if(e==null)return Za;if(typeof e=="function")return vt(e);if(typeof e=="object")return Array.isArray(e)?Qa(e):$a(e);if(typeof e=="string")return Ka(e);throw new Error("Expected function, string, or object as test")};function Qa(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=mi(e[n]);return vt(r);function r(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function $a(e){const t=e;return vt(n);function n(r){const s=r;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function Ka(e){return vt(t);function t(n){return n&&n.type===e}}function vt(e){return t;function t(n,r,s){return!!(ec(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Za(){return!0}function ec(e){return e!==null&&typeof e=="object"&&"type"in e}const pi=[],tc=!0,ir=!1,nc="skip";function rc(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const l=mi(s),o=r?-1:1;a(e,void 0,[])();function a(d,c,u){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const p=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(d.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=pi,_,w,C;if((!t||l(d,c,u[u.length-1]||void 0))&&(p=ic(n(d,u)),p[0]===ir))return p;if("children"in d&&d.children){const f=d;if(f.children&&p[0]!==nc)for(w=(r?f.children.length:-1)+o,C=u.concat(f);w>-1&&w<f.children.length;){const v=f.children[w];if(_=a(v,w,C)(),_[0]===ir)return _;w=typeof _[1]=="number"?_[1]:w+o}}return p}}}function ic(e){return Array.isArray(e)?e:typeof e=="number"?[tc,e]:e==null?pi:[e]}function hi(e,t,n,r){let s,l,o;typeof t=="function"?(l=void 0,o=t,s=n):(l=t,o=n,s=r),rc(e,l,a,s);function a(d,c){const u=c[c.length-1],m=u?u.children.indexOf(d):void 0;return o(d,m,u)}}const en={}.hasOwnProperty,sc={};function lc(e,t){const n=t||sc,r=new Map,s=new Map,l=new Map,o={...Ua,...n.handlers},a={all:c,applyData:ac,definitionById:r,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:o,one:d,options:n,patch:oc,wrap:uc};return hi(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const m=u.type==="definition"?r:s,h=String(u.identifier).toUpperCase();m.has(h)||m.set(h,u)}}),a;function d(u,m){const h=u.type,p=a.handlers[h];if(en.call(a.handlers,h)&&p)return p(a,u,m);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:w,...C}=u,f=yt(C);return f.children=a.all(u),f}return yt(u)}return(a.options.unknownHandler||cc)(a,u,m)}function c(u){const m=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const _=a.one(h[p],u);if(_){if(p&&h[p-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=sr(_.value)),!Array.isArray(_)&&_.type==="element")){const w=_.children[0];w&&w.type==="text"&&(w.value=sr(w.value))}Array.isArray(_)?m.push(..._):m.push(_)}}}return m}}function oc(e,t){e.position&&(t.position=La(e))}function ac(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&l&&Object.assign(n.properties,yt(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function cc(e,t){const n=t.data||{},r="value"in t&&!(en.call(n,"hProperties")||en.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uc(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function sr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function lr(e,t){const n=lc(e,t),r=n.one(e,void 0),s=Xa(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
`},s),l}function dc(e,t){return e&&"run"in e?async function(n,r){const s=lr(n,{file:r,...t});await e.run(s,r)}:function(n,r){return lr(n,{file:r,...e||t})}}function or(e){if(e)throw e}var zt,ar;function mc(){if(ar)return zt;ar=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},l=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),m=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!m)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return zt=function d(){var c,u,m,h,p,_,w=arguments[0],C=1,f=arguments.length,v=!1;for(typeof w=="boolean"&&(v=w,w=arguments[1]||{},C=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});C<f;++C)if(c=arguments[C],c!=null)for(u in c)m=a(w,u),h=a(c,u),w!==h&&(v&&h&&(l(h)||(p=s(h)))?(p?(p=!1,_=m&&s(m)?m:[]):_=m&&l(m)?m:{},o(w,{name:u,newValue:d(v,_,h)})):typeof h<"u"&&o(w,{name:u,newValue:h}));return w},zt}var pc=mc();const Dt=wr(pc);function tn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function hc(){const e=[],t={run:n,use:r};return t;function n(...s){let l=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(d,...c){const u=e[++l];let m=-1;if(d){o(d);return}for(;++m<s.length;)(c[m]===null||c[m]===void 0)&&(c[m]=s[m]);s=c,u?fc(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function fc(e,t){let n;return r;function r(...o){const a=e.length>o.length;let d;a&&o.push(s);try{d=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(d&&d.then&&typeof d.then=="function"?d.then(l,s):d instanceof Error?s(d):l(d))}function s(o,...a){n||(n=!0,t(o,...a))}function l(o){s(null,o)}}class me extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",l={},o=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(o=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?l.ruleId=r:(l.source=r.slice(0,d),l.ruleId=r.slice(d+1))}if(!l.place&&l.ancestors&&l.ancestors){const d=l.ancestors[l.ancestors.length-1];d&&(l.place=d.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=a?a.line:void 0,this.name=Ke(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual,this.expected,this.note,this.url}}me.prototype.file="";me.prototype.name="";me.prototype.reason="";me.prototype.message="";me.prototype.stack="";me.prototype.column=void 0;me.prototype.line=void 0;me.prototype.ancestors=void 0;me.prototype.cause=void 0;me.prototype.fatal=void 0;me.prototype.place=void 0;me.prototype.ruleId=void 0;me.prototype.source=void 0;const be={basename:gc,dirname:xc,extname:yc,join:bc,sep:"/"};function gc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');nt(e);let n=0,r=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else r<0&&(l=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else o<0&&(l=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function xc(e){if(nt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function yc(e){nt(e);let t=e.length,n=-1,r=0,s=-1,l=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function bc(...e){let t=-1,n;for(;++t<e.length;)nt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":_c(n)}function _c(e){nt(e);const t=e.codePointAt(0)===47;let n=vc(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function vc(e,t){let n="",r=0,s=-1,l=0,o=-1,a,d;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||l===1))if(s!==o-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),s=o,l=0;continue}}else if(n.length>0){n="",r=0,s=o,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,l=0}else a===46&&l>-1?l++:l=-1}return n}function nt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wc={cwd:kc};function kc(){return"/"}function nn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jc(e){if(typeof e=="string")e=new URL(e);else if(!nn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Sc(e)}function Sc(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Bt=["history","path","basename","stem","extname","dirname"];class fi{constructor(t){let n;t?nn(t)?n={path:t}:typeof t=="string"||Nc(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Bt.length;){const l=Bt[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)Bt.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?be.basename(this.path):void 0}set basename(t){Ut(t,"basename"),qt(t,"basename"),this.path=be.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?be.dirname(this.path):void 0}set dirname(t){cr(this.basename,"dirname"),this.path=be.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?be.extname(this.path):void 0}set extname(t){if(qt(t,"extname"),cr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=be.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){nn(t)&&(t=jc(t)),Ut(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?be.basename(this.path,this.extname):void 0}set stem(t){Ut(t,"stem"),qt(t,"stem"),this.path=be.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new me(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function qt(e,t){if(e&&e.includes(be.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+be.sep+"`")}function Ut(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function cr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Nc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Cc=function(e){const r=this.constructor.prototype,s=r[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},Ac={}.hasOwnProperty;class yn extends Cc{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=hc()}copy(){const t=new yn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Dt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Wt("data",this.frozen),this.namespace[t]=n,this):Ac.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Wt("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=dt(t),r=this.parser||this.Parser;return Ht("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ht("process",this.parser||this.Parser),Vt("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,o){const a=dt(t),d=r.parse(a);r.run(d,a,function(u,m,h){if(u||!m||!h)return c(u);const p=m,_=r.stringify(p,h);Pc(_)?h.value=_:h.result=_,c(u,h)});function c(u,m){u||!m?o(u):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Ht("processSync",this.parser||this.Parser),Vt("processSync",this.compiler||this.Compiler),this.process(t,s),dr("processSync","process",n),r;function s(l,o){n=!0,or(l),r=o}}run(t,n,r){ur(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(o,a){const d=dt(n);s.run(t,d,c);function c(u,m,h){const p=m||t;u?a(u):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,l),dr("runSync","run",r),s;function l(o,a){or(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=dt(n),s=this.compiler||this.Compiler;return Vt("stringify",s),ur(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Wt("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(c){if(typeof c=="function")d(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...m]=c;d(u,m)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=Dt(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const m=c[u];l(m)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function d(c,u){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===c){h=m;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[p,..._]=u;const w=r[h][1];tn(w)&&tn(p)&&(p=Dt(!0,w,p)),r[h]=[c,p,..._]}}}}const Ec=new yn().freeze();function Ht(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Wt(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ur(e){if(!tn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function dt(e){return Ic(e)?e:new fi(e)}function Ic(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Pc(e){return typeof e=="string"||Tc(e)}function Tc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Fc="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",mr=[],pr={allowDangerousHtml:!0},Mc=/^(https?|ircs?|mailto|xmpp)$/i,Lc=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Rc(e){const t=Oc(e),n=zc(e);return Dc(t.runSync(t.parse(n),n),e)}function Oc(e){const t=e.rehypePlugins||mr,n=e.remarkPlugins||mr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pr}:pr;return Ec().use(fa).use(n).use(dc,r).use(t)}function zc(e){const t=e.children||"",n=new fi;return typeof t=="string"&&(n.value=t),n}function Dc(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,l=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,d=t.urlTransform||Bc;for(const u of Lc)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Fc+u.id,void 0);return hi(e,c),Js(e,{Fragment:i.Fragment,components:s,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function c(u,m,h){if(u.type==="raw"&&h&&typeof m=="number")return o?h.children.splice(m,1):h.children[m]={type:"text",value:u.value},m;if(u.type==="element"){let p;for(p in Lt)if(Object.hasOwn(Lt,p)&&Object.hasOwn(u.properties,p)){const _=u.properties[p],w=Lt[p];(w===null||w.includes(u.tagName))&&(u.properties[p]=d(String(_||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):l?l.includes(u.tagName):!1;if(!p&&r&&typeof m=="number"&&(p=!r(u,m,h)),p&&h&&typeof m=="number")return a&&u.children?h.children.splice(m,1,...u.children):h.children.splice(m,1),m}}}function Bc(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Mc.test(e.slice(0,t))?e:""}const hr=({variant:e="default",className:t,children:n,...r})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",l="bg-green-500 hover:bg-green-600 text-white dark:bg-green-600 dark:hover:bg-green-700",o="bg-indigo-600 hover:bg-indigo-700 text-white dark:bg-indigo-500 dark:hover:bg-indigo-600";let d="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"?d=l:e==="secondary"&&(d=o),i.jsx("button",{...r,className:`${s} ${d} ${t||""}`.trim(),children:n})},qc=({plugin:e,isOpen:t,onClose:n,onInstall:r})=>{if(!t)return null;const s=l=>!l||l.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No skills defined for this plugin."}):i.jsx("ul",{className:"list-disc list-inside space-y-1 pl-1",children:l.map((o,a)=>i.jsxs("li",{className:"text-sm text-gray-700 dark:text-gray-300",children:[i.jsx("strong",{className:"font-semibold text-gray-800 dark:text-gray-200",children:o.name||"Unnamed Skill"}),o.description&&`: ${o.description}`]},a))});return i.jsx("div",{role:"button",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",onClick:n,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&n()},children:i.jsxs("div",{role:"dialog",className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-2xl w-full max-h-[90vh] flex flex-col",onClick:l=>l.stopPropagation(),onKeyDown:l=>{l.key==="Escape"&&n(),l.stopPropagation()},children:[i.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",children:[i.jsxs("h2",{id:"readMoreModalTitle",className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:[e.pyproject.name," ",i.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["v",e.pyproject.version]})]}),i.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-gray-100 dark:scrollbar-track-gray-700 flex-grow",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Description"}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.pyproject.description||"No description provided."})]}),e.pyproject.authors&&e.pyproject.authors.length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Author(s)"}),i.jsx("ul",{className:"list-disc list-inside pl-1",children:e.pyproject.authors.map((l,o)=>i.jsxs("li",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.name||"N/A"," ",l.email&&i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:`<${l.email}>`})]},o))})]}),e.pyproject.custom_metadata&&Object.keys(e.pyproject.custom_metadata).length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Additional Metadata"}),i.jsx("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2",children:i.jsx("ul",{className:"space-y-1",children:Object.entries(e.pyproject.custom_metadata).map(([l,o])=>i.jsxs("li",{className:"text-sm text-gray-700 dark:text-gray-300 flex",children:[i.jsxs("strong",{className:"font-medium w-1/3 min-w-[100px] flex-shrink-0 text-gray-600 dark:text-gray-200 break-words",children:[l,":"]}),i.jsx("span",{className:"text-gray-600 dark:text-gray-400 break-words",children:String(o)})]},l))})})]}),e.agent_card?i.jsxs("div",{children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"Agent Card Details"}),i.jsxs("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2",children:[e.agent_card.displayName&&i.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:[i.jsx("strong",{className:"font-medium text-gray-700 dark:text-gray-200",children:"Display Name:"})," ",e.agent_card.displayName]}),e.agent_card.shortDescription&&i.jsxs("p",{className:"text-sm mt-1 text-gray-600 dark:text-gray-300",children:[i.jsx("strong",{className:"font-medium text-gray-700 dark:text-gray-200",children:"Card Description:"})," ",e.agent_card.shortDescription]}),e.agent_card.Skill&&e.agent_card.Skill.length>0&&i.jsxs("div",{className:"mt-2.5",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-1",children:"Skills:"}),s(e.agent_card.Skill)]}),!e.agent_card.displayName&&!e.agent_card.shortDescription&&(!e.agent_card.Skill||e.agent_card.Skill.length===0)&&i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No specific agent card details provided."})]})]}):i.jsxs("div",{className:"p-3 bg-gray-100 dark:bg-gray-700/30 rounded-md border border-gray-200 dark:border-gray-600",children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1",children:"Agent Card Details"}),i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No agent card data available for this plugin."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-md font-semibold text-gray-700 dark:text-gray-200 mb-1.5",children:"README"}),e.readme_content?i.jsx("div",{className:"p-4 bg-slate-50 dark:bg-slate-700/50 rounded-lg border border-slate-200 dark:border-slate-600 space-y-2 text-gray-700 dark:text-gray-200",children:i.jsx(Rc,{children:e.readme_content})}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No README content available."})]}),i.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-4 pt-3 border-t border-gray-200 dark:border-gray-600 space-y-1",children:[i.jsxs("p",{children:[i.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Source:"})," ",e.source_registry_name||"Unnamed Registry"," (",e.source_type,")"]}),i.jsxs("p",{children:[i.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Location:"})," ",e.source_type==="git"?i.jsx("a",{href:e.source_registry_location,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline break-all",children:e.source_registry_location}):i.jsx("span",{className:"break-all",children:e.source_registry_location})]}),i.jsxs("p",{children:[i.jsx("strong",{className:"text-gray-600 dark:text-gray-300",children:"Plugin Subpath:"})," ",e.plugin_subpath]})]})]}),i.jsxs("div",{className:"mt-auto p-4 border-t border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 flex justify-end space-x-3",children:[i.jsx(hr,{onClick:n,variant:"default",children:"Close"}),i.jsx(hr,{onClick:()=>r(e),variant:"primary",children:"Install"})]})]})})},fr=({variant:e="default",className:t,children:n,...r})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",l="bg-green-600 hover:bg-green-700 text-white dark:bg-green-500 dark:hover:bg-green-600";let a="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"&&(a=l),i.jsx("button",{...r,className:`${s} ${a} ${t||""}`.trim(),children:n})},Uc=({className:e,...t})=>i.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),Hc=({className:e,children:t,...n})=>i.jsx("label",{...n,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${e||""}`,children:t}),Vc=({pluginName:e,isOpen:t,onClose:n,onInstall:r,isLoading:s=!1})=>{const[l,o]=S.useState(""),[a,d]=S.useState(null);if(!t)return null;const c=()=>{o(""),d(null),n()},u=async m=>{m.preventDefault();const h=l.trim();if(!h){d("Component name is required.");return}if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(h)){d("Component name must start with a letter and can only contain letters, numbers, hyphens (-), and underscores (_).");return}d(null),await r(h)};return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"installModalTitle",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-md w-full p-6",children:[i.jsxs("div",{className:"flex justify-between items-center pb-3 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 -m-6 p-4 rounded-t-lg mb-4",children:[i.jsxs("h2",{id:"installModalTitle",className:"text-lg font-semibold text-gray-800 dark:text-gray-100",children:["Install Plugin: ",i.jsx("span",{className:"font-bold",children:e})]}),i.jsx("button",{onClick:c,disabled:s,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx(Hc,{htmlFor:"componentName",children:"Component Name:"}),i.jsx(Uc,{type:"text",id:"componentName",value:l,onChange:m=>{o(m.target.value),a&&d(null)},placeholder:"e.g., my-new-plugin",disabled:s,required:!0}),a&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:a}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"This name will be used for the component configuration file."})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-600",children:[i.jsx(fr,{type:"button",onClick:c,disabled:s,variant:"default",children:"Cancel"}),i.jsx(fr,{type:"submit",disabled:s||!l.trim(),variant:"primary",children:s?"Installing...":"Install Plugin"})]})]})]})})},gr=({variant:e="default",className:t,children:n,...r})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",l="bg-blue-600 hover:bg-blue-700 text-white dark:bg-blue-500 dark:hover:bg-blue-600";let a="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-gray-100";return e==="primary"&&(a=l),i.jsx("button",{...r,className:`${s} ${a} ${t||""}`.trim(),children:n})},xr=({className:e,...t})=>i.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),yr=({className:e,children:t,...n})=>i.jsx("label",{...n,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${e||""}`,children:t}),Wc=({isOpen:e,onClose:t,onAddRegistry:n,isLoading:r=!1})=>{const[s,l]=S.useState(""),[o,a]=S.useState(""),[d,c]=S.useState(null);if(!e)return null;const u=async h=>{h.preventDefault();const p=s.trim(),_=o.trim();if(!p){c("Registry Path or URL is required.");return}c(null),await n(p,_===""?void 0:_)},m=()=>{l(""),a(""),c(null),t()};return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"addRegistryModalTitle",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 dark:bg-black/70 backdrop-blur-sm p-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-w-md w-full p-6",children:[i.jsxs("div",{className:"flex justify-between items-center pb-3 border-b border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 -m-6 p-4 rounded-t-lg mb-4",children:[i.jsx("h2",{id:"addRegistryModalTitle",className:"text-lg font-semibold text-gray-800 dark:text-gray-100",children:"Add New Plugin Registry"}),i.jsx("button",{onClick:m,disabled:r,className:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 p-1 rounded-full focus-visible:ring-2 focus-visible:ring-blue-500","aria-label":"Close modal",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),i.jsxs("form",{onSubmit:u,className:"space-y-5",children:[i.jsxs("div",{children:[i.jsx(yr,{htmlFor:"registryPathOrUrl",children:"Registry Path or URL:"}),i.jsx(xr,{type:"text",id:"registryPathOrUrl",value:s,onChange:h=>{l(h.target.value),d&&c(null)},placeholder:"https://github.com/user/plugins.git or /path/to/local/plugins",disabled:r,required:!0}),d&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:d}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Enter a Git URL (HTTPS/Git) or an absolute local filesystem path."})]}),i.jsxs("div",{children:[i.jsx(yr,{htmlFor:"registryName",children:"Registry Name (Optional):"}),i.jsx(xr,{type:"text",id:"registryName",value:o,onChange:h=>a(h.target.value),placeholder:"My Custom Plugins",disabled:r}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"An optional name for this registry. If blank, a name will be derived."})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3 pt-4 border-t border-gray-200 dark:border-gray-600",children:[i.jsx(gr,{type:"button",onClick:m,disabled:r,variant:"default",children:"Cancel"}),i.jsx(gr,{type:"submit",disabled:r||!s.trim(),variant:"primary",children:r?"Adding...":"Add Registry"})]})]})]})})},br=({variant:e="default",className:t,children:n,...r})=>{const s="px-4 py-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 disabled:opacity-50 disabled:pointer-events-none",l="bg-green-600 hover:bg-green-700 text-white dark:bg-green-500 dark:hover:bg-green-600",o="bg-indigo-600 hover:bg-indigo-700 text-white dark:bg-indigo-500 dark:hover:bg-indigo-600";let d="bg-gray-200 hover:bg-gray-300 text-gray-800 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-gray-100";return e==="primary"?d=l:e==="secondary"&&(d=o),i.jsx("button",{...r,className:`${s} ${d} ${t||""}`,children:n})},Gc=({className:e,...t})=>i.jsx("input",{...t,className:`flex h-10 w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 placeholder:text-gray-400 dark:placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`}),Jc=({className:e,children:t,...n})=>i.jsx("select",{...n,className:`flex h-10 rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 dark:focus-visible:ring-blue-400 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-800 disabled:cursor-not-allowed disabled:opacity-50 ${e||""}`,children:t}),_r=()=>i.jsx("div",{className:"w-5 h-5 border-2 border-current border-t-transparent rounded-full animate-spin"}),vr=({variant:e,title:t,description:n,className:r})=>i.jsxs("div",{role:"alert",className:`relative w-full rounded-lg border p-4 ${e==="destructive"?"bg-red-50 dark:bg-red-900/30 border-red-500/50 text-red-700 dark:text-red-300":"bg-green-50 dark:bg-green-900/30 border-green-500/50 text-green-700 dark:text-green-300"} ${r||""}`,children:[t&&i.jsx("h5",{className:"mb-1 font-semibold leading-none tracking-tight",children:t}),i.jsx("div",{className:"text-sm opacity-90",children:n})]}),Yc=()=>{const[e,t]=S.useState([]),[n,r]=S.useState([]),[,s]=S.useState([]),[l,o]=S.useState(""),[a,d]=S.useState("all"),[c,u]=S.useState(!0),[m,h]=S.useState(null),[p,_]=S.useState(null),[w,C]=S.useState(null),[f,v]=S.useState(!1),[N,T]=S.useState(null),[D,y]=S.useState(!1),[j,b]=S.useState(!1),I=S.useCallback(async(O=!0)=>{O&&u(!0),h(null);try{const q=await fetch("/api/plugin_catalog/plugins");if(!q.ok)throw new Error(`Failed to fetch plugins: ${q.statusText} (${q.status})`);const X=await q.json();t(X),r(X)}catch(q){const X=q instanceof Error?q.message:String(q);h(X),F("destructive",X)}finally{O&&u(!1)}},[]),B=S.useCallback(async()=>{try{const O=await fetch("/api/plugin_catalog/registries");if(!O.ok)throw new Error("Failed to fetch registries");const q=await O.json();s(q)}catch(O){const q=O instanceof Error?O.message:String(O);console.error("Failed to fetch registries:",q)}},[]);S.useEffect(()=>{I(),B()},[I,B]),S.useEffect(()=>{const O=l.toLowerCase();r(e.filter(q=>{var ie;const X=q.pyproject.name.toLowerCase().includes(O)||q.pyproject.description&&q.pyproject.description.toLowerCase().includes(O),g=((ie=q.pyproject.plugin_type)==null?void 0:ie.toLowerCase())||"custom";return X&&(a==="all"||a==="agents"&&g==="agent"||a==="gateways"&&g==="gateway"||a==="custom"&&g==="custom")}))},[l,a,e]);const F=(O,q)=>{_({type:O,message:q}),setTimeout(()=>_(null),7e3)},L=O=>{C(O),v(!0)},z=O=>{T(O),y(!0)},R=async O=>{if(N){u(!0);try{const q=await fetch("/api/plugin_catalog/plugins/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pluginId:N.id,componentName:O})}),X=await q.json();if(!q.ok||X.status==="failure")throw new Error(X.error||"Installation failed");F("success",X.message||"Plugin installed successfully!")}catch(q){const X=q instanceof Error?q.message:String(q);F("destructive",X)}finally{u(!1),y(!1),T(null)}}},U=async()=>{u(!0),h(null);try{const O=await fetch("/api/plugin_catalog/registries/refresh",{method:"POST"}),q=await O.json();if(!O.ok||q.status!=="success")throw new Error(q.message||"Failed to refresh registries");F("success",q.message),await I(!1)}catch(O){const q=O instanceof Error?O.message:String(O);h(q),F("destructive",q)}finally{u(!1)}},Z=async(O,q)=>{u(!0);try{const X={path_or_url:O};q&&q.trim()!==""&&(X.name=q.trim());const g=await fetch("/api/plugin_catalog/registries",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),ee=await g.json();if(!g.ok||ee.status!=="success")throw new Error(ee.error||"Failed to add registry");F("success",ee.message),await B(),await I(!1),b(!1)}catch(X){const g=X instanceof Error?X.message:String(X);F("destructive",g)}finally{u(!1)}};return i.jsx("div",{className:"fixed inset-0 bg-gray-100 dark:bg-gray-900 overflow-auto",children:i.jsxs("div",{className:"p-4 md:p-6 lg:p-8",children:[i.jsx("header",{className:"mb-8",children:i.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-800 dark:text-gray-100",children:"SAM Plugin Catalog"})}),p&&i.jsx(vr,{variant:p.type,description:p.message,className:"mb-6"}),m&&!p&&i.jsx(vr,{variant:"destructive",title:"Error",description:m,className:"mb-6"}),i.jsx("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 shadow-md rounded-lg",children:i.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full md:flex-grow",children:[i.jsx(Gc,{type:"text",placeholder:"Search plugins by name or description...",value:l,onChange:O=>o(O.target.value),className:"w-full sm:flex-grow"}),i.jsxs(Jc,{value:a,onChange:O=>d(O.target.value),className:"w-full sm:w-auto sm:min-w-[140px]",children:[i.jsx("option",{value:"all",children:"All Types"}),i.jsx("option",{value:"agents",children:"Agents"}),i.jsx("option",{value:"gateways",children:"Gateways"}),i.jsx("option",{value:"custom",children:"Custom"})]})]}),i.jsxs("div",{className:"flex gap-3 flex-shrink-0",children:[i.jsx(br,{onClick:()=>b(!0),variant:"primary",children:"+ Add Registry"}),i.jsx(br,{onClick:U,disabled:c&&e.length===0,variant:"secondary",children:c&&e.length===0?i.jsx(_r,{}):"Refresh All"})]})]})}),c&&e.length===0&&i.jsxs("div",{className:"flex flex-col justify-center items-center mt-12 h-64 text-gray-500 dark:text-gray-400",children:[i.jsx(_r,{}),i.jsx("p",{className:"ml-3 mt-3 text-lg",children:"Loading plugins..."})]}),!c&&e.length>0&&n.length===0&&l&&i.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-12 text-lg",children:"No plugins found matching your search criteria."}),!c&&e.length===0&&!m&&i.jsx("p",{className:"text-center text-gray-600 dark:text-gray-400 mt-12 text-lg",children:'No plugins found. Try adding a new registry or click "Refresh All".'}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:n.map(O=>i.jsx(gs,{plugin:O,onReadMore:()=>L(O),onInstall:()=>z(O)},O.id))}),f&&w&&i.jsx(qc,{plugin:w,isOpen:f,onClose:()=>v(!1),onInstall:z}),D&&N&&i.jsx(Vc,{pluginName:N.pyproject.name,isOpen:D,onClose:()=>y(!1),onInstall:R,isLoading:c}),j&&i.jsx(Wc,{isOpen:j,onClose:()=>b(!1),onAddRegistry:Z,isLoading:c})]})})},Xc=({data:e,updateData:t,onNext:n})=>{const r=l=>{t({[l.target.name]:l.target.value})},s=e.gateway_name_input&&e.namespace&&e.gateway_id;return i.jsxs("div",{className:"space-y-6",children:[i.jsx(M,{label:"Gateway Name",htmlFor:"gateway_name_input",required:!0,helpText:"A unique name for your gateway. Will be used for directory and class naming (e.g., my_cool_gateway, MyCoolGateway).",children:i.jsx(Y,{id:"gateway_name_input",name:"gateway_name_input",value:e.gateway_name_input||"",onChange:r,placeholder:"e.g., custom-monitor",required:!0})}),i.jsx(M,{label:"A2A Namespace",htmlFor:"namespace",required:!0,helpText:"The A2A namespace this gateway will operate under.",children:i.jsx(Y,{id:"namespace",name:"namespace",value:e.namespace||"",onChange:r,placeholder:"e.g., myorg/dev or ${NAMESPACE}",required:!0})}),i.jsx(M,{label:"Gateway ID",htmlFor:"gateway_id",required:!0,helpText:"A unique identifier for this gateway instance.",children:i.jsx(Y,{id:"gateway_id",name:"gateway_id",value:e.gateway_id||"",onChange:r,placeholder:"e.g., custom-monitor-gateway-gw-01",required:!0})}),i.jsx("div",{className:"flex justify-end mt-8",children:i.jsx("button",{type:"button",onClick:n,disabled:!s,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})})]})},Qc=[{value:"use_default_shared_artifact",label:"Use Default Shared Artifact Service"},{value:"memory",label:"Memory"},{value:"filesystem",label:"Filesystem"},{value:"gcs",label:"Google Cloud Storage (GCS)"}],$c=[{value:"namespace",label:"Namespace"},{value:"app",label:"Application (Gateway ID specific)"},{value:"custom",label:"Custom (requires specific GDK handling)"}],Kc=({data:e,updateData:t,onNext:n,onPrevious:r})=>{const s=d=>{const{name:c,value:u}=d.target;t({[c]:u}),c==="artifact_service_type"&&u!=="filesystem"&&t({artifact_service_base_path:void 0})},l=e.artifact_service_type&&e.artifact_service_type!=="use_default_shared_artifact",o=e.artifact_service_type==="filesystem";let a=!0;return l&&(e.artifact_service_scope||(a=!1),o&&!e.artifact_service_base_path&&(a=!1)),i.jsxs("div",{className:"space-y-6",children:[i.jsx(M,{label:"Artifact Service Type",htmlFor:"artifact_service_type",helpText:"Determines how gateway artifacts are stored and managed.",children:i.jsx(re,{id:"artifact_service_type",name:"artifact_service_type",value:e.artifact_service_type||"",onChange:s,options:Qc})}),l&&i.jsxs(i.Fragment,{children:[i.jsx(M,{label:"Artifact Service Scope",htmlFor:"artifact_service_scope",required:l,helpText:"Scope for the custom artifact service.",children:i.jsx(re,{id:"artifact_service_scope",name:"artifact_service_scope",value:e.artifact_service_scope||"",onChange:s,options:$c,required:l})}),o&&i.jsx(M,{label:"Artifact Service Base Path",htmlFor:"artifact_service_base_path",required:o,helpText:"Base directory path if 'Filesystem' type is selected.",children:i.jsx(Y,{id:"artifact_service_base_path",name:"artifact_service_base_path",value:e.artifact_service_base_path||"",onChange:s,placeholder:"/tmp/samv2",required:o})})]}),i.jsxs("div",{className:"flex justify-between mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50",children:"Previous"}),i.jsx("button",{type:"button",onClick:n,disabled:!a,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})]})]})},Zc=({data:e,updateData:t,onNext:n,onPrevious:r})=>{const s=l=>{t({[l.target.name]:l.target.value})};return i.jsxs("div",{className:"space-y-6",children:[i.jsx(M,{label:"System Purpose",htmlFor:"system_purpose",helpText:"Define the overall purpose and persona of the gateway.",children:i.jsx("textarea",{id:"system_purpose",name:"system_purpose",value:e.system_purpose||"",onChange:s,rows:6,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"e.g., The system is an AI Chatbot..."})}),i.jsx(M,{label:"Response Format",htmlFor:"response_format",helpText:"Define how the gateway should format its responses.",children:i.jsx("textarea",{id:"response_format",name:"response_format",value:e.response_format||"",onChange:s,rows:4,className:"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-solace-blue focus:border-solace-blue sm:text-sm",placeholder:"e.g., Responses should be clear, concise..."})}),i.jsxs("div",{className:"flex justify-between mt-8",children:[i.jsx("button",{type:"button",onClick:r,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50",children:"Previous"}),i.jsx("button",{type:"button",onClick:n,disabled:!1,className:"px-6 py-2 bg-solace-blue text-white rounded-md hover:bg-solace-purple-dark focus:outline-none focus:ring-2 focus:ring-solace-purple focus:ring-opacity-50 disabled:opacity-50",children:"Next"})]})]})},eu=({data:e,onPrevious:t,onSubmit:n,isLoading:r})=>i.jsxs("div",{className:"space-y-6",children:[i.jsx("h3",{className:"text-xl font-semibold text-gray-700 mb-4",children:"Review Gateway Configuration"}),i.jsx("div",{className:"bg-white shadow-sm rounded-lg p-6 border border-gray-200",children:i.jsxs("dl",{className:"divide-y divide-gray-200",children:[i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Gateway Name"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.gateway_name_input||"-"})]}),i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"A2A Namespace"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.namespace||"-"})]}),i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Gateway ID"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.gateway_id||"-"})]}),i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Type"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_type||"-"})]}),e.artifact_service_type&&e.artifact_service_type!=="use_default_shared_artifact"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Scope"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_scope||"-"})]}),e.artifact_service_type==="filesystem"&&i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Artifact Service Base Path"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:e.artifact_service_base_path||"-"})]})]}),i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"System Purpose"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:i.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:e.system_purpose||"-"})})]}),i.jsxs("div",{className:"py-3 sm:grid sm:grid-cols-3 sm:gap-4",children:[i.jsx("dt",{className:"text-sm font-medium text-gray-500",children:"Response Format"}),i.jsx("dd",{className:"mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2",children:i.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:e.response_format||"-"})})]})]})}),i.jsxs("div",{className:"flex justify-between mt-8",children:[i.jsx("button",{type:"button",onClick:t,disabled:r,className:"px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50 disabled:opacity-50",children:"Previous"}),i.jsx("button",{type:"button",onClick:n,disabled:r,className:"px-6 py-2 bg-solace-green text-white rounded-md hover:bg-solace-green-dark focus:outline-none focus:ring-2 focus:ring-solace-green focus:ring-opacity-50 disabled:opacity-50",children:r?"Creating Gateway...":"Create Gateway"})]})]}),Qe=[{id:"basicInfo",title:"Basic Information",description:"Enter the core details for your new gateway.",component:Xc},{id:"artifactConfig",title:"Artifact Service",description:"Configure how artifacts are stored and managed.",component:Kc},{id:"responseCustomization",title:"Response Customization",description:"Define the gateway's system purpose and response format.",component:Zc},{id:"review",title:"Review & Create",description:"Review your gateway configuration before creation.",component:eu}],tu=()=>{var C;const[e,t]=S.useState(0),[n,r]=S.useState({}),[s,l]=S.useState(!0),[o,a]=S.useState(null),[d,c]=S.useState(!1),u="http://localhost:5002";S.useEffect(()=>{l(!0),fetch(`${u}/api/form_schema?type=gateway`).then(f=>{if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}).then(f=>{if(f.status==="success"&&f.defaults)r({...f.defaults,gateway_name_input:f.defaults.gateway_name_input||""}),a(null);else throw new Error(f.message||"Failed to load gateway defaults.")}).catch(f=>{console.error("Error fetching gateway schema:",f),a(f.message||"Could not fetch gateway configuration defaults."),r({})}).finally(()=>l(!1))},[u]);const m=S.useCallback(f=>{r(v=>({...v,...f}))},[]),h=S.useCallback(()=>{e<Qe.length-1?t(f=>f+1):_()},[e,Qe.length]),p=S.useCallback(()=>{e>0&&t(f=>f-1)},[e]),_=async()=>{l(!0),a(null);try{const f=await fetch(`${u}/api/save_gateway_config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gateway_name_input:n.gateway_name_input||n.name||"DefaultGatewayName",config:n})}),v=await f.json();if(f.ok&&v.status==="success")c(!0),setTimeout(()=>{fetch(`${u}/api/shutdown`,{method:"POST"}).catch(N=>console.error("Error shutting down server:",N))},3e3);else throw new Error(v.message||"Failed to save gateway configuration.")}catch(f){console.error("Error submitting gateway config:",f),f instanceof Error?a(f.message):a("An unexpected error occurred during submission.")}finally{l(!1)}};if(d)return i.jsx(sn,{title:"Gateway Created!",message:"Your new gateway configuration has been saved. The CLI will now generate the necessary files."});if(s&&!Object.keys(n).length)return i.jsx("div",{className:"text-center p-8",children:"Loading gateway configuration..."});if(o)return i.jsxs("div",{className:"text-center p-8 text-red-600",children:["Error: ",o]});const w=(C=Qe[e])==null?void 0:C.component;return i.jsxs("div",{className:"p-4",children:[i.jsx("h2",{className:"text-2xl font-semibold mb-6 text-center text-gray-700",children:"Add New Gateway"}),i.jsx(rn,{steps:Qe,currentStepIndex:e}),i.jsx("div",{className:"mt-6 bg-gray-50 p-6 rounded-lg shadow min-h-[300px]",children:w?i.jsx(w,{data:n,updateData:m,onNext:h,onPrevious:p,onSubmit:_,isLoading:s&&e===Qe.length-1}):i.jsx("p",{className:"text-center",children:"End of flow or step not found."})}),o&&i.jsx("p",{className:"mt-4 text-sm text-red-500 text-center",children:o})]})},iu=()=>[{title:"Solace Agent Mesh - Config Portal"},{name:"description",content:"Initialize your Solace Agent Mesh project or add new components."}];function su(){const[e,t]=S.useState("initialize"),[n]=gi();return S.useEffect(()=>{const r=n.get("config_mode");t(r==="addAgent"?"addAgent":r==="pluginCatalog"?"pluginCatalog":r==="addGateway"?"addGateway":"initialize")},[n]),i.jsx("div",{className:"min-h-screen bg-gray-100 py-8 px-4",children:i.jsxs("div",{className:"max-w-5xl mx-auto",children:[i.jsx("div",{className:"mb-8 text-center",children:i.jsx("h1",{className:"text-3xl font-bold text-solace-purple",children:"Solace Agent Mesh Configuration Portal"})}),i.jsxs("div",{className:"bg-white shadow-xl rounded-lg p-6 md:p-8 min-h-[500px]",children:[e==="initialize"&&i.jsx(qi,{}),e==="addAgent"&&i.jsx(ns,{}),e==="pluginCatalog"&&i.jsx(Yc,{}),e==="addGateway"&&i.jsx(tu,{})]}),i.jsx("footer",{className:"mt-12 text-center text-sm text-gray-500",children:i.jsxs("p",{children:["© ",new Date().getFullYear()," Solace Agent Mesh. All rights reserved."]})})]})})}export{su as default,iu as meta};
