turbollm 1.2.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +809 -153
  3. package/dist/webdist/assets/{ChatScreen-Di2U5guk.js → ChatScreen-DY2flMe9.js} +1 -1
  4. package/dist/webdist/assets/{CustomizeScreen-C1N3VSzu.js → CustomizeScreen-Cl6H68Sy.js} +4 -4
  5. package/dist/webdist/assets/DeveloperScreen-zC1nePXh.js +1 -0
  6. package/dist/webdist/assets/EnginesScreen-CrsziC3B.js +7 -0
  7. package/dist/webdist/assets/ModelDetailDialog-BOvumdHI.js +1 -0
  8. package/dist/webdist/assets/{ModelDirs-z0eidPHf.js → ModelDirs-Bj-XrX0c.js} +1 -1
  9. package/dist/webdist/assets/ModelsScreen-BTir-kDY.js +1 -0
  10. package/dist/webdist/assets/SettingsScreen-B696egCa.js +1 -0
  11. package/dist/webdist/assets/check-DFwkcl_5.js +1 -0
  12. package/dist/webdist/assets/{circle-x-nfGRpYmv.js → circle-x-CsuAddI_.js} +1 -1
  13. package/dist/webdist/assets/{common-VLx-PnhW.js → common-DIXPIrUd.js} +1 -1
  14. package/dist/webdist/assets/{copy-button-DvxLdCBa.js → copy-button-BtQZA6P8.js} +1 -1
  15. package/dist/webdist/assets/{dialog-BQ-Ai22D.js → dialog-Dpyml8ZT.js} +1 -1
  16. package/dist/webdist/assets/index-BklQn62W.css +1 -0
  17. package/dist/webdist/assets/{index-BGye3qtk.js → index-sjgdofsd.js} +7 -7
  18. package/dist/webdist/assets/{pencil-fITP-Ux2.js → pencil-BuQwoNyj.js} +1 -1
  19. package/dist/webdist/assets/{personas-Cq8LxYil.js → personas-CQapYHeK.js} +1 -1
  20. package/dist/webdist/assets/{plus-nMHxYBqJ.js → plus-B1w15FoZ.js} +1 -1
  21. package/dist/webdist/assets/{radix-C-SVreIl.js → radix-BFvMxQq9.js} +1 -1
  22. package/dist/webdist/assets/refresh-cw-BoAcjLtt.js +1 -0
  23. package/dist/webdist/assets/save-DE1APWTG.js +1 -0
  24. package/dist/webdist/assets/{skeleton-CSAyV68N.js → skeleton-Dvq8tYzC.js} +1 -1
  25. package/dist/webdist/assets/{sparkles-Cs6GG6EW.js → sparkles-C54kYWeQ.js} +1 -1
  26. package/dist/webdist/assets/{trash-2-BdOxLswi.js → trash-2-DIMVgidH.js} +1 -1
  27. package/dist/webdist/index.html +3 -3
  28. package/package.json +1 -1
  29. package/dist/webdist/assets/DeveloperScreen-DWf0TZqq.js +0 -1
  30. package/dist/webdist/assets/EnginesScreen-Dqy-jlqZ.js +0 -5
  31. package/dist/webdist/assets/ModelDetailDialog-BRKjfp4G.js +0 -1
  32. package/dist/webdist/assets/ModelsScreen-DqIQ4ST-.js +0 -1
  33. package/dist/webdist/assets/SettingsScreen-DXp8YTPJ.js +0 -1
  34. package/dist/webdist/assets/check-BnpDXpw8.js +0 -1
  35. package/dist/webdist/assets/external-link-CO5laD7p.js +0 -1
  36. package/dist/webdist/assets/index-Bx0PAdfC.css +0 -1
  37. package/dist/webdist/assets/save-Cm1zJnW7.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as g}from"./radix-C-SVreIl.js";import{j as Cr,r as X,k as os,l as ss}from"./vendor-D_-14Whs.js";import{u as Dn,a as ls,g as ri,b as cs,c as us,P as ua,d as ii,e as ds,f as ps,s as fs,h as gs}from"./personas-Cq8LxYil.js";import{c as gt,B as Be,L as da,D as fr,I as ms,t as De,C as hs,S as bs,A as Bt,u as xs,a as ys,b as Es,d as _s,e as ai,X as mn,g as ks,f as ws,h as Ns,i as Ss}from"./index-BGye3qtk.js";import{C as gr,a as oi}from"./copy-button-DvxLdCBa.js";import{P as pa}from"./pencil-fITP-Ux2.js";import{T as mr}from"./trash-2-BdOxLswi.js";import{R as vs}from"./save-Cm1zJnW7.js";import{C as rn,a as Ar,b as Ts,D as Cs,c as As,d as Is,e as Os,f as Rs,g as Ms,h as Ds,i as Ls,j as Ps,k as Bs}from"./dialog-BQ-Ai22D.js";import{C as Fs}from"./circle-x-nfGRpYmv.js";import{S as zs,a as Us,M as $s}from"./ModelDetailDialog-BRKjfp4G.js";import{C as js}from"./check-BnpDXpw8.js";import"./external-link-CO5laD7p.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ks=gt("arrow-down",Hs);const Gs=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],qs=gt("brain",Gs);const Ws=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vs=gt("chevron-left",Ws);const Ys=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zs=gt("file-text",Ys);const Xs=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],si=gt("message-square-plus",Xs);const Qs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Js=gt("paperclip",Qs);const el=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],tl=gt("send-horizontal",el);const nl=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],rl=gt("share-2",nl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],al=gt("square",il);const ol=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],sl=gt("user-round",ol);function ll(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ul=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dl={};function li(e,t){return(dl.jsx?ul:cl).test(e)}const pl=/[ \t\n\f\r]/g;function fl(e){return typeof e=="object"?e.type==="text"?ci(e.value):!1:ci(e)}function ci(e){return e.replace(pl,"")===""}class an{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}an.prototype.normal={};an.prototype.property={};an.prototype.space=void 0;function fa(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new an(n,r,t)}function hr(e){return e.toLowerCase()}class Ge{constructor(t,n){this.attribute=n,this.property=t}}Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let gl=0;const ne=It(),Se=It(),br=It(),R=It(),xe=It(),Ct=It(),We=It();function It(){return 2**++gl}const xr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:Se,commaOrSpaceSeparated:We,commaSeparated:Ct,number:R,overloadedBoolean:br,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),Wn=Object.keys(xr);class Ir extends Ge{constructor(t,n,r,i){let o=-1;if(super(t,n),ui(this,"space",i),typeof r=="number")for(;++o<Wn.length;){const a=Wn[o];ui(this,Wn[o],(r&xr[a])===xr[a])}}}Ir.prototype.defined=!0;function ui(e,t,n){n&&(e[t]=n)}function jt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Ir(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hr(r)]=r,n[hr(o.attribute)]=r}return new an(t,n,e.space)}const ga=jt({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:xe,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:R,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:xe,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:Se,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ma(e,t){return t in e?e[t]:t}function ha(e,t){return ma(e,t.toLowerCase())}const ml=jt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ct,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alpha:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:xe,autoFocus:ne,autoPlay:ne,blocking:xe,capture:null,charSet:null,checked:ne,cite:null,className:xe,closedBy:null,colorSpace:null,cols:R,colSpan:R,command:null,commandFor:null,content:null,contentEditable:Se,controls:ne,controlsList:xe,coords:R|Ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:br,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:xe,height:R,hidden:br,high:R,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:xe,itemRef:xe,itemScope:ne,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,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:ne,optimum:R,pattern:null,ping:xe,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:xe,required:ne,reversed:ne,rows:R,rowSpan:R,sandbox:xe,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootCustomElementRegistry:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shadowRootSerializable:ne,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:Se,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ne,disablePictureInPicture:ne,disableRemotePlayback:ne,exportParts:Ct,part:xe,prefix:null,property:null,results:R,security:null,unselectable:null},space:"html",transform:ha}),hl=jt({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",maskType:"mask-type",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:We,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:xe,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:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,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:Ct,g2:Ct,glyphName:Ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,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:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,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:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ma}),ba=jt({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()}}),xa=jt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ha}),ya=jt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bl={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"},xl=/[A-Z]/g,di=/-[a-z]/g,yl=/^data[-\w.:]+$/i;function El(e,t){const n=hr(t);let r=t,i=Ge;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yl.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(di,kl);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!di.test(o)){let a=o.replace(xl,_l);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ir}return new i(r,t)}function _l(e){return"-"+e.toLowerCase()}function kl(e){return e.charAt(1).toUpperCase()}const wl=fa([ga,ml,ba,xa,ya],"html"),Or=fa([ga,hl,ba,xa,ya],"svg");function Nl(e){return e.join(" ").trim()}var Lt={},Vn,pi;function Sl(){if(pi)return Vn;pi=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
1
+ import{j as g}from"./radix-BFvMxQq9.js";import{j as Cr,r as X,k as os,l as ss}from"./vendor-D_-14Whs.js";import{u as Dn,a as ls,g as ri,b as cs,c as us,P as ua,d as ii,e as ds,f as ps,s as fs,h as gs}from"./personas-CQapYHeK.js";import{c as gt,B as Be,L as da,D as fr,I as ms,t as De,C as hs,S as bs,A as Bt,u as xs,a as ys,b as Es,d as _s,e as ai,X as mn,g as ks,f as ws,h as Ns,i as Ss}from"./index-sjgdofsd.js";import{C as gr,a as oi}from"./copy-button-BtQZA6P8.js";import{P as pa}from"./pencil-BuQwoNyj.js";import{T as mr}from"./trash-2-DIMVgidH.js";import{R as vs}from"./refresh-cw-BoAcjLtt.js";import{C as rn,a as Ar,b as Ts,D as Cs,c as As,d as Is,e as Os,f as Rs,g as Ms,h as Ds,i as Ls,j as Ps,k as Bs}from"./dialog-Dpyml8ZT.js";import{C as Fs}from"./circle-x-CsuAddI_.js";import{S as zs,a as Us,M as $s}from"./ModelDetailDialog-BOvumdHI.js";import{C as js}from"./check-DFwkcl_5.js";import"./save-DE1APWTG.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ks=gt("arrow-down",Hs);const Gs=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],qs=gt("brain",Gs);const Ws=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vs=gt("chevron-left",Ws);const Ys=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zs=gt("file-text",Ys);const Xs=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],si=gt("message-square-plus",Xs);const Qs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Js=gt("paperclip",Qs);const el=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],tl=gt("send-horizontal",el);const nl=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],rl=gt("share-2",nl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],al=gt("square",il);const ol=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],sl=gt("user-round",ol);function ll(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ul=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dl={};function li(e,t){return(dl.jsx?ul:cl).test(e)}const pl=/[ \t\n\f\r]/g;function fl(e){return typeof e=="object"?e.type==="text"?ci(e.value):!1:ci(e)}function ci(e){return e.replace(pl,"")===""}class an{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}an.prototype.normal={};an.prototype.property={};an.prototype.space=void 0;function fa(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new an(n,r,t)}function hr(e){return e.toLowerCase()}class Ge{constructor(t,n){this.attribute=n,this.property=t}}Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let gl=0;const ne=It(),Se=It(),br=It(),R=It(),xe=It(),Ct=It(),We=It();function It(){return 2**++gl}const xr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:Se,commaOrSpaceSeparated:We,commaSeparated:Ct,number:R,overloadedBoolean:br,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),Wn=Object.keys(xr);class Ir extends Ge{constructor(t,n,r,i){let o=-1;if(super(t,n),ui(this,"space",i),typeof r=="number")for(;++o<Wn.length;){const a=Wn[o];ui(this,Wn[o],(r&xr[a])===xr[a])}}}Ir.prototype.defined=!0;function ui(e,t,n){n&&(e[t]=n)}function jt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Ir(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hr(r)]=r,n[hr(o.attribute)]=r}return new an(t,n,e.space)}const ga=jt({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:xe,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:R,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:xe,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:Se,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ma(e,t){return t in e?e[t]:t}function ha(e,t){return ma(e,t.toLowerCase())}const ml=jt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ct,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alpha:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:xe,autoFocus:ne,autoPlay:ne,blocking:xe,capture:null,charSet:null,checked:ne,cite:null,className:xe,closedBy:null,colorSpace:null,cols:R,colSpan:R,command:null,commandFor:null,content:null,contentEditable:Se,controls:ne,controlsList:xe,coords:R|Ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:br,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:xe,height:R,hidden:br,high:R,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:xe,itemRef:xe,itemScope:ne,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,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:ne,optimum:R,pattern:null,ping:xe,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:xe,required:ne,reversed:ne,rows:R,rowSpan:R,sandbox:xe,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootCustomElementRegistry:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shadowRootSerializable:ne,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:Se,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ne,disablePictureInPicture:ne,disableRemotePlayback:ne,exportParts:Ct,part:xe,prefix:null,property:null,results:R,security:null,unselectable:null},space:"html",transform:ha}),hl=jt({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",maskType:"mask-type",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:We,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:xe,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:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,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:Ct,g2:Ct,glyphName:Ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,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:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,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:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ma}),ba=jt({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()}}),xa=jt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ha}),ya=jt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bl={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"},xl=/[A-Z]/g,di=/-[a-z]/g,yl=/^data[-\w.:]+$/i;function El(e,t){const n=hr(t);let r=t,i=Ge;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yl.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(di,kl);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!di.test(o)){let a=o.replace(xl,_l);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ir}return new i(r,t)}function _l(e){return"-"+e.toLowerCase()}function kl(e){return e.charAt(1).toUpperCase()}const wl=fa([ga,ml,ba,xa,ya],"html"),Or=fa([ga,hl,ba,xa,ya],"svg");function Nl(e){return e.join(" ").trim()}var Lt={},Vn,pi;function Sl(){if(pi)return Vn;pi=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
2
2
  `,c="/",u="*",d="",f="comment",p="declaration";function h(_,E){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];E=E||{};var T=1,S=1;function O(B){var I=B.match(t);I&&(T+=I.length);var J=B.lastIndexOf(l);S=~J?B.length-J:S+B.length}function L(){var B={line:T,column:S};return function(I){return I.position=new w(B),G(),I}}function w(B){this.start=B,this.end={line:T,column:S},this.source=E.source}w.prototype.content=_;function j(B){var I=new Error(E.source+":"+T+":"+S+": "+B);if(I.reason=B,I.filename=E.source,I.line=T,I.column=S,I.source=_,!E.silent)throw I}function K(B){var I=B.exec(_);if(I){var J=I[0];return O(J),_=_.slice(J.length),I}}function G(){K(n)}function N(B){var I;for(B=B||[];I=F();)I!==!1&&B.push(I);return B}function F(){var B=L();if(!(c!=_.charAt(0)||u!=_.charAt(1))){for(var I=2;d!=_.charAt(I)&&(u!=_.charAt(I)||c!=_.charAt(I+1));)++I;if(I+=2,d===_.charAt(I-1))return j("End of comment missing");var J=_.slice(2,I-2);return S+=2,O(J),_=_.slice(I),S+=2,B({type:f,comment:J})}}function U(){var B=L(),I=K(r);if(I){if(F(),!K(i))return j("property missing ':'");var J=K(o),se=B({type:p,property:y(I[0].replace(e,d)),value:J?y(J[0].replace(e,d)):d});return K(a),se}}function te(){var B=[];N(B);for(var I;I=U();)I!==!1&&(B.push(I),N(B));return B}return G(),te()}function y(_){return _?_.replace(s,d):d}return Vn=h,Vn}var fi;function vl(){if(fi)return Lt;fi=1;var e=Lt&&Lt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.default=n;const t=e(Sl());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;s?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return Lt}var Wt={},gi;function Tl(){if(gi)return Wt;gi=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},a=function(c,u){return u.toUpperCase()},s=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,s):c=c.replace(r,s),c.replace(t,a))};return Wt.camelCase=l,Wt}var Vt,mi;function Cl(){if(mi)return Vt;mi=1;var e=Vt&&Vt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(vl()),n=Tl();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,Vt=r,Vt}var Al=Cl();const Il=Cr(Al),Ea=_a("end"),Rr=_a("start");function _a(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 Ol(e){const t=Rr(e),n=Ea(e);if(t&&n)return{start:t,end:n}}function Qt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hi(e.position):"start"in e||"end"in e?hi(e):"line"in e||"column"in e?yr(e):""}function yr(e){return bi(e&&e.line)+":"+bi(e&&e.column)}function hi(e){return yr(e&&e.start)+"-"+yr(e&&e.end)}function bi(e){return e&&typeof e=="number"?e:1}class ze extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Qt(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ze.prototype.file="";ze.prototype.name="";ze.prototype.reason="";ze.prototype.message="";ze.prototype.stack="";ze.prototype.column=void 0;ze.prototype.line=void 0;ze.prototype.ancestors=void 0;ze.prototype.cause=void 0;ze.prototype.fatal=void 0;ze.prototype.place=void 0;ze.prototype.ruleId=void 0;ze.prototype.source=void 0;const Mr={}.hasOwnProperty,Rl=new Map,Ml=/[A-Z]/g,Dl=new Set(["table","tbody","thead","tfoot","tr"]),Ll=new Set(["td","th"]),ka="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Pl(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=Kl(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=Hl(n,t.jsx,t.jsxs)}const i={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"?Or:wl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=wa(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function wa(e,t,n){if(t.type==="element")return Bl(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Fl(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ul(e,t,n);if(t.type==="mdxjsEsm")return zl(e,t);if(t.type==="root")return $l(e,t,n);if(t.type==="text")return jl(e,t)}function Bl(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Or,e.schema=i),e.ancestors.push(t);const o=Sa(e,t.tagName,!1),a=Gl(e,t);let s=Lr(e,t);return Dl.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!fl(l):!0})),Na(e,a,o,t),Dr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Fl(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)}tn(e,t.position)}function zl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);tn(e,t.position)}function Ul(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Or,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Sa(e,t.name,!0),a=ql(e,t),s=Lr(e,t);return Na(e,a,o,t),Dr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function $l(e,t,n){const r={};return Dr(r,Lr(e,t)),e.create(t,e.Fragment,r,n)}function jl(e,t){return t.value}function Na(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Dr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Hl(e,t,n){return r;function r(i,o,a,s){const c=Array.isArray(a.children)?n:t;return s?c(o,a,s):c(o,a)}}function Kl(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=Rr(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Gl(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Mr.call(t.properties,i)){const o=Wl(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&Ll.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ql(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else tn(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else tn(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Lr(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Rl;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const s=wa(e,o,a);s!==void 0&&n.push(s)}return n}function Wl(e,t,n){const r=El(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ll(n):Nl(n)),r.property==="style"){let i=typeof n=="object"?n:Vl(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Yl(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?bl[r.property]||r.property:r.attribute,n]}}function Vl(e,t){try{return Il(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ze("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=ka+"#cannot-parse-style-attribute",i}}function Sa(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const s=li(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=a}else r=li(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Mr.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);tn(e)}function tn(e,t){const n=new ze("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=ka+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Yl(e){const t={};let n;for(n in e)Mr.call(e,n)&&(t[Zl(n)]=e[n]);return t}function Zl(e){let t=e.replace(Ml,Xl);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Xl(e){return"-"+e.toLowerCase()}const Yn={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"]},Ql={};function Pr(e,t){const n=Ql,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return va(e,r,i)}function va(e,t,n){if(Jl(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 xi(e.children,t,n)}return Array.isArray(e)?xi(e,t,n):""}function xi(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=va(e[i],t,n);return r.join("")}function Jl(e){return!!(e&&typeof e=="object")}const yi=document.createElement("i");function Br(e){const t="&"+e+";";yi.innerHTML=t;const n=yi.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ve(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function Je(e,t){return e.length>0?(Ve(e,e.length,0,t),e):t}const Ei={}.hasOwnProperty;function Ta(e){const t={};let n=-1;for(;++n<e.length;)ec(t,e[n]);return t}function ec(e,t){let n;for(n in t){const i=(Ei.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Ei.call(i,a)||(i[a]=[]);const s=o[a];tc(i[a],Array.isArray(s)?s:s?[s]:[])}}}function tc(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 Ca(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 ot(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const je=Nt(/[A-Za-z]/),Fe=Nt(/[\dA-Za-z]/),nc=Nt(/[#-'*+\--9=?A-Z^-~]/);function Tn(e){return e!==null&&(e<32||e===127)}const Er=Nt(/\d/),rc=Nt(/[\dA-Fa-f]/),ic=Nt(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function ye(e){return e!==null&&(e<0||e===32)}function oe(e){return e===-2||e===-1||e===32}const Ln=Nt(new RegExp("\\p{P}|\\p{S}","u")),At=Nt(/\s/);function Nt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ht(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Fe(e.charCodeAt(n+1))&&Fe(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function de(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return oe(l)?(e.enter(n),s(l)):t(l)}function s(l){return oe(l)&&o++<i?(e.consume(l),s):(e.exit(n),t(l))}}const ac={tokenize:oc};function oc(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),de(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Y(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),a)}}const sc={tokenize:lc},_i={tokenize:cc};function lc(e){const t=this,n=[];let r=0,i,o,a;return s;function s(S){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&T();const O=t.events.length;let L=O,w;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){w=t.events[L][1].end;break}E(r);let j=O;for(;j<t.events.length;)t.events[j][1].end={...w},j++;return Ve(t.events,L+1,0,t.events.slice(O)),t.events.length=j,c(S)}return s(S)}function c(S){if(r===n.length){if(!i)return f(S);if(i.currentConstruct&&i.currentConstruct.concrete)return h(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_i,u,d)(S)}function u(S){return i&&T(),E(r),f(S)}function d(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,h(S)}function f(S){return t.containerState={},e.attempt(_i,p,h)(S)}function p(S){return r++,n.push([t.currentConstruct,t.containerState]),f(S)}function h(S){if(S===null){i&&T(),E(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),y(S)}function y(S){if(S===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(S);return}return Y(S)?(e.consume(S),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(S),y)}function _(S,O){const L=t.sliceStream(S);if(O&&L.push(null),S.previous=o,o&&(o.next=S),o=S,i.defineSkip(S.start),i.write(L),t.parser.lazy[S.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<a&&(!i.events[w][1].end||i.events[w][1].end.offset>a))return;const j=t.events.length;let K=j,G,N;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(G){N=t.events[K][1].end;break}G=!0}for(E(r),w=j;w<t.events.length;)t.events[w][1].end={...N},w++;Ve(t.events,K+1,0,t.events.slice(j)),t.events.length=w}}function E(S){let O=n.length;for(;O-- >S;){const L=n[O];t.containerState=L[1],L[0].exit.call(t,e)}n.length=S}function T(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cc(e,t,n){return de(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $t(e){if(e===null||ye(e)||At(e))return 1;if(Ln(e))return 2}function Pn(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const _r={name:"attention",resolveAll:uc,tokenize:dc};function uc(e,t){let n=-1,r,i,o,a,s,l,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;l=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 d={...e[r][1].end},f={...e[n][1].start};ki(d,-l),ki(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Je(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Je(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),c=Je(c,Pn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Je(c,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Je(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 dc(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=$t(r);let o;return a;function a(l){return o=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===o)return e.consume(l),s;const c=e.exit("attentionSequence"),u=$t(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?d:d&&(i||!f)),c._close=!!(o===42?f:f&&(u||!d)),t(l)}}function ki(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pc={name:"autolink",tokenize:fc};function fc(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return je(p)?(e.consume(p),a):p===64?n(p):c(p)}function a(p){return p===43||p===45||p===46||Fe(p)?(r=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Fe(p))&&r++<32?(e.consume(p),s):(r=0,c(p))}function l(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||Tn(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):nc(p)?(e.consume(p),c):n(p)}function u(p){return Fe(p)?d(p):n(p)}function d(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):f(p)}function f(p){if((p===45||Fe(p))&&r++<63){const h=p===45?f:d;return e.consume(p),h}return n(p)}}const on={partial:!0,tokenize:gc};function gc(e,t,n){return r;function r(o){return oe(o)?de(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Y(o)?t(o):n(o)}}const Aa={continuation:{tokenize:hc},exit:bc,name:"blockQuote",tokenize:mc};function mc(e,t,n){const r=this;return i;function i(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return oe(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function hc(e,t,n){const r=this;return i;function i(a){return oe(a)?de(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(Aa,t,n)(a)}}function bc(e){e.exit("blockQuote")}const Ia={name:"characterEscape",tokenize:xc};function xc(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return ic(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Oa={name:"characterReference",tokenize:yc};function yc(e,t,n){const r=this;let i=0,o,a;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,a=Fe,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=rc,u):(e.enter("characterReferenceValue"),o=7,a=Er,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return a===Fe&&!Br(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&i++<o?(e.consume(d),u):n(d)}}const wi={partial:!0,tokenize:_c},Ni={concrete:!0,name:"codeFenced",tokenize:Ec};function Ec(e,t,n){const r=this,i={partial:!0,tokenize:L};let o=0,a=0,s;return l;function l(w){return c(w)}function c(w){const j=r.events[r.events.length-1];return o=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===s?(a++,e.consume(w),u):a<3?n(w):(e.exit("codeFencedFenceSequence"),oe(w)?de(e,d,"whitespace")(w):d(w))}function d(w){return w===null||Y(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(wi,y,O)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||Y(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(w)):oe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),de(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),f)}function p(w){return w===null||Y(w)?d(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||Y(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(w)):w===96&&w===s?n(w):(e.consume(w),h)}function y(w){return e.attempt(i,O,_)(w)}function _(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),E}function E(w){return o>0&&oe(w)?de(e,T,"linePrefix",o+1)(w):T(w)}function T(w){return w===null||Y(w)?e.check(wi,y,O)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||Y(w)?(e.exit("codeFlowValue"),T(w)):(e.consume(w),S)}function O(w){return e.exit("codeFenced"),t(w)}function L(w,j,K){let G=0;return N;function N(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),F}function F(I){return w.enter("codeFencedFence"),oe(I)?de(w,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return I===s?(w.enter("codeFencedFenceSequence"),te(I)):K(I)}function te(I){return I===s?(G++,w.consume(I),te):G>=a?(w.exit("codeFencedFenceSequence"),oe(I)?de(w,B,"whitespace")(I):B(I)):K(I)}function B(I){return I===null||Y(I)?(w.exit("codeFencedFence"),j(I)):K(I)}}}function _c(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Zn={name:"codeIndented",tokenize:wc},kc={partial:!0,tokenize:Nc};function wc(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),de(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Y(c)?e.attempt(kc,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||Y(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function Nc(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Y(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):de(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):Y(a)?i(a):n(a)}}const Sc={name:"codeText",previous:Tc,resolve:vc,tokenize:Cc};function vc(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Tc(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Cc(e,t,n){let r=0,i,o;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(o=e.enter("codeTextSequence"),i=0,u(d)):Y(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Y(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(o.type="codeTextData",c(d))}}class Ac{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 i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yt(this.left,r),o.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),Yt(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yt(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);Yt(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Yt(this.left,n.reverse())}}}function Yt(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 Ra(e){const t={};let n=-1,r,i,o,a,s,l,c;const u=new Ac(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"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Ic(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=u.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ve(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Ic(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let u,d,f=-1,p=n,h=0,y=0;const _=[y];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(y=f+1,_.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),f=_.length;f--;){const E=s.slice(_[f],_[f+1]),T=o.pop();l.push([T,T+E.length-1]),e.splice(T,2,E)}for(l.reverse(),f=-1;++f<l.length;)c[h+l[f][0]]=h+l[f][1],h+=l[f][1]-l[f][0]-1;return c}const Oc={resolve:Mc,tokenize:Dc},Rc={partial:!0,tokenize:Lc};function Mc(e){return Ra(e),e}function Dc(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):Y(s)?e.check(Rc,a,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Lc(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),de(e,o,"linePrefix")}function o(a){if(a===null||Y(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Ma(e,t,n,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(E){return E===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(E),e.exit(o),f):E===null||E===32||E===41||Tn(E)?n(E):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(E))}function f(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(s),f(E)):E===null||E===60||Y(E)?n(E):(e.consume(E),E===92?h:p)}function h(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function y(E){return!u&&(E===null||E===41||ye(E))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(E)):u<c&&E===40?(e.consume(E),u++,y):E===41?(e.consume(E),u--,y):E===null||E===32||E===40||Tn(E)?n(E):(e.consume(E),E===92?_:y)}function _(E){return E===40||E===41||E===92?(e.consume(E),y):y(E)}}function Da(e,t,n,r,i,o){const a=this;let s=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Y(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Y(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!oe(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function La(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),c(f))}function c(f){return f===a?(e.exit(o),l(a)):f===null?n(f):Y(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),de(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||Y(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(e.consume(f),u):u(f)}}function Jt(e,t){let n;return r;function r(i){return Y(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):oe(i)?de(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Pc={name:"definition",tokenize:Fc},Bc={partial:!0,tokenize:zc};function Fc(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return Da.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ot(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ye(p)?Jt(e,c)(p):c(p)}function c(p){return Ma(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Bc,d,d)(p)}function d(p){return oe(p)?de(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Y(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function zc(e,t,n){return r;function r(s){return ye(s)?Jt(e,i)(s):n(s)}function i(s){return La(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return oe(s)?de(e,a,"whitespace")(s):a(s)}function a(s){return s===null||Y(s)?t(s):n(s)}}const Uc={name:"hardBreakEscape",tokenize:$c};function $c(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Y(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const jc={name:"headingAtx",resolve:Hc,tokenize:Kc};function Hc(e,t){let n=e.length-2,r=3,i,o;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ve(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function Kc(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(e.consume(u),a):u===null||ye(u)?(e.exit("atxHeadingSequence"),s(u)):n(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Y(u)?(e.exit("atxHeading"),t(u)):oe(u)?de(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||ye(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}const Gc=["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"],Si=["pre","script","style","textarea"],qc={concrete:!0,name:"htmlFlow",resolveTo:Yc,tokenize:Zc},Wc={partial:!0,tokenize:Qc},Vc={partial:!0,tokenize:Xc};function Yc(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 Zc(e,t,n){const r=this;let i,o,a,s,l;return c;function c(x){return u(x)}function u(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),d}function d(x){return x===33?(e.consume(x),f):x===47?(e.consume(x),o=!0,y):x===63?(e.consume(x),i=3,r.interrupt?t:b):je(x)?(e.consume(x),a=String.fromCharCode(x),_):n(x)}function f(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,s=0,h):je(x)?(e.consume(x),i=4,r.interrupt?t:b):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:b):n(x)}function h(x){const ve="CDATA[";return x===ve.charCodeAt(s++)?(e.consume(x),s===ve.length?r.interrupt?t:U:h):n(x)}function y(x){return je(x)?(e.consume(x),a=String.fromCharCode(x),_):n(x)}function _(x){if(x===null||x===47||x===62||ye(x)){const ve=x===47,Oe=a.toLowerCase();return!ve&&!o&&Si.includes(Oe)?(i=1,r.interrupt?t(x):U(x)):Gc.includes(a.toLowerCase())?(i=6,ve?(e.consume(x),E):r.interrupt?t(x):U(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):o?T(x):S(x))}return x===45||Fe(x)?(e.consume(x),a+=String.fromCharCode(x),_):n(x)}function E(x){return x===62?(e.consume(x),r.interrupt?t:U):n(x)}function T(x){return oe(x)?(e.consume(x),T):N(x)}function S(x){return x===47?(e.consume(x),N):x===58||x===95||je(x)?(e.consume(x),O):oe(x)?(e.consume(x),S):N(x)}function O(x){return x===45||x===46||x===58||x===95||Fe(x)?(e.consume(x),O):L(x)}function L(x){return x===61?(e.consume(x),w):oe(x)?(e.consume(x),L):S(x)}function w(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),l=x,j):oe(x)?(e.consume(x),w):K(x)}function j(x){return x===l?(e.consume(x),l=null,G):x===null||Y(x)?n(x):(e.consume(x),j)}function K(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ye(x)?L(x):(e.consume(x),K)}function G(x){return x===47||x===62||oe(x)?S(x):n(x)}function N(x){return x===62?(e.consume(x),F):n(x)}function F(x){return x===null||Y(x)?U(x):oe(x)?(e.consume(x),F):n(x)}function U(x){return x===45&&i===2?(e.consume(x),J):x===60&&i===1?(e.consume(x),se):x===62&&i===4?(e.consume(x),fe):x===63&&i===3?(e.consume(x),b):x===93&&i===5?(e.consume(x),me):Y(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Wc,ue,te)(x)):x===null||Y(x)?(e.exit("htmlFlowData"),te(x)):(e.consume(x),U)}function te(x){return e.check(Vc,B,ue)(x)}function B(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),I}function I(x){return x===null||Y(x)?te(x):(e.enter("htmlFlowData"),U(x))}function J(x){return x===45?(e.consume(x),b):U(x)}function se(x){return x===47?(e.consume(x),a="",ee):U(x)}function ee(x){if(x===62){const ve=a.toLowerCase();return Si.includes(ve)?(e.consume(x),fe):U(x)}return je(x)&&a.length<8?(e.consume(x),a+=String.fromCharCode(x),ee):U(x)}function me(x){return x===93?(e.consume(x),b):U(x)}function b(x){return x===62?(e.consume(x),fe):x===45&&i===2?(e.consume(x),b):U(x)}function fe(x){return x===null||Y(x)?(e.exit("htmlFlowData"),ue(x)):(e.consume(x),fe)}function ue(x){return e.exit("htmlFlow"),t(x)}}function Xc(e,t,n){const r=this;return i;function i(a){return Y(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Qc(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(on,t,n)}}const Jc={name:"htmlText",tokenize:eu};function eu(e,t,n){const r=this;let i,o,a;return s;function s(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),c):b===47?(e.consume(b),L):b===63?(e.consume(b),S):je(b)?(e.consume(b),K):n(b)}function c(b){return b===45?(e.consume(b),u):b===91?(e.consume(b),o=0,h):je(b)?(e.consume(b),T):n(b)}function u(b){return b===45?(e.consume(b),p):n(b)}function d(b){return b===null?n(b):b===45?(e.consume(b),f):Y(b)?(a=d,se(b)):(e.consume(b),d)}function f(b){return b===45?(e.consume(b),p):d(b)}function p(b){return b===62?J(b):b===45?f(b):d(b)}function h(b){const fe="CDATA[";return b===fe.charCodeAt(o++)?(e.consume(b),o===fe.length?y:h):n(b)}function y(b){return b===null?n(b):b===93?(e.consume(b),_):Y(b)?(a=y,se(b)):(e.consume(b),y)}function _(b){return b===93?(e.consume(b),E):y(b)}function E(b){return b===62?J(b):b===93?(e.consume(b),E):y(b)}function T(b){return b===null||b===62?J(b):Y(b)?(a=T,se(b)):(e.consume(b),T)}function S(b){return b===null?n(b):b===63?(e.consume(b),O):Y(b)?(a=S,se(b)):(e.consume(b),S)}function O(b){return b===62?J(b):S(b)}function L(b){return je(b)?(e.consume(b),w):n(b)}function w(b){return b===45||Fe(b)?(e.consume(b),w):j(b)}function j(b){return Y(b)?(a=j,se(b)):oe(b)?(e.consume(b),j):J(b)}function K(b){return b===45||Fe(b)?(e.consume(b),K):b===47||b===62||ye(b)?G(b):n(b)}function G(b){return b===47?(e.consume(b),J):b===58||b===95||je(b)?(e.consume(b),N):Y(b)?(a=G,se(b)):oe(b)?(e.consume(b),G):J(b)}function N(b){return b===45||b===46||b===58||b===95||Fe(b)?(e.consume(b),N):F(b)}function F(b){return b===61?(e.consume(b),U):Y(b)?(a=F,se(b)):oe(b)?(e.consume(b),F):G(b)}function U(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),i=b,te):Y(b)?(a=U,se(b)):oe(b)?(e.consume(b),U):(e.consume(b),B)}function te(b){return b===i?(e.consume(b),i=void 0,I):b===null?n(b):Y(b)?(a=te,se(b)):(e.consume(b),te)}function B(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||ye(b)?G(b):(e.consume(b),B)}function I(b){return b===47||b===62||ye(b)?G(b):n(b)}function J(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function se(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ee}function ee(b){return oe(b)?de(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):me(b)}function me(b){return e.enter("htmlTextData"),a(b)}}const Fr={name:"labelEnd",resolveAll:iu,resolveTo:au,tokenize:ou},tu={tokenize:su},nu={tokenize:lu},ru={tokenize:cu};function iu(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ve(e,0,e.length,n),e}function au(e,t){let n=e.length,r=0,i,o,a,s;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=Je(s,e.slice(o+1,o+r+3)),s=Je(s,[["enter",u,t]]),s=Je(s,Pn(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),s=Je(s,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),s=Je(s,e.slice(a+1)),s=Je(s,[["exit",l,t]]),Ve(e,o,e.length,s),e}function ou(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(f){return o?o._inactive?d(f):(a=r.parser.defined.includes(ot(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(tu,u,a?u:d)(f):f===91?e.attempt(nu,u,a?c:d)(f):a?u(f):d(f)}function c(f){return e.attempt(ru,u,d)(f)}function u(f){return t(f)}function d(f){return o._balanced=!0,n(f)}}function su(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ye(d)?Jt(e,o)(d):o(d)}function o(d){return d===41?u(d):Ma(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return ye(d)?Jt(e,l)(d):u(d)}function s(d){return n(d)}function l(d){return d===34||d===39||d===40?La(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ye(d)?Jt(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function lu(e,t,n){const r=this;return i;function i(s){return Da.call(r,e,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(ot(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function cu(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const uu={name:"labelStartImage",resolveAll:Fr.resolveAll,tokenize:du};function du(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const pu={name:"labelStartLink",resolveAll:Fr.resolveAll,tokenize:fu};function fu(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Xn={name:"lineEnding",tokenize:gu};function gu(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),de(e,t,"linePrefix")}}const vn={name:"thematicBreak",tokenize:mu};function mu(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,s(c)}function s(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Y(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),oe(c)?de(e,s,"whitespace")(c):s(c))}}const Ke={continuation:{tokenize:yu},exit:_u,name:"list",tokenize:xu},hu={partial:!0,tokenize:ku},bu={partial:!0,tokenize:Eu};function xu(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const h=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Er(p)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(vn,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Er(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<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(on,r.interrupt?n:u,e.attempt(hu,f,d))}function u(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return oe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function yu(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(on,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,de(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!oe(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bu,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,de(e,e.attempt(Ke,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Eu(e,t,n){const r=this;return de(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function _u(e){e.exit(this.containerState.type)}function ku(e,t,n){const r=this;return de(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!oe(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const vi={name:"setextUnderline",resolveTo:wu,tokenize:Nu};function wu(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function Nu(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),oe(c)?de(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Y(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Su={tokenize:vu};function vu(e){const t=this,n=e.attempt(on,r,e.attempt(this.parser.constructs.flowInitial,i,de(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Oc,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Tu={resolveAll:Ba()},Cu=Pa("string"),Au=Pa("text");function Pa(e){return{resolveAll:Ba(e==="text"?Iu:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(u){return c(u)?o(u):s(u)}function s(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Ba(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function Iu(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],i=t.sliceStream(r);let o=i.length,a=-1,s=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},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 Ou={42:Ke,43:Ke,45:Ke,48:Ke,49:Ke,50:Ke,51:Ke,52:Ke,53:Ke,54:Ke,55:Ke,56:Ke,57:Ke,62:Aa},Ru={91:Pc},Mu={[-2]:Zn,[-1]:Zn,32:Zn},Du={35:jc,42:vn,45:[vi,vn],60:qc,61:vi,95:vn,96:Ni,126:Ni},Lu={38:Oa,92:Ia},Pu={[-5]:Xn,[-4]:Xn,[-3]:Xn,33:uu,38:Oa,42:_r,60:[pc,Jc],91:pu,92:[Uc,Ia],93:Fr,95:_r,96:Sc},Bu={null:[_r,Tu]},Fu={null:[42,95]},zu={null:[]},Uu=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fu,contentInitial:Ru,disable:zu,document:Ou,flow:Du,flowInitial:Mu,insideSpan:Bu,string:Lu,text:Pu},Symbol.toStringTag,{value:"Module"}));function $u(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 i={},o=[];let a=[],s=[];const l={attempt:j(L),check:j(w),consume:T,enter:S,exit:O,interrupt:j(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:h,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(F){return a=Je(a,F),_(),a[a.length-1]!==null?[]:(K(t,0),c.events=Pn(o,c.events,c),c.events)}function f(F,U){return Hu(p(F),U)}function p(F){return ju(a,F)}function h(){const{_bufferIndex:F,_index:U,line:te,column:B,offset:I}=r;return{_bufferIndex:F,_index:U,line:te,column:B,offset:I}}function y(F){i[F.line]=F.column,N()}function _(){let F;for(;r._index<a.length;){const U=a[r._index];if(typeof U=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<U.length;)E(U.charCodeAt(r._bufferIndex));else E(U)}}function E(F){u=u(F)}function T(F){Y(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,N()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function S(F,U){const te=U||{};return te.type=F,te.start=h(),c.events.push(["enter",te,c]),s.push(te),te}function O(F){const U=s.pop();return U.end=h(),c.events.push(["exit",U,c]),U}function L(F,U){K(F,U.from)}function w(F,U){U.restore()}function j(F,U){return te;function te(B,I,J){let se,ee,me,b;return Array.isArray(B)?ue(B):"tokenize"in B?ue([B]):fe(B);function fe(ke){return Ye;function Ye(we){const Ie=we!==null&&ke[we],Te=we!==null&&ke.null,et=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(Te)?Te:Te?[Te]:[]];return ue(et)(we)}}function ue(ke){return se=ke,ee=0,ke.length===0?J:x(ke[ee])}function x(ke){return Ye;function Ye(we){return b=G(),me=ke,ke.partial||(c.currentConstruct=ke),ke.name&&c.parser.constructs.disable.null.includes(ke.name)?Oe():ke.tokenize.call(U?Object.assign(Object.create(c),U):c,l,ve,Oe)(we)}}function ve(ke){return F(me,b),I}function Oe(ke){return b.restore(),++ee<se.length?x(se[ee]):J}}}function K(F,U){F.resolveAll&&!o.includes(F)&&o.push(F),F.resolve&&Ve(c.events,U,c.events.length-U,F.resolve(c.events.slice(U),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function G(){const F=h(),U=c.previous,te=c.currentConstruct,B=c.events.length,I=Array.from(s);return{from:B,restore:J};function J(){r=F,c.previous=U,c.currentConstruct=te,c.events.length=B,s=I,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ju(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function Hu(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
3
3
  `;break}case-3:{a=`\r
4
4
  `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function Ku(e){const r={constructs:Ta([Uu,...(e||{}).extensions||[]]),content:i(ac),defined:[],document:i(sc),flow:i(Su),lazy:{},string:i(Cu),text:i(Au)};return r;function i(o){return a;function a(s){return $u(r,o,s)}}}function Gu(e){for(;!Ra(e););return e}const Ti=/[\0\t\n\r]/g;function qu(){let e=1,t="",n=!0,r;return i;function i(o,a,s){const l=[];let c,u,d,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),d=0,t="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if(Ti.lastIndex=d,c=Ti.exec(o),f=c&&c.index!==void 0?c.index:o.length,p=o.charCodeAt(f),!c){t=o.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(o.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Wu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vu(e){return e.replace(Wu,Yu)}function Yu(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Ca(n.slice(o?2:1),o?16:10)}return Br(n)||e}const Fa={}.hasOwnProperty;function Zu(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Xu(n)(Gu(Ku(n).document().write(qu()(e,t,!0))))}function Xu(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(yt),autolinkProtocol:G,autolinkEmail:G,atxHeading:o(Ze),blockQuote:o(Te),characterEscape:G,characterReference:G,codeFenced:o(et),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(et,a),codeText:o(tt,a),codeTextData:G,data:G,codeFlowValue:G,definition:o(Rt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(xt),hardBreakEscape:o(le),hardBreakTrailing:o(le),htmlFlow:o(nt,a),htmlFlowData:G,htmlText:o(nt,a),htmlTextData:G,image:o(rt),label:a,link:o(yt),listItem:o(Kt),listItemValue:f,listOrdered:o(St,d),listUnordered:o(St),paragraph:o(Mt),reference:x,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ze),strong:o(st),thematicBreak:o(Dt)},exit:{atxHeading:l(),atxHeadingSequence:L,autolink:l(),autolinkEmail:Ie,autolinkProtocol:we,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:Oe,characterReferenceMarkerNumeric:Oe,characterReferenceValue:ke,characterReference:Ye,codeFenced:l(_),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:N,codeIndented:l(E),codeText:l(I),codeTextData:N,data:N,definition:l(),definitionDestinationString:O,definitionLabelString:T,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(U),hardBreakTrailing:l(U),htmlFlow:l(te),htmlFlowData:N,htmlText:l(B),htmlTextData:N,image:l(se),label:me,labelText:ee,lineEnding:F,link:l(J),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ve,resourceDestinationString:b,resourceTitleString:fe,resource:ue,setextHeading:l(K),setextHeadingLineSequence:j,setextHeadingText:w,strong:l(),thematicBreak:l()}};za(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(v){let D={type:"root",children:[]};const Q={stack:[D],tokenStack:[],config:t,enter:s,exit:c,buffer:a,resume:u,data:n},ie=[];let pe=-1;for(;++pe<v.length;)if(v[pe][1].type==="listOrdered"||v[pe][1].type==="listUnordered")if(v[pe][0]==="enter")ie.push(pe);else{const Le=ie.pop();pe=i(v,Le,pe)}for(pe=-1;++pe<v.length;){const Le=t[v[pe][0]];Fa.call(Le,v[pe][1].type)&&Le[v[pe][1].type].call(Object.assign({sliceSerialize:v[pe][2].sliceSerialize},Q),v[pe][1])}if(Q.tokenStack.length>0){const Le=Q.tokenStack[Q.tokenStack.length-1];(Le[1]||Ci).call(Q,void 0,Le[0])}for(D.position={start:wt(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:wt(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<t.transforms.length;)D=t.transforms[pe](D)||D;return D}function i(v,D,Q){let ie=D-1,pe=-1,Le=!1,it,He,Qe,lt;for(;++ie<=Q;){const Re=v[ie];switch(Re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Re[0]==="enter"?pe++:pe--,lt=void 0;break}case"lineEndingBlank":{Re[0]==="enter"&&(it&&!lt&&!pe&&!Qe&&(Qe=ie),lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lt=void 0}if(!pe&&Re[0]==="enter"&&Re[1].type==="listItemPrefix"||pe===-1&&Re[0]==="exit"&&(Re[1].type==="listUnordered"||Re[1].type==="listOrdered")){if(it){let ct=ie;for(He=void 0;ct--;){const Ue=v[ct];if(Ue[1].type==="lineEnding"||Ue[1].type==="lineEndingBlank"){if(Ue[0]==="exit")continue;He&&(v[He][1].type="lineEndingBlank",Le=!0),Ue[1].type="lineEnding",He=ct}else if(!(Ue[1].type==="linePrefix"||Ue[1].type==="blockQuotePrefix"||Ue[1].type==="blockQuotePrefixWhitespace"||Ue[1].type==="blockQuoteMarker"||Ue[1].type==="listItemIndent"))break}Qe&&(!He||Qe<He)&&(it._spread=!0),it.end=Object.assign({},He?v[He][1].start:Re[1].end),v.splice(He||ie,0,["exit",it,Re[2]]),ie++,Q++}if(Re[1].type==="listItemPrefix"){const ct={type:"listItem",_spread:!1,start:Object.assign({},Re[1].start),end:void 0};it=ct,v.splice(ie,0,["enter",ct,Re[2]]),ie++,Q++,Qe=void 0,lt=!0}}}return v[D][1]._spread=Le,Q}function o(v,D){return Q;function Q(ie){s.call(this,v(ie),ie),D&&D.call(this,ie)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(v,D,Q){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([D,Q||void 0]),v.position={start:wt(D.start),end:void 0}}function l(v){return D;function D(Q){v&&v.call(this,Q),c.call(this,Q)}}function c(v,D){const Q=this.stack.pop(),ie=this.tokenStack.pop();if(ie)ie[0].type!==v.type&&(D?D.call(this,v,ie[0]):(ie[1]||Ci).call(this,v,ie[0]));else throw new Error("Cannot close `"+v.type+"` ("+Qt({start:v.start,end:v.end})+"): it’s not open");Q.position.end=wt(v.end)}function u(){return Pr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(v){if(this.data.expectingFirstListItemValue){const D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function p(){const v=this.resume(),D=this.stack[this.stack.length-1];D.lang=v}function h(){const v=this.resume(),D=this.stack[this.stack.length-1];D.meta=v}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v.replace(/(\r?\n|\r)$/g,"")}function T(v){const D=this.resume(),Q=this.stack[this.stack.length-1];Q.label=D,Q.identifier=ot(this.sliceSerialize(v)).toLowerCase()}function S(){const v=this.resume(),D=this.stack[this.stack.length-1];D.title=v}function O(){const v=this.resume(),D=this.stack[this.stack.length-1];D.url=v}function L(v){const D=this.stack[this.stack.length-1];if(!D.depth){const Q=this.sliceSerialize(v).length;D.depth=Q}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function j(v){const D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function G(v){const Q=this.stack[this.stack.length-1].children;let ie=Q[Q.length-1];(!ie||ie.type!=="text")&&(ie=Xe(),ie.position={start:wt(v.start),end:void 0},Q.push(ie)),this.stack.push(ie)}function N(v){const D=this.stack.pop();D.value+=this.sliceSerialize(v),D.position.end=wt(v.end)}function F(v){const D=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=D.children[D.children.length-1];Q.position.end=wt(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(D.type)&&(G.call(this,v),N.call(this,v))}function U(){this.data.atHardBreak=!0}function te(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function B(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function I(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function J(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=D,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function se(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=D,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function ee(v){const D=this.sliceSerialize(v),Q=this.stack[this.stack.length-2];Q.label=Vu(D),Q.identifier=ot(D).toLowerCase()}function me(){const v=this.stack[this.stack.length-1],D=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const ie=v.children;Q.children=ie}else Q.alt=D}function b(){const v=this.resume(),D=this.stack[this.stack.length-1];D.url=v}function fe(){const v=this.resume(),D=this.stack[this.stack.length-1];D.title=v}function ue(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function ve(v){const D=this.resume(),Q=this.stack[this.stack.length-1];Q.label=D,Q.identifier=ot(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function Oe(v){this.data.characterReferenceType=v.type}function ke(v){const D=this.sliceSerialize(v),Q=this.data.characterReferenceType;let ie;Q?(ie=Ca(D,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ie=Br(D);const pe=this.stack[this.stack.length-1];pe.value+=ie}function Ye(v){const D=this.stack.pop();D.position.end=wt(v.end)}function we(v){N.call(this,v);const D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(v)}function Ie(v){N.call(this,v);const D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(v)}function Te(){return{type:"blockquote",children:[]}}function et(){return{type:"code",lang:null,meta:null,value:""}}function tt(){return{type:"inlineCode",value:""}}function Rt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xt(){return{type:"emphasis",children:[]}}function Ze(){return{type:"heading",depth:0,children:[]}}function le(){return{type:"break"}}function nt(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function yt(){return{type:"link",title:null,url:"",children:[]}}function St(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Kt(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Mt(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function Xe(){return{type:"text",value:""}}function Dt(){return{type:"thematicBreak"}}}function wt(e){return{line:e.line,column:e.column,offset:e.offset}}function za(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?za(e,r):Qu(e,r)}}function Qu(e,t){let n;for(n in t)if(Fa.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 Ci(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qt({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qt({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qt({start:t.start,end:t.end})+") is still open")}function Ju(e){const t=this;t.parser=n;function n(r){return Zu(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ed(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 td(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -1,4 +1,4 @@
1
- import{j as e}from"./radix-C-SVreIl.js";import{r as g}from"./vendor-D_-14Whs.js";import{S as w}from"./common-VLx-PnhW.js";import{$ as P,B as y,a0 as A,L as K,t as d,A as N}from"./index-BGye3qtk.js";import{C as U}from"./check-BnpDXpw8.js";import{P as T}from"./pencil-fITP-Ux2.js";import{T as z}from"./trash-2-BdOxLswi.js";import{P as M}from"./plus-nMHxYBqJ.js";function Y(){const{query:r}=P(),a=r.data;return e.jsxs("div",{className:"w-full px-6 py-6",children:[e.jsx(w,{title:"Customize",description:"Add tools and external providers the model can call during conversations."}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(L,{search:a?.search??{provider:"tavily",tavilyKeySet:!1,kagiKeySet:!1,searxngUrl:""},onSaved:()=>{r.refetch()}}),e.jsx(F,{servers:a?.mcp?.servers??[]})]})]})}const C=[{id:"tavily",label:"Tavily",blurb:"AI-search API tuned for LLMs. Reliable default.",getKey:"https://app.tavily.com"},{id:"kagi",label:"Kagi",blurb:"Premium search, no bot-blocking, no tracking ($0.012/query).",getKey:"https://kagi.com/settings?p=api"},{id:"searxng",label:"SearXNG",blurb:"Your own self-hosted meta-search. Fully local — no key, just a URL."}];function L({search:r,onSaved:a}){const{save:l}=P(),[n,x]=g.useState(r.provider),[p,u]=g.useState(""),c=C.find(s=>s.id===n),o=n==="searxng",v=n==="tavily"?r.tavilyKeySet:n==="kagi"?r.kagiKeySet:!!r.searxngUrl,k=s=>{x(s),u(s==="searxng"?r.searxngUrl:"")},f=()=>{const s=p.trim(),b={provider:n};o?b.searxngUrl=s:s&&n==="tavily"?b.tavilyApiKey=s:s&&n==="kagi"&&(b.kagiApiKey=s),l.mutate({search:b},{onSuccess:()=>{d.success(`Search set to ${c.label}${s?` — ${o?"URL":"key"} saved`:""}`),o||u(""),a()},onError:j=>d.error(j instanceof N?j.message:"Could not save search settings.")})};return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsx("h2",{className:"mb-1 text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Web Search"}),e.jsxs("p",{className:"mb-3 text-[12px] text-muted",children:["Choose a search provider. When one is configured, the model can call the"," ",e.jsx("span",{className:"font-mono text-ink",children:"web_search"})," tool automatically."]}),e.jsx("div",{className:"mb-3 inline-flex rounded-md border border-border p-0.5",children:C.map(s=>e.jsx("button",{onClick:()=>k(s.id),className:`rounded px-3 py-1 text-[13px] transition-colors ${n===s.id?"bg-bg text-ink":"text-muted hover:text-ink"}`,children:s.label},s.id))}),e.jsxs("p",{className:"mb-2 text-[12px] text-muted",children:[c.blurb," ",c.getKey&&e.jsx("a",{href:c.getKey,target:"_blank",rel:"noopener noreferrer",className:"text-ink underline-offset-2 hover:underline",children:"Get a key"})]}),e.jsx("div",{className:"mb-2 text-[13px] text-muted",children:v?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-ink",children:[e.jsx(U,{size:13,style:{color:"var(--ok)"}})," ",o?"A URL is configured":"A key is configured"]}):o?"No URL configured":"No key configured"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("input",{type:o?"text":"password",value:p,onChange:s=>u(s.target.value),placeholder:o?"http://localhost:8888":v?"Enter a new key to replace the current one":n==="tavily"?"tvly-…":"Kagi API key",autoComplete:"off",className:"flex-1 rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[13px] text-ink outline-none"}),e.jsx(y,{size:"sm",onClick:f,disabled:l.isPending,children:"Save"})]}),e.jsxs("p",{className:"mt-3 text-[12px] text-faint",children:[e.jsx("span",{className:"font-mono text-ink",children:"fetch_url"})," and"," ",e.jsx("span",{className:"font-mono text-ink",children:"run_code"})," (sandboxed JS) are always available — no key needed."]})]})}const E=()=>({name:"",transport:"stdio",command:"",argsStr:"",envStr:"",url:"",enabled:!0});function R(r){return{name:r.name,transport:r.transport,command:r.command??"",argsStr:(r.args??[]).join(", "),envStr:Object.entries(r.env??{}).map(([a,l])=>`${a}=${l}`).join(`
2
- `),url:r.url??"",enabled:r.enabled}}function $(r){const a=r.argsStr.trim()?r.argsStr.split(",").map(n=>n.trim()).filter(Boolean):[],l={};for(const n of r.envStr.split(`
3
- `)){const x=n.indexOf("=");x>0&&(l[n.slice(0,x).trim()]=n.slice(x+1).trim())}return{name:r.name.trim(),transport:r.transport,command:r.transport==="stdio"&&r.command.trim()||void 0,args:r.transport==="stdio"&&a.length?a:void 0,env:r.transport==="stdio"&&Object.keys(l).length?l:void 0,url:r.transport==="sse"&&r.url.trim()||void 0,enabled:r.enabled}}function F({servers:r}){const a=A(),[l,n]=g.useState(null),[x,p]=g.useState(!1),[u,c]=g.useState(E()),o=t=>c(i=>({...i,...t})),v=()=>{n(null),c(E()),p(!0)},k=t=>{n(t.id),c(R(t)),p(!0)},f=()=>{p(!1),n(null)},s=()=>{const t=$(u);if(!t.name)return void d.error("Server name is required.");if(t.transport==="stdio"&&!t.command)return void d.error("Command is required for stdio transport.");if(t.transport==="sse"&&!t.url)return void d.error("URL is required for SSE transport.");const i={onSuccess:()=>{d.success(l?"MCP server updated":"MCP server added"),f()},onError:h=>d.error(h instanceof N?h.message:"Could not save server.")};l?a.update.mutate({id:l,patch:t},i):a.add.mutate(t,i)},b=(t,i)=>{window.confirm(`Remove MCP server "${i}"?`)&&a.remove.mutate(t,{onError:h=>d.error(h instanceof N?h.message:"Could not remove server.")})},j=t=>{a.update.mutate({id:t.id,patch:{enabled:!t.enabled}},{onError:i=>d.error(i instanceof N?i.message:"Could not update server.")})},m=u,S=a.add.isPending||a.update.isPending;return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsx("h2",{className:"mb-1 text-[13px] font-semibold uppercase tracking-wide text-faint",children:"MCP Servers"}),e.jsx("p",{className:"mb-3 text-[12px] text-muted",children:"Connect external tool providers via the Model Context Protocol. Supports stdio (subprocess) and SSE (HTTP) transports per the MCP 2024-11-05 spec."}),r.length>0&&e.jsx("div",{className:"mb-3 flex flex-col gap-1.5",children:r.map(t=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2",children:[e.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-medium",style:{background:t.transport==="sse"?"color-mix(in srgb, var(--accent) 15%, transparent)":"color-mix(in srgb, var(--muted) 20%, transparent)",color:t.transport==="sse"?"var(--accent)":"var(--muted)"},children:t.transport}),e.jsx("span",{className:"flex-1 truncate text-[13px] font-medium text-ink",children:t.name}),e.jsx("span",{className:"hidden shrink-0 max-w-[220px] truncate font-mono text-[11px] text-faint sm:block",title:t.transport==="stdio"?t.command:t.url,children:t.transport==="stdio"?t.command?.split(/[\\/]/).slice(-1)[0]:t.url}),e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>j(t),title:t.enabled?"Disable":"Enable",className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("button",{type:"button",onClick:()=>k(t),title:"Edit",className:"rounded p-1 text-faint transition-colors hover:bg-bg hover:text-ink",children:e.jsx(T,{size:12})}),e.jsx("button",{type:"button",onClick:()=>b(t.id,t.name),title:"Delete",className:"rounded p-1 transition-colors hover:bg-bg",style:{color:"var(--err)"},children:e.jsx(z,{size:12})})]},t.id))}),x?e.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-panel-2 p-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:l?"Edit server":"Add server"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Name"}),e.jsx("input",{type:"text",value:m.name,onChange:t=>o({name:t.target.value}),placeholder:"My Tool Server",className:"rounded-md border border-border bg-bg px-2 py-1.5 text-[13px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Transport"}),e.jsx("div",{className:"flex gap-4",children:["stdio","sse"].map(t=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-[13px] text-ink",children:[e.jsx("input",{type:"radio",name:"mcp-transport",checked:m.transport===t,onChange:()=>o({transport:t}),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"font-mono",children:t}),e.jsx("span",{className:"text-[11px] text-faint",children:t==="stdio"?"(subprocess)":"(HTTP)"})]},t))})]}),m.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Command"}),e.jsx("input",{type:"text",value:m.command,onChange:t=>o({command:t.target.value}),placeholder:"npx -y @modelcontextprotocol/server-filesystem",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"text-[12px] text-muted",children:["Args ",e.jsx("span",{className:"text-faint",children:"(comma-separated, optional)"})]}),e.jsx("input",{type:"text",value:m.argsStr,onChange:t=>o({argsStr:t.target.value}),placeholder:"--port, 3000",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"text-[12px] text-muted",children:["Env vars ",e.jsx("span",{className:"text-faint",children:"(KEY=VALUE, one per line, optional)"})]}),e.jsx("textarea",{rows:2,value:m.envStr,onChange:t=>o({envStr:t.target.value}),placeholder:`API_KEY=abc123
4
- DEBUG=true`,className:"resize-none rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"URL"}),e.jsx("input",{type:"text",value:m.url,onChange:t=>o({url:t.target.value}),placeholder:"http://localhost:3000",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[13px] text-ink",children:[e.jsx("input",{type:"checkbox",checked:m.enabled,onChange:t=>o({enabled:t.target.checked}),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),"Enable immediately"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{size:"sm",onClick:s,disabled:S,children:[S?e.jsx(K,{size:13,className:"animate-spin"}):null,l?"Update":"Add"]}),e.jsx(y,{variant:"outline",size:"sm",onClick:f,children:"Cancel"})]})]}):e.jsxs(y,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(M,{size:13}),"Add server"]})]})}export{Y as CustomizeScreen};
1
+ import{j as e}from"./radix-BFvMxQq9.js";import{r as g}from"./vendor-D_-14Whs.js";import{S as w}from"./common-DIXPIrUd.js";import{M as P,B as y,a1 as A,L as K,t as d,A as N}from"./index-sjgdofsd.js";import{C as U}from"./check-DFwkcl_5.js";import{P as M}from"./pencil-BuQwoNyj.js";import{T}from"./trash-2-DIMVgidH.js";import{P as z}from"./plus-B1w15FoZ.js";function Y(){const{query:r}=P(),a=r.data;return e.jsxs("div",{className:"w-full px-6 py-6",children:[e.jsx(w,{title:"Customize",description:"Add tools and external providers the model can call during conversations."}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(L,{search:a?.search??{provider:"tavily",tavilyKeySet:!1,kagiKeySet:!1,searxngUrl:""},onSaved:()=>{r.refetch()}}),e.jsx($,{servers:a?.mcp?.servers??[]})]})]})}const C=[{id:"tavily",label:"Tavily",blurb:"AI-search API tuned for LLMs. Reliable default.",getKey:"https://app.tavily.com"},{id:"kagi",label:"Kagi",blurb:"Premium search, no bot-blocking, no tracking ($0.012/query).",getKey:"https://kagi.com/settings?p=api"},{id:"searxng",label:"SearXNG",blurb:"Your own self-hosted meta-search. Fully local — no key, just a URL."}];function L({search:r,onSaved:a}){const{save:l}=P(),[n,x]=g.useState(r.provider),[p,u]=g.useState(""),c=C.find(s=>s.id===n),o=n==="searxng",v=n==="tavily"?r.tavilyKeySet:n==="kagi"?r.kagiKeySet:!!r.searxngUrl,k=s=>{x(s),u(s==="searxng"?r.searxngUrl:"")},f=()=>{const s=p.trim(),b={provider:n};o?b.searxngUrl=s:s&&n==="tavily"?b.tavilyApiKey=s:s&&n==="kagi"&&(b.kagiApiKey=s),l.mutate({search:b},{onSuccess:()=>{d.success(`Search set to ${c.label}${s?` — ${o?"URL":"key"} saved`:""}`),o||u(""),a()},onError:j=>d.error(j instanceof N?j.message:"Could not save search settings.")})};return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsx("h2",{className:"mb-1 text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Web Search"}),e.jsxs("p",{className:"mb-3 text-[12px] text-muted",children:["Choose a search provider. When one is configured, the model can call the"," ",e.jsx("span",{className:"font-mono text-ink",children:"web_search"})," tool automatically."]}),e.jsx("div",{className:"mb-3 inline-flex rounded-md border border-border p-0.5",children:C.map(s=>e.jsx("button",{onClick:()=>k(s.id),className:`rounded px-3 py-1 text-[13px] transition-colors ${n===s.id?"bg-bg text-ink":"text-muted hover:text-ink"}`,children:s.label},s.id))}),e.jsxs("p",{className:"mb-2 text-[12px] text-muted",children:[c.blurb," ",c.getKey&&e.jsx("a",{href:c.getKey,target:"_blank",rel:"noopener noreferrer",className:"text-ink underline-offset-2 hover:underline",children:"Get a key"})]}),e.jsx("div",{className:"mb-2 text-[13px] text-muted",children:v?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-ink",children:[e.jsx(U,{size:13,style:{color:"var(--ok)"}})," ",o?"A URL is configured":"A key is configured"]}):o?"No URL configured":"No key configured"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("input",{type:o?"text":"password",value:p,onChange:s=>u(s.target.value),placeholder:o?"http://localhost:8888":v?"Enter a new key to replace the current one":n==="tavily"?"tvly-…":"Kagi API key",autoComplete:"off",className:"flex-1 rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[13px] text-ink outline-none"}),e.jsx(y,{size:"sm",onClick:f,disabled:l.isPending,children:"Save"})]}),e.jsxs("p",{className:"mt-3 text-[12px] text-faint",children:[e.jsx("span",{className:"font-mono text-ink",children:"fetch_url"})," and"," ",e.jsx("span",{className:"font-mono text-ink",children:"run_code"})," (sandboxed JS) are always available — no key needed."]})]})}const E=()=>({name:"",transport:"stdio",command:"",argsStr:"",envStr:"",url:"",enabled:!0});function R(r){return{name:r.name,transport:r.transport,command:r.command??"",argsStr:(r.args??[]).join(", "),envStr:Object.entries(r.env??{}).map(([a,l])=>`${a}=${l}`).join(`
2
+ `),url:r.url??"",enabled:r.enabled}}function F(r){const a=r.argsStr.trim()?r.argsStr.split(",").map(n=>n.trim()).filter(Boolean):[],l={};for(const n of r.envStr.split(`
3
+ `)){const x=n.indexOf("=");x>0&&(l[n.slice(0,x).trim()]=n.slice(x+1).trim())}return{name:r.name.trim(),transport:r.transport,command:r.transport==="stdio"&&r.command.trim()||void 0,args:r.transport==="stdio"&&a.length?a:void 0,env:r.transport==="stdio"&&Object.keys(l).length?l:void 0,url:r.transport==="sse"&&r.url.trim()||void 0,enabled:r.enabled}}function $({servers:r}){const a=A(),[l,n]=g.useState(null),[x,p]=g.useState(!1),[u,c]=g.useState(E()),o=t=>c(i=>({...i,...t})),v=()=>{n(null),c(E()),p(!0)},k=t=>{n(t.id),c(R(t)),p(!0)},f=()=>{p(!1),n(null)},s=()=>{const t=F(u);if(!t.name)return void d.error("Server name is required.");if(t.transport==="stdio"&&!t.command)return void d.error("Command is required for stdio transport.");if(t.transport==="sse"&&!t.url)return void d.error("URL is required for SSE transport.");const i={onSuccess:()=>{d.success(l?"MCP server updated":"MCP server added"),f()},onError:h=>d.error(h instanceof N?h.message:"Could not save server.")};l?a.update.mutate({id:l,patch:t},i):a.add.mutate(t,i)},b=(t,i)=>{window.confirm(`Remove MCP server "${i}"?`)&&a.remove.mutate(t,{onError:h=>d.error(h instanceof N?h.message:"Could not remove server.")})},j=t=>{a.update.mutate({id:t.id,patch:{enabled:!t.enabled}},{onError:i=>d.error(i instanceof N?i.message:"Could not update server.")})},m=u,S=a.add.isPending||a.update.isPending;return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsx("h2",{className:"mb-1 text-[13px] font-semibold uppercase tracking-wide text-faint",children:"MCP Servers"}),e.jsx("p",{className:"mb-3 text-[12px] text-muted",children:"Connect external tool providers via the Model Context Protocol. Supports stdio (subprocess) and SSE (HTTP) transports per the MCP 2024-11-05 spec."}),r.length>0&&e.jsx("div",{className:"mb-3 flex flex-col gap-1.5",children:r.map(t=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2",children:[e.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-medium",style:{background:t.transport==="sse"?"color-mix(in srgb, var(--accent) 15%, transparent)":"color-mix(in srgb, var(--muted) 20%, transparent)",color:t.transport==="sse"?"var(--accent)":"var(--muted)"},children:t.transport}),e.jsx("span",{className:"flex-1 truncate text-[13px] font-medium text-ink",children:t.name}),e.jsx("span",{className:"hidden shrink-0 max-w-[220px] truncate font-mono text-[11px] text-faint sm:block",title:t.transport==="stdio"?t.command:t.url,children:t.transport==="stdio"?t.command?.split(/[\\/]/).slice(-1)[0]:t.url}),e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>j(t),title:t.enabled?"Disable":"Enable",className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("button",{type:"button",onClick:()=>k(t),title:"Edit",className:"rounded p-1 text-faint transition-colors hover:bg-bg hover:text-ink",children:e.jsx(M,{size:12})}),e.jsx("button",{type:"button",onClick:()=>b(t.id,t.name),title:"Delete",className:"rounded p-1 transition-colors hover:bg-bg",style:{color:"var(--err)"},children:e.jsx(T,{size:12})})]},t.id))}),x?e.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-panel-2 p-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:l?"Edit server":"Add server"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Name"}),e.jsx("input",{type:"text",value:m.name,onChange:t=>o({name:t.target.value}),placeholder:"My Tool Server",className:"rounded-md border border-border bg-bg px-2 py-1.5 text-[13px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Transport"}),e.jsx("div",{className:"flex gap-4",children:["stdio","sse"].map(t=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-[13px] text-ink",children:[e.jsx("input",{type:"radio",name:"mcp-transport",checked:m.transport===t,onChange:()=>o({transport:t}),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),e.jsx("span",{className:"font-mono",children:t}),e.jsx("span",{className:"text-[11px] text-faint",children:t==="stdio"?"(subprocess)":"(HTTP)"})]},t))})]}),m.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"Command"}),e.jsx("input",{type:"text",value:m.command,onChange:t=>o({command:t.target.value}),placeholder:"npx -y @modelcontextprotocol/server-filesystem",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"text-[12px] text-muted",children:["Args ",e.jsx("span",{className:"text-faint",children:"(comma-separated, optional)"})]}),e.jsx("input",{type:"text",value:m.argsStr,onChange:t=>o({argsStr:t.target.value}),placeholder:"--port, 3000",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("label",{className:"text-[12px] text-muted",children:["Env vars ",e.jsx("span",{className:"text-faint",children:"(KEY=VALUE, one per line, optional)"})]}),e.jsx("textarea",{rows:2,value:m.envStr,onChange:t=>o({envStr:t.target.value}),placeholder:`API_KEY=abc123
4
+ DEBUG=true`,className:"resize-none rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[12px] text-muted",children:"URL"}),e.jsx("input",{type:"text",value:m.url,onChange:t=>o({url:t.target.value}),placeholder:"http://localhost:3000",className:"rounded-md border border-border bg-bg px-2 py-1.5 font-mono text-[12px] text-ink outline-none"})]}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[13px] text-ink",children:[e.jsx("input",{type:"checkbox",checked:m.enabled,onChange:t=>o({enabled:t.target.checked}),className:"h-3.5 w-3.5 accent-[var(--accent)]"}),"Enable immediately"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{size:"sm",onClick:s,disabled:S,children:[S?e.jsx(K,{size:13,className:"animate-spin"}):null,l?"Update":"Add"]}),e.jsx(y,{variant:"outline",size:"sm",onClick:f,children:"Cancel"})]})]}):e.jsxs(y,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(z,{size:13}),"Add server"]})]})}export{Y as CustomizeScreen};
@@ -0,0 +1 @@
1
+ import{j as e}from"./radix-BFvMxQq9.js";import{r as p}from"./vendor-D_-14Whs.js";import{C as m}from"./copy-button-BtQZA6P8.js";import{S as y}from"./common-DIXPIrUd.js";import{c as f,$ as N,B as v,t as b,A as g,a0 as k}from"./index-sjgdofsd.js";import{T as C}from"./trash-2-DIMVgidH.js";import{P as S}from"./plus-B1w15FoZ.js";import"./check-DFwkcl_5.js";const w=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],A=f("globe",w);const I=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],E=f("key",I);const L=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],P=f("terminal",L),u=window.location.origin,T=[{method:"POST",path:"/v1/chat/completions",desc:"OpenAI Chat Completions"},{method:"POST",path:"/v1/messages",desc:"Anthropic Messages"},{method:"GET",path:"/v1/models",desc:"OpenAI Models List"},{method:"GET",path:"/api/v1/status",desc:"Daemon Status"},{method:"GET",path:"/api/v1/engines",desc:"Engine Registry"},{method:"GET",path:"/api/v1/models",desc:"Model Library"},{method:"GET",path:"/api/v1/keys",desc:"API Keys"}],K=[{id:"claude-code",name:"Claude Code",desc:"Anthropic-compatible endpoint — the hero demo"},{id:"opencode",name:"opencode",desc:"OpenAI-compatible, AI SDK provider config"},{id:"kilo",name:"Kilo Code",desc:"OpenAI-compatible, kilo.jsonc provider entry"},{id:"qwen",name:"Qwen Code",desc:"OpenAI-compatible (OPENAI_BASE_URL)"}];function V(){return e.jsxs("div",{className:"w-full px-6 py-6",children:[e.jsx(y,{title:"Developer",description:"Server URLs, API endpoints, keys, and CLI setup."}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(_,{}),e.jsx(G,{}),e.jsx(z,{}),e.jsx(O,{})]})]})}function _(){return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(A,{size:15,className:"text-accent"}),e.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Server"})]}),e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Local URL"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-[13px] text-ink",children:u}),e.jsx(m,{text:u})]})]})]})}function G(){const{query:s,create:n,revoke:c}=N(),[a,l]=p.useState(""),[r,o]=p.useState(null),x=s.data?.keys??[],i=()=>{const t=a.trim();t&&n.mutate(t,{onSuccess:d=>{l(""),o(d.key)},onError:d=>b.error(d instanceof g?d.message:"Could not create key.")})},h=(t,d)=>{c.mutate(t,{onSuccess:()=>{r?.startsWith(d)&&o(null)},onError:j=>b.error(j instanceof g?j.message:"Could not revoke key.")})};return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(E,{size:15,className:"text-accent"}),e.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide text-faint",children:"API Keys"})]}),r&&e.jsxs("div",{className:"mb-4 rounded-md border p-3",style:{borderColor:"var(--ok)",background:"color-mix(in srgb, var(--ok) 8%, transparent)"},children:[e.jsx("p",{className:"mb-1.5 text-[12px] font-medium",style:{color:"var(--ok)"},children:"Key created — copy it now, it won't be shown again."}),e.jsxs("div",{className:"flex items-center gap-2 rounded border border-border bg-bg px-2 py-1.5",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-ink",children:r}),e.jsx(m,{text:r})]})]}),x.length===0&&!r&&e.jsx("p",{className:"mb-3 text-[13px] text-faint",children:"No API keys yet."}),x.length>0&&e.jsx("div",{className:"mb-3 divide-y divide-border rounded-md border border-border",children:x.map(t=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:t.name}),e.jsxs("span",{className:"ml-2 font-mono text-[11px] text-faint",children:[t.prefix,"…"]})]}),e.jsx("button",{type:"button",onClick:()=>h(t.id,t.prefix),className:"rounded p-1 text-faint transition-colors hover:text-err",title:"Revoke key",children:e.jsx(C,{size:14})})]},t.id))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:a,onChange:t=>l(t.target.value),placeholder:"Key name (e.g. claude-code)",className:"flex-1 rounded-md border border-border bg-bg px-2.5 py-1.5 text-[13px] text-ink outline-none placeholder:text-faint focus:border-[color:var(--accent)]",onKeyDown:t=>t.key==="Enter"&&i()}),e.jsxs(v,{size:"sm",onClick:i,disabled:!a.trim()||n.isPending,children:[e.jsx(S,{size:13}),n.isPending?"Creating…":"Create"]})]})]})}function z(){return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsx("h2",{className:"mb-3 text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Available APIs"}),e.jsx("div",{className:"divide-y divide-border rounded-md border border-border",children:T.map(({method:s,path:n,desc:c})=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[e.jsx("span",{className:"w-10 shrink-0 rounded px-1 py-0.5 text-center font-mono text-[10px] font-bold uppercase",style:{background:s==="GET"?"color-mix(in srgb, var(--ok) 15%, transparent)":"color-mix(in srgb, var(--accent) 15%, transparent)",color:s==="GET"?"var(--ok)":"var(--accent)"},children:s}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[13px] text-ink",children:n}),e.jsx("span",{className:"hidden shrink-0 text-[11px] text-muted sm:block",children:c}),e.jsx(m,{text:`${u}${n}`})]},n))})]})}function O(){return e.jsxs("section",{className:"rounded-lg border border-border bg-panel p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(P,{size:15,className:"text-accent"}),e.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Connect a CLI"})]}),e.jsx("div",{className:"flex flex-col gap-2.5",children:K.map(s=>e.jsx(B,{cli:s},s.id))})]})}function B({cli:s}){const[n,c]=p.useState(null),[a,l]=p.useState(!1),[r,o]=p.useState(!1),x=()=>{if(r){o(!1);return}if(n){o(!0);return}l(!0),k(s.id).then(i=>{c(i),o(!0)}).catch(()=>b.error("Could not fetch setup snippets.")).finally(()=>l(!1))};return e.jsxs("div",{className:"rounded-md border border-border bg-bg",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-semibold text-ink",children:s.name}),e.jsx("span",{className:"ml-2 text-[11px] text-muted",children:s.desc})]}),e.jsx(v,{size:"sm",variant:r?"outline":"default",onClick:x,disabled:a,children:a?"Loading…":r?"Hide":"Get setup"})]}),r&&n&&e.jsx("div",{className:"flex flex-col gap-2.5 border-t border-border px-3 pb-3 pt-2.5",children:n.steps.map((i,h)=>e.jsx(R,{step:i},h))})]})}function R({step:s}){return e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[11px] text-faint",children:s.label}),e.jsxs("div",{className:"relative rounded border border-border bg-panel-2",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all px-3 py-2 pr-10 font-mono text-[12px] leading-relaxed text-ink",children:s.snippet}),e.jsx(m,{text:s.snippet,className:"absolute right-2 top-2"})]})]})}export{V as DeveloperScreen};
@@ -0,0 +1,7 @@
1
+ import{j as e,g as nn,h as sn,i as tn,k as an,l as ln}from"./radix-BFvMxQq9.js";import{r as b}from"./vendor-D_-14Whs.js";import{c as R,F as rn,B as S,A as C,G as on,H as Z,J as cn,L as G,I as ve,t as v,K as dn,M as un,u as ie,N as Ae,X as mn,D as Q,d as xn,O as pn,w as ce,P as hn,Q as fn,R as Le,T as pe,U as Ee,V as Be,y as Me,W as gn,e as ke,m as bn,C as jn,Y as vn}from"./index-sjgdofsd.js";import{I as Y,S as kn}from"./common-DIXPIrUd.js";import{B as T,E as ze,S as oe}from"./skeleton-Dvq8tYzC.js";import{h as he,j as fe,l as q,m as H,n as ne,o as K,i as Ne,b as W,g as Nn,a as yn,D as se,c as te,d as ae,f as U,e as X,A as $e,p as Ue,q as Re,r as Ie,s as Te,t as _e,u as Fe,v as Oe,C as de}from"./dialog-Dpyml8ZT.js";import{C as F}from"./check-DFwkcl_5.js";import{P as qe}from"./plus-B1w15FoZ.js";import{E as le,R as He}from"./refresh-cw-BoAcjLtt.js";import{a as wn,C as Ge}from"./copy-button-BtQZA6P8.js";import{C as Ve}from"./circle-x-CsuAddI_.js";import{S as ge}from"./sparkles-C54kYWeQ.js";const Cn=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ye=R("arrow-left",Cn);const Sn=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Dn=R("arrow-up",Sn);const Pn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],An=R("file",Pn);const Ln=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],En=R("folder-open",Ln);const Bn=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Mn=R("folder",Bn);const zn=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],$n=R("hammer",zn);const Un=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Rn=R("layers",Un);const In=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ye=R("rotate-cw",In);const Tn=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],_n=R("search-x",Tn);const Fn=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],On=R("wrench",Fn);function qn({open:n,onOpenChange:s,onSelect:i,mode:a="file"}){const[u,d]=b.useState(null),{data:c,isFetching:o,error:g,refetch:h}=rn(u,n);b.useEffect(()=>{n&&d(null)},[n]);const x=N=>{i(N),s(!1)};return e.jsx(he,{open:n,onOpenChange:s,children:e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(q,{children:[e.jsx(H,{children:a==="folder"?"Choose engine folder":"Browse for binary"}),e.jsx(ne,{children:a==="folder"?e.jsxs(e.Fragment,{children:["Open the folder that contains your engine build, then click"," ",e.jsx("span",{className:"font-medium text-ink",children:"Select this folder"}),". We'll scan it for ",e.jsx("code",{className:"font-mono",children:"llama-server"}),". Limited to your home directory."]}):e.jsxs(e.Fragment,{children:["Navigate to the compiled ",e.jsx("code",{className:"font-mono",children:"llama-server"})," executable and click it to select. Limited to your home directory."]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",size:"iconSm",onClick:()=>c?.parent!=null&&d(c.parent),disabled:!c||c.parent==null||o,"aria-label":"Up one folder",children:e.jsx(Dn,{size:16})}),e.jsx("div",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-panel-2 px-2.5 py-1.5 font-mono text-[12px] text-muted",title:c?.path??"",children:c?.path??"…"}),e.jsx(S,{variant:"outline",size:"iconSm",onClick:()=>{h()},disabled:o,"aria-label":"Refresh",children:e.jsx(Ye,{size:16,className:o?"animate-spin":void 0})})]}),g?e.jsx(Y,{message:g instanceof C?g.message:"Could not read that folder.",onRetry:()=>{h()},className:"mt-3"}):e.jsxs("ul",{className:"mt-3 max-h-[320px] overflow-y-auto rounded-md border border-border",children:[c&&c.entries.length===0&&e.jsx("li",{className:"px-3 py-6 text-center text-[13px] text-muted",children:"This folder is empty."}),c?.entries.map(N=>{const f=a==="folder"&&!N.isDir;return e.jsx("li",{children:e.jsxs("button",{type:"button",disabled:f,onClick:()=>N.isDir?d(N.path):x(N.path),className:"flex w-full items-center gap-2.5 px-3 py-2 text-left text-[13px] text-ink "+(f?"cursor-default text-faint":"hover:bg-panel-2"),children:[N.isDir?e.jsx(Mn,{size:16,className:"shrink-0 text-muted"}):e.jsx(An,{size:16,className:f?"shrink-0 text-faint":"shrink-0 text-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:on(N.name,48)}),a==="file"&&!N.isDir&&e.jsx("span",{className:"shrink-0 text-[11px] text-muted",children:"Select"})]})},N.path)})]}),e.jsxs(K,{children:[e.jsx(S,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),a==="folder"&&e.jsxs(S,{onClick:()=>c?.path&&x(c.path),disabled:!c?.path||o,children:[e.jsx(F,{size:16})," Select this folder"]})]})]})})}function be({open:n,onOpenChange:s,defaultSourceRepo:i,trigger:a}={}){const[u,d]=b.useState(!1),c=n!==void 0,o=c?n:u,g=p=>{c||d(p),s?.(p)},[h,x]=b.useState("choose"),[N,f]=b.useState(null),[w,k]=b.useState(""),[B,D]=b.useState(""),[z,P]=b.useState(""),[A,$]=b.useState(""),[L,l]=b.useState(null),[m,t]=b.useState(null),{add:r}=Z(),j=cn();b.useEffect(()=>{o&&i&&$(i)},[o,i]);const E=()=>{x("choose"),f(null),k(""),D(""),P(""),$(""),l(null),t(null)},I=p=>{t(null),l(null),x("scanning"),j.mutate(p,{onSuccess:y=>{if(!y.found){x("notfound");return}k(y.binPath),D(y.version),P(y.suggestedName),x("confirm")},onError:y=>{t(y instanceof C?y.message:"Could not scan that location."),x("choose")}})},V=()=>{l(null),t(null);const p=A.trim();r.mutate({name:z.trim(),binPath:w,...p?{sourceRepo:p}:{}},{onSuccess:y=>{y.warning==="no_version"?v.warning("Engine added, but its version could not be detected."):v.success("Engine added"),g(!1),E()},onError:y=>{const O=y instanceof C?y.code:"",_=y instanceof C?y.message:"Could not add engine.";O==="name_already_taken"?l(_):t(_)}})};return e.jsxs(he,{open:o,onOpenChange:p=>{g(p),p||E()},children:[a!==void 0?a!==null&&e.jsx(Ne,{asChild:!0,children:a}):e.jsx(Ne,{asChild:!0,children:e.jsxs(S,{children:[e.jsx(qe,{size:16})," Add engine"]})}),e.jsxs(fe,{children:[h==="choose"&&e.jsxs(e.Fragment,{children:[e.jsxs(q,{children:[e.jsx(H,{children:"Add your own engine"}),e.jsx(ne,{children:"Bring any llama.cpp-compatible build or community fork. Pick the folder it lives in and we'll find the server binary for you."})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(S,{onClick:()=>f("folder"),className:"w-full",children:[e.jsx(En,{size:16})," Choose folder…"]}),e.jsx("button",{type:"button",onClick:()=>f("file"),className:"text-[12px] text-muted underline-offset-2 hover:text-ink hover:underline",children:"or pick the binary directly"}),e.jsx("p",{className:"text-[12px] text-faint",children:"Works with: ik_llama.cpp · TurboQuant · llama.cpp builds · any fork"}),m&&e.jsx(Y,{message:m})]}),e.jsx(K,{children:e.jsx(S,{variant:"outline",onClick:()=>g(!1),children:"Cancel"})})]}),h==="scanning"&&e.jsxs(e.Fragment,{children:[e.jsx(q,{children:e.jsx(H,{children:"Add your own engine"})}),e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-panel p-4 text-[13px] text-muted",children:[e.jsx(G,{size:18,className:"shrink-0 animate-spin text-ink"}),"Looking for the server binary…"]})]}),h==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsxs(q,{children:[e.jsx(H,{children:"Confirm engine"}),e.jsx(ne,{children:"Review what we found, then add it."})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border bg-panel p-3 text-[13px] text-ink",children:[e.jsx(W,{size:16,className:"shrink-0",style:{color:"var(--ok)"}}),e.jsxs("span",{children:["Found ",e.jsx("code",{className:"font-mono",children:"llama-server"}),B&&B.toLowerCase()!=="unknown"?e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"text-muted",children:B})]}):null]})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Name"}),e.jsx(ve,{value:z,onChange:p=>P(p.target.value),autoFocus:!0}),e.jsx("span",{className:"text-[12px] text-muted",children:"Any label you choose — shown in the engine list."}),L&&e.jsx(Y,{message:L})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Binary"}),e.jsx("div",{className:"truncate rounded-md border border-border bg-panel-2 px-2.5 py-1.5 font-mono text-[12px] text-muted",title:w,children:w})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Source repo URL (optional)"}),e.jsx(ve,{value:A,onChange:p=>$(p.target.value),placeholder:"https://github.com/owner/repo"}),e.jsx("span",{className:"text-[12px] text-muted",children:"Paste the GitHub repo you built this from — lets TurboLLM tell you when a newer build is available."})]}),m&&e.jsx(Y,{message:m})]}),e.jsxs(K,{children:[e.jsxs(S,{variant:"outline",onClick:()=>x("choose"),disabled:r.isPending,children:[e.jsx(ye,{size:16})," Back"]}),e.jsx(S,{onClick:V,disabled:z.trim().length===0||r.isPending,children:r.isPending?"Adding…":"Add engine"})]})]}),h==="notfound"&&e.jsxs(e.Fragment,{children:[e.jsx(q,{children:e.jsx(H,{children:"No engine found"})}),e.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-panel p-4 text-[13px] text-muted",children:[e.jsx(_n,{size:18,className:"mt-0.5 shrink-0 text-faint"}),e.jsxs("span",{children:["We couldn't find ",e.jsx("code",{className:"font-mono",children:"llama-server"})," in that folder. Pick the folder that contains it, or select the binary directly."]})]}),e.jsxs(K,{children:[e.jsxs(S,{variant:"outline",onClick:()=>x("choose"),children:[e.jsx(ye,{size:16})," Back"]}),e.jsx(S,{onClick:()=>f("file"),children:"Pick the binary directly"})]})]}),e.jsx(qn,{open:N!==null,mode:N==="file"?"file":"folder",onOpenChange:p=>{p||f(null)},onSelect:p=>{f(null),I(p)}})]})]})}function Hn(n,s){const i=(s??"").trim();return[i?`git clone --branch ${i} --depth 1 ${n} turbo-build`:`git clone --depth 1 ${n} turbo-build`,"cd turbo-build","cmake -B build -DGGML_CUDA=ON -DCMAKE_BUILD_TYPE=Release","cmake --build build --config Release -j --target llama-server",'# Built binary: build\\bin\\Release\\llama-server.exe — add it via "Add your own engine".']}const Gn={provisioning:"Downloading CUDA Toolkit…",preparing:"Preparing…",cloning:"Cloning the repository…",configuring:"Configuring (cmake)…",compiling:"Compiling llama-server… this can take several minutes",registering:"Registering the built engine…",done:"Built and registered ✓",error:"Build failed"};function ue({open:n,onOpenChange:s,repoUrl:i,engineName:a,branch:u,mode:d="build"}){const c=dn(n),o=un(),g=ie(),h=Ae(),[x,N]=b.useState(!1),[f,w]=b.useState(!1),[k,B]=b.useState(null),D=o.query.data?.build.toolchainDirs??[],[z,P]=b.useState(null),A=z??D,L=Hn(i,u).join(`
2
+ `),l=c.data?.supported??null,m=c.data?.tools??[],t=m.filter(M=>(M.id==="git"||M.id==="cmake"||M.id==="cuda")&&!M.found),r=g.data?.engineBuild,j=!!r?.active,E=!!g.data?.engineProvision?.active,I=k!==null||j,V=m.some(M=>M.id==="cuda"&&!M.found),p=l===!0&&t.length===0&&!j&&!E;b.useEffect(()=>{!k||!r||r.active||(r.phase==="done"?k==="cuda"?(c.refetch(),o.query.refetch(),B(null)):h.refresh():r.phase==="error"&&k==="build"&&h.refresh())},[k,r?.active,r?.phase]);const y=b.useRef(null);b.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[r?.log]);const O=()=>{navigator.clipboard.writeText(L).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},_=async()=>{await o.save.mutateAsync({build:{toolchainDirs:A.map(M=>M.trim()).filter(Boolean)}}),P(null),c.refetch()},Je=()=>{B("build"),h.start.mutate({repoUrl:i,branch:u,name:a})},Ze=()=>{B("cuda"),h.cuda.mutate()},en=d==="rebuild"?"Rebuild now":"Build it for me";return e.jsxs(he,{open:n,onOpenChange:s,children:[e.jsxs(fe,{className:"max-w-lg",children:[e.jsxs(q,{children:[e.jsxs(H,{children:[d==="rebuild"?"Rebuild":"Build"," ",a," from source"]}),e.jsx(ne,{children:d==="rebuild"?"A newer commit is available — recompile from source and replace the binary.":"No prebuilt binary for your system — compile it here, or build it yourself and add it."})]}),c.isLoading?e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-panel p-4 text-[13px] text-muted",children:[e.jsx(G,{size:18,className:"shrink-0 animate-spin text-ink"}),"Checking your build tools…"]}):l===!1?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-panel p-4 text-[13px] text-muted",children:["In-app build is currently ",e.jsx("span",{className:"font-medium text-ink",children:"Windows + CUDA"})," only. On your system, clone the repo and follow its upstream build instructions, then add the resulting ",e.jsx("code",{className:"font-mono",children:"llama-server"})," binary via “Add your own engine”."]}),e.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 self-start text-[13px] text-accent hover:underline",children:["Open ",a," repo + build docs ",e.jsx(le,{size:13})]})]}):e.jsxs("div",{className:"flex max-h-[60vh] flex-col gap-4 overflow-y-auto",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:"Build prerequisites"}),e.jsx("div",{className:"flex flex-col gap-1.5 rounded-lg border border-border bg-panel p-3",children:m.map(M=>e.jsx(Yn,{tool:M,onDownload:M.id==="cuda"&&!M.found&&!I?Ze:void 0},M.id))}),V&&!I&&e.jsxs("p",{className:"text-[11px] text-faint",children:["No CUDA Toolkit found. ",e.jsx("span",{className:"text-muted",children:"Download CUDA"})," grabs NVIDIA’s official build components (~0.5 GB) automatically — no installer needed."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:"Build environment"}),e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-border bg-panel p-3",children:[e.jsxs("p",{className:"text-[12px] text-muted",children:["If your CUDA Toolkit or compiler lives in a conda env or a custom location (not on the system PATH), add that folder — e.g. the env’s ",e.jsx("code",{className:"font-mono",children:"bin"})," — so TurboLLM finds ",e.jsx("code",{className:"font-mono",children:"nvcc"}),". Then re-check."]}),A.map((M,re)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{value:M,onChange:je=>{const ee=[...A];ee[re]=je.target.value,P(ee)},placeholder:"C:\\\\Users\\\\you\\\\miniconda3\\\\envs\\\\cuda\\\\Library\\\\bin",className:"min-w-0 flex-1 rounded-md border border-border bg-panel-2 px-2 py-1 font-mono text-[12px] text-ink outline-none focus:border-accent"}),e.jsx("button",{type:"button",onClick:()=>P(A.filter((je,ee)=>ee!==re)),className:"shrink-0 rounded-md p-1 text-faint hover:text-ink","aria-label":"Remove folder",children:e.jsx(mn,{size:14})})]},re)),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{type:"button",onClick:()=>P([...A,""]),className:"inline-flex items-center gap-1 text-[12px] text-muted hover:text-ink",children:[e.jsx(qe,{size:13})," Add folder"]}),e.jsxs("button",{type:"button",onClick:()=>{_()},disabled:o.save.isPending||c.isFetching,className:"inline-flex items-center gap-1 text-[12px] text-accent hover:underline disabled:opacity-50",children:[o.save.isPending||c.isFetching?e.jsx(G,{size:13,className:"animate-spin"}):e.jsx(He,{size:13}),"Re-check"]})]})]})]}),I&&r&&e.jsx(Vn,{build:r,kind:k==="cuda"?"cuda":"build",logRef:y,onCancel:()=>h.cancel.mutate(),onClose:()=>s(!1)}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer list-none text-[11px] font-medium uppercase tracking-wide text-faint hover:text-muted",children:"Or build it yourself (manual commands)"}),e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] text-faint",children:"Windows + CUDA"}),e.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1 text-[12px] text-muted hover:text-ink",children:[x?e.jsx(W,{size:13,style:{color:"var(--ok)"}}):e.jsx(wn,{size:13}),x?"Copied":"Copy"]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg border border-border bg-panel-2 p-3 font-mono text-[12px] leading-relaxed text-ink",children:L})]})]})]}),e.jsxs(K,{children:[e.jsx(S,{variant:"outline",onClick:()=>s(!1),children:"Close"}),l!==!1&&e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",onClick:()=>w(!0),disabled:c.isLoading||j,children:"I've built it"}),e.jsxs(S,{onClick:Je,disabled:!p,children:[e.jsx($n,{size:15,className:"mr-1.5"}),j?"Building…":en]})]})]})]}),e.jsx(be,{open:f,onOpenChange:w,defaultSourceRepo:i,trigger:null})]})}function Vn({build:n,kind:s,logRef:i,onCancel:a,onClose:u}){const d=n.phase==="error",c=n.phase==="done",o=d?"var(--err, #ef4444)":c?"var(--ok)":"var(--accent)";return c&&s==="build"?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border p-5 text-center",style:{borderColor:"color-mix(in srgb, var(--ok) 40%, var(--border))",background:"color-mix(in srgb, var(--ok) 8%, transparent)"},children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{background:"color-mix(in srgb, var(--ok) 18%, transparent)"},children:e.jsx(W,{size:28,style:{color:"var(--ok)"}})}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-[15px] font-semibold text-ink",children:"Engine ready 🎉"}),e.jsxs("p",{className:"text-[13px] text-muted",children:[e.jsx("span",{className:"font-medium text-ink",children:n.engine})," was built from source, bundled with its CUDA runtime, and set as your active engine. Load a model to start using it."]})]}),e.jsxs("details",{className:"w-full",children:[e.jsx("summary",{className:"cursor-pointer list-none text-[11px] uppercase tracking-wide text-faint hover:text-muted",children:"Build log"}),e.jsx("pre",{className:"mt-1.5 max-h-40 overflow-auto rounded-md border border-border bg-panel-2 p-2 text-left font-mono text-[11px] leading-relaxed text-muted",children:n.log.join(`
3
+ `)})]}),e.jsx(S,{onClick:u,className:"mt-1",children:"Done"})]}):e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-border bg-panel p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.active?e.jsx(G,{size:15,className:"shrink-0 animate-spin",style:{color:o}}):d?e.jsx(Ve,{size:15,className:"shrink-0",style:{color:o}}):e.jsx(W,{size:15,className:"shrink-0",style:{color:o}}),e.jsx("span",{className:"text-ink",children:Gn[n.phase]}),n.active&&e.jsx("button",{type:"button",onClick:a,className:"ml-auto text-[12px] text-faint hover:text-ink",children:"Cancel"})]}),d&&n.error&&e.jsx("p",{className:"text-[12px]",style:{color:o},children:n.error}),n.log.length>0&&e.jsx("pre",{ref:i,className:"max-h-40 overflow-auto rounded-md border border-border bg-panel-2 p-2 font-mono text-[11px] leading-relaxed text-muted",children:n.log.join(`
4
+ `)})]})}function Yn({tool:n,onDownload:s}){return e.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.found?e.jsx(W,{size:15,className:"shrink-0",style:{color:"var(--ok)"}}):e.jsx(Ve,{size:15,className:"shrink-0 text-faint"}),e.jsx("span",{className:"text-ink",children:n.name}),n.found&&n.version&&e.jsx("span",{className:"text-[12px] text-muted",children:n.version}),!n.found&&e.jsxs("span",{className:"ml-auto inline-flex items-center gap-3",children:[s&&e.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[12px] font-medium transition-colors hover:opacity-80",style:{background:"color-mix(in srgb, var(--accent) 15%, transparent)",color:"var(--accent)"},children:[e.jsx(Q,{size:12})," Download CUDA"]}),e.jsxs("a",{href:n.installUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[12px] text-accent hover:underline",children:[s?"or install manually":"Install"," ",e.jsx(le,{size:11})]})]})]})}function Kn({status:n,activeEngineName:s}){const i=n?.engine.state??"stopped",a=n?.engine.error,u=n?.model?.loadElapsedMs,d=i==="running"?n?.engineStats??null:null,c=i==="running"?n?.liveGeneration??null:null,o=xn(),g=Z(),h=i==="running"||i==="starting",x=i==="running"||i==="error",N=()=>o.eject.mutate(void 0,{onError:w=>v.error(w instanceof C?w.message:"Could not stop the engine.")}),f=()=>g.restart.mutate(void 0,{onError:w=>v.error(w instanceof C?w.message:"Could not restart the engine.")});return e.jsxs("div",{className:"rounded-[var(--radius)] border border-[color:var(--accent)] bg-panel p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] text-muted",children:"Active engine"}),e.jsx("div",{className:"text-sm font-semibold text-ink",children:s??"None active"})]}),e.jsx(pn,{state:i}),i==="starting"&&u!=null&&e.jsxs("span",{className:"text-[13px] text-muted",children:["Loading model… (",Math.round(u/1e3),"s)"]}),i==="running"&&n?.model&&e.jsx("span",{className:"text-[13px] text-muted truncate",children:n.model.name}),i==="running"&&!c&&(d?.activeRequests??0)>0&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[12px] font-medium",style:{background:"color-mix(in srgb, var(--accent) 12%, transparent)",color:"var(--accent)"},title:"The engine is actively generating",children:[e.jsx("span",{className:"tllm-pulse inline-block h-1.5 w-1.5 rounded-full",style:{background:"var(--accent)"}}),"Generating",(d?.activeRequests??0)>1?` (${d?.activeRequests})`:"","…"]}),x&&e.jsxs(S,{size:"sm",variant:"outline",className:"ml-auto",onClick:f,disabled:g.restart.isPending,title:"Restart the engine",children:[e.jsx(Ye,{size:14}),"Restart"]}),h&&e.jsxs(S,{size:"sm",variant:"outline",className:x?"":"ml-auto",onClick:N,disabled:o.eject.isPending,title:"Stop the engine and unload the model",children:[e.jsx(Nn,{size:14}),"Stop & unload"]})]}),(c||d)&&e.jsx(Qn,{live:c,stats:d}),i==="error"&&a&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--err)"},children:[a.message,a.exitCode!=null&&` (exit ${a.exitCode})`]}),e.jsx(Ge,{text:(a?.logTail??[]).join(`
5
+ `),label:"Copy",size:14})]}),e.jsx("pre",{className:"max-h-48 overflow-auto rounded-md px-3 py-2 font-mono text-[12px] leading-[1.5]",style:{background:"var(--log-bg)",color:"var(--log-err-ink)"},children:(a.logTail??[]).join(`
6
+ `)||"No log output captured."})]})]})}function Qn({live:n,stats:s}){return e.jsxs("div",{className:"mt-3 border-t border-border pt-2",children:[n&&(n.phase==="prompt"?e.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[13px] text-ink",children:[e.jsx("span",{className:"shrink-0",children:"Processing prompt"}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-panel-2",children:e.jsx("div",{className:"h-full rounded-full transition-[width] duration-300",style:{width:`${Math.max(0,Math.min(100,n.pct))}%`,background:"var(--accent)"}})}),e.jsxs("span",{className:"shrink-0 tabular-nums font-medium",style:{color:"var(--accent)"},children:[n.pct,"%"]})]}):e.jsxs("div",{className:"mb-1.5 flex items-center gap-2 text-[13px] text-ink",children:[e.jsx("span",{className:"tllm-pulse inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:"var(--accent)"}}),e.jsxs("span",{className:"tabular-nums font-medium",style:{color:"var(--accent)"},children:[n.outputTokens.toLocaleString()," tok"]}),e.jsx("span",{className:"text-muted",children:"generated"})]})),s&&e.jsx(Wn,{stats:s})]})}function Wn({stats:n}){const s=[];return s.push(`${n.requests} ${n.requests===1?"request":"requests"}`),(n.inputTokens>0||n.outputTokens>0)&&s.push(`${we(n.inputTokens)} in / ${we(n.outputTokens)} out`),n.avgPromptTps>0&&s.push(`${n.avgPromptTps.toFixed(0)} tok/s prefill`),n.avgGenTps>0&&s.push(`${n.avgGenTps.toFixed(1)} tok/s gen`),s.push(Xn(n.sinceMs)),e.jsx("div",{className:"text-[12px] text-muted",title:"Session totals — reset when the engine stops or restarts",children:s.join(" · ")})}function we(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}function Xn(n){const s=Math.floor(n/1e3);if(s<60)return`${s}s session`;const i=Math.floor(s/60);return i<60?`${i}m session`:`${Math.floor(i/60)}h ${i%60}m session`}const Ke=b.forwardRef(({className:n,...s},i)=>e.jsx(nn,{ref:i,className:ce("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors","data-[state=unchecked]:bg-border-strong data-[state=checked]:bg-accent","disabled:cursor-not-allowed disabled:opacity-50",n),...s,children:e.jsx(sn,{className:ce("pointer-events-none block h-4 w-4 rounded-full bg-panel shadow-[var(--shadow-1)] transition-transform","data-[state=unchecked]:translate-x-0.5 data-[state=checked]:translate-x-[18px]")})}));Ke.displayName="Switch";const Jn=tn,Zn=an,es=ln,Ce=2e3;function ns({open:n,onOpenChange:s}){const[i,a]=b.useState([]),[u,d]=b.useState(!0),c=b.useRef(null);return b.useEffect(()=>{if(!n)return;let o=!1;hn(200).then(h=>{o||a(h.lines??[])}).catch(()=>{});const g=new EventSource(fn);return g.addEventListener("line",h=>{try{const x=JSON.parse(h.data);typeof x.line=="string"&&a(N=>{const f=[...N,x.line];return f.length>Ce?f.slice(f.length-Ce):f})}catch{}}),g.onerror=()=>{},()=>{o=!0,g.close()}},[n]),b.useEffect(()=>{u&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[i,u]),e.jsxs(Jn,{open:n,onOpenChange:s,className:"rounded-[var(--radius)] border border-border bg-panel",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsxs(Zn,{className:"flex items-center gap-1.5 text-[13px] font-medium text-ink",children:[e.jsx(yn,{size:14,className:ce("transition-transform",n&&"rotate-90")}),"Engine log"]}),n&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-muted",children:[e.jsx(Ke,{checked:u,onCheckedChange:d}),"Auto-scroll"]}),e.jsx(Ge,{text:i.join(`
7
+ `),label:"Copy all",size:14})]})]}),e.jsx(es,{children:e.jsx("div",{ref:c,className:"max-h-80 overflow-auto rounded-b-[var(--radius)] px-3 py-2 font-mono text-[12px] leading-[1.5]",style:{background:"var(--log-bg)",color:"var(--log-ink)"},children:i.length===0?e.jsx("span",{style:{color:"var(--log-faint)"},children:"No log output yet."}):i.map((o,g)=>e.jsx("div",{className:"whitespace-pre-wrap break-all",children:o},g))})})]})}const ss={cuda:"~550 MB",rocm:"~320 MB",sycl:"~110 MB",vulkan:"~40 MB",metal:"~11 MB",cpu:"~16 MB"},ts={cuda:"CUDA",rocm:"ROCm",sycl:"SYCL",vulkan:"Vulkan",metal:"Metal",cpu:"CPU"},Se={off:"Off",notify:"Notify",auto:"Auto"};function as(n){const s=new Date(n).getTime();if(!Number.isFinite(s))return"";const i=Date.now()-s;if(i<6e4)return"just now";const a=Math.floor(i/6e4);if(a<60)return`${a}m ago`;const u=Math.floor(a/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}function is({st:n}){return n?n.error==="offline"?e.jsx("span",{className:"text-[12px] text-muted",children:"Couldn't check for updates (offline)"}):n.error==="no_source"||!n.comparable?e.jsx("span",{className:"text-[12px] text-muted",children:"Update status unavailable for this build"}):n.hasUpdate&&n.latest?e.jsxs("span",{className:"text-[12px]",style:{color:"var(--accent)"},children:["Update available · ",n.installed||"?"," → ",n.latest]}):e.jsxs("span",{className:"text-[12px] text-muted",children:["Up to date · ",n.latest??n.installed,n.checkedAt?` · checked ${as(n.checkedAt)}`:""]}):null}function Qe({filter:n}={}){const{data:s}=ie(),i=!!s?.engineProvision?.active,{data:a,isLoading:u}=Le(i),{data:d}=pe(i),c=Ee(),o=Be(),g=Z(),[h,x]=b.useState(null);if(u||!a)return null;const N=l=>l?d?.updates[l]:void 0,f=l=>(l?d?.policies[l]:void 0)??"notify",w=(l,m,t)=>{l&&o.mutate({id:l,policy:m},{onSuccess:()=>v.success(`${t} auto-update: ${Se[m]}`),onError:r=>v.error(r instanceof C?r.message:"Could not change auto-update.")})},k=i||c.backend.isPending||c.remove.isPending||c.enableBackend.isPending||c.updateBackend.isPending||g.remove.isPending,B=a.gpus[0]?.name,D=l=>c.backend.mutate(l,{onError:m=>v.error(m instanceof C?m.message:"Could not download backend.")}),z=l=>c.enableBackend.mutate(l,{onSuccess:()=>v.success("Backend enabled"),onError:m=>v.error(m instanceof C?m.message:"Could not enable backend.")}),P=(l,m)=>g.remove.mutate(l,{onSuccess:()=>v.success(`${m} disabled`),onError:t=>v.error(t instanceof C?t.message:"Could not disable backend.")}),A=l=>c.updateBackend.mutate(l,{onSuccess:m=>m?.alreadyLatest?v.success(`You're on the latest build${m.build?` (${m.build})`:""}`):v.success("Downloading the latest build…"),onError:m=>v.error(m instanceof C?m.message:"Could not update backend.")}),$=l=>c.remove.mutate(l,{onSuccess:()=>{v.success(`${h?.label??"Backend"} deleted`),x(null)},onError:m=>{x(null),v.error(m instanceof C?m.message:"Could not delete backend.")}}),L=a.backends.filter(l=>n==="recommended"?l.recommended:n==="others"?!l.recommended:!0);return e.jsxs(e.Fragment,{children:[L.map(l=>{const m=N(l.engineId),t=f(l.engineId);return e.jsxs("div",{className:"flex items-center gap-3 rounded-[var(--radius)] border border-border bg-panel p-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"text-sm font-semibold text-ink",children:["llama.cpp (",ts[l.id]??l.label,")"]}),l.recommended&&e.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] text-accent",children:[e.jsx(ge,{size:10})," recommended"]}),l.installed&&!l.enabled&&e.jsx(T,{variant:"mono",children:"Disabled"}),l.installed&&l.enabled&&m?.hasUpdate&&e.jsx(T,{variant:"accent",children:"Update available"})]}),e.jsx("div",{className:"mt-0.5 text-[12px] text-muted",children:l.installed?`Installed · ${B??"GPU detected"}`:`Not installed · ${ss[l.id]??"download to use"}`}),l.installed&&l.enabled&&e.jsx("div",{className:"mt-0.5",children:e.jsx(is,{st:m})})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:l.installed?e.jsx(e.Fragment,{children:e.jsxs(se,{children:[e.jsx(te,{"aria-label":`Actions for ${l.label}`,disabled:k,className:"grid h-8 w-8 place-items-center rounded-md text-muted hover:bg-panel-2 hover:text-ink disabled:opacity-50",children:e.jsx(ze,{size:16})}),e.jsxs(ae,{align:"end",children:[e.jsxs(U,{onSelect:()=>A(l.id),disabled:i,children:[e.jsx(Q,{size:14})," ",m?.hasUpdate?"Update now":"Check for update"]}),l.enabled?e.jsx(U,{onSelect:()=>l.engineId&&P(l.engineId,l.label),children:"Disable"}):e.jsx(U,{onSelect:()=>z(l.id),children:"Enable"}),l.enabled&&l.engineId&&e.jsxs(e.Fragment,{children:[e.jsx(X,{}),e.jsx("div",{className:"px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-faint",children:"Auto-update"}),["off","notify","auto"].map(r=>e.jsxs(U,{onSelect:()=>w(l.engineId,r,l.label),className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:t===r&&e.jsx(F,{size:13,className:"text-accent"})}),Se[r]]},r))]}),e.jsx(X,{}),e.jsx(U,{destructive:!0,onSelect:()=>x({id:l.id,label:l.label}),children:"Delete"})]})]})}):e.jsxs(S,{size:"sm",variant:"outline",disabled:k,onClick:()=>D(l.id),children:[i?e.jsx(G,{size:13,className:"animate-spin"}):e.jsx(Q,{size:13}),"Download"]})})]},l.id)}),e.jsx($e,{open:!!h,onOpenChange:l=>{l||x(null)},children:e.jsxs(Ue,{children:[e.jsxs(Re,{children:[e.jsxs(Ie,{children:["Delete ",h?.label,"?"]}),e.jsx(Te,{children:"Files for this engine are removed from disk. Your models are not affected."})]}),e.jsxs(_e,{children:[e.jsx(Fe,{children:"Cancel"}),e.jsx(Oe,{onClick:()=>h&&$(h.id),disabled:c.remove.isPending,children:"Delete"})]})]})})]})}function ls(n){return/[\\/]engines[\\/]llama\.cpp-/.test(n)}function rs(n){if(ls(n.binPath)){const s=J(n.binPath)?.backend;return s?`official-llama-${s}`:"official-llama"}return n.kind==="koboldcpp"||n.kind==="mlx"||n.kind==="vllm"?n.kind:/[\\/]engines[\\/]turboquant[\\/]/.test(n.binPath)?"turboquant":`user:${n.id}`}const os={"official-llama":"llama.cpp",koboldcpp:"KoboldCpp",mlx:"MLX",vllm:"vLLM",turboquant:"TurboQuant"};function cs(n,s){if(n.startsWith("official-llama-")){const i=n.slice(15);return`llama.cpp (${We[i]??i.toUpperCase()})`}return os[n]??s[0]?.name??n}const We={cuda:"CUDA",rocm:"ROCm",sycl:"SYCL",vulkan:"Vulkan",metal:"Metal",cpu:"CPU"};function J(n){const s=n.match(/llama\.cpp-([^/\\]+)-(cuda|rocm|sycl|vulkan|metal|cpu)/);return s?{tag:s[1],backend:s[2]}:null}function me(n){if(!n)return null;const s=n.match(/b(\d+)/);return s?Number(s[1]):null}function De(n){const s=J(n.binPath);if(s){const i=We[s.backend]??s.backend.toUpperCase();return`${s.tag} · ${i}`}return n.version||n.name}function ds(n){let s=null,i=-1/0;for(const a of n){const u=J(a.binPath),d=me(u?.tag);d!=null&&d>i&&(i=d,s=a.id)}return s}function us(n){const s=[],i=new Map;for(const a of n){const u=rs(a);let d=i.get(u);d||(d=[],i.set(u,d),s.push(u)),d.push(a)}return s.map(a=>{const d=[...i.get(a)].sort((c,o)=>{const g=me(J(c.binPath)?.tag);return(me(J(o.binPath)?.tag)??-1)-(g??-1)});return{key:a,label:cs(a,d),members:d,latestId:ds(d)}})}function ms(n,s){const i=n.members.find(a=>a.id===s);if(i)return i;if(n.latestId){const a=n.members.find(u=>u.id===n.latestId);if(a)return a}return n.members[0]}const xs="https://github.com/mohitsoni48/Turbo-LLM/issues/new?template=engine-request.yml",ps=n=>/[\\/]engines[\\/]llama\.cpp-/.test(n);function Xe(n){return n.kind==="mlx"?"mlx":n.kind==="vllm"?"vllm":n.kind==="koboldcpp"?"koboldcpp":n.kind==="llamafile"?"llamafile":/[\\/]engines[\\/]turboquant[\\/]/.test(n.binPath)?"turboquant":"llama.cpp"}function hs(n,s){if(n.kind==="mlx")return"MLX · Apple Metal";if(n.kind==="vllm")return"vLLM";if(n.kind==="koboldcpp")return"KoboldCpp";if(n.kind==="llamafile")return"llamafile";if(ps(n.binPath)){const i=s?.backends.find(a=>a.active);return i?`llama.cpp · ${i.label}`:"llama.cpp"}return n.name}function Us(){const n=Me(),{data:s}=ie(),i=!!s?.engineProvision?.active,a=gn(i),u=Le(i),d=ke(x=>x.logPanelOpen),c=ke(x=>x.setLogPanelOpen),o=n.data,g=o?.activeEngineId??"",h=o?.engines.find(x=>x.id===g)??null;return e.jsxs("div",{className:"w-full px-6 py-6",children:[e.jsx(kn,{title:"Engines",description:"Switch the running engine up top. Install and manage engines below.",actions:e.jsx(be,{})}),e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(fs,{rec:a.data,list:o,backends:u.data,activeEngine:h}),h&&e.jsx(Kn,{status:s,activeEngineName:h.name}),n.isError?e.jsx(Y,{message:n.error instanceof C?n.error.message:"Could not load engines.",onRetry:()=>{n.refetch()}}):e.jsx(gs,{rec:a.data,isLoading:a.isLoading,activeCatalogId:h?Xe(h):null,provisioning:i}),e.jsx(js,{}),h&&e.jsx(ns,{open:d,onOpenChange:c})]})]})}function fs({rec:n,list:s,backends:i,activeEngine:a}){const u=Z(),{data:d}=bn(),{data:c}=pe(),{data:o}=ie(),g=Ae(),[h,x]=b.useState(!1),N=b.useRef(!1),f=o?.engineBuild,w=!!f?.active;b.useEffect(()=>{N.current&&!w&&f&&(g.refresh(),f.phase==="done"&&f.engine&&f.engine!=="CUDA Toolkit"?v.success(`${f.engine} built and added — it's now your active engine.`):f.phase==="error"&&f.error&&f.engine!=="CUDA Toolkit"&&v.error(f.error)),N.current=w},[w]);const k=a?c?.updates[a.id]:void 0,B=!!k?.rebuild&&!!k?.hasUpdate&&!!a?.sourceRepo,D=n?.hardware,z=D?.gpuName??d?.gpus[0]?.name??null,P=D?.vramMb??d?.gpus[0]?.vramMb??0,A=D?Pe(D.platform):d?.os.split("/")[0]?Pe(d.os.split("/")[0]):"",$=[z??"CPU-only",P>0?`${(P/1024).toFixed(0)} GB`:null,A||null].filter(Boolean).join(" · "),L=s?.engines??[],l=b.useMemo(()=>us(L),[L]),m=a?l.find(p=>p.members.some(y=>y.id===a.id))??null:null,t=a?hs(a,i):null,r=n?.recommendation.recommended?.engineId,j=!!a&&!!r&&Xe(a)===r,E=u.activate.isPending,I=p=>{p!==a?.id&&u.activate.mutate(p,{onError:y=>v.error(y instanceof C?y.message:"Could not switch engine.")})},V=p=>{const y=ms(p,a?.id??null);y&&I(y.id)};return e.jsxs("div",{className:"rounded-lg border border-border bg-panel p-4",style:{background:"color-mix(in srgb, var(--ok) 5%, var(--panel))"},children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium text-muted",children:[e.jsx(jn,{size:13,className:"shrink-0",style:{color:"var(--ok)"}}),"Your hardware"]}),e.jsx("div",{className:"mt-0.5 truncate text-sm font-semibold text-ink",children:$||"Detecting…"})]}),e.jsxs("div",{className:"flex flex-col items-start gap-1 md:items-end",children:[e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:"Running now"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:justify-end",children:[e.jsxs(se,{children:[e.jsxs(te,{disabled:E||l.length===0,className:"flex h-9 min-w-[220px] items-center gap-2 rounded-lg border border-border bg-bg px-3 text-[13px] text-ink transition-colors hover:border-[color:var(--accent)] disabled:opacity-60",children:[e.jsx("span",{className:"flex h-2 w-2 shrink-0 rounded-full",style:{background:a?"var(--ok)":"var(--faint)"}}),e.jsx("span",{className:"flex-1 truncate text-left",children:m?.label??(l.length?"No engine active":"No engine installed")}),e.jsx(de,{size:14,className:"shrink-0 text-muted"})]}),e.jsxs(ae,{align:"end",className:"w-[280px]",children:[e.jsx("div",{className:"px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide text-faint",children:"Installed engines"}),l.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-[12px] text-muted",children:"Install an engine below to get started."}),l.map(p=>{const y=p.members.some(_=>!!c?.updates[_.id]?.rebuild&&!!c?.updates[_.id]?.hasUpdate),O=p.key===m?.key;return e.jsxs(U,{onSelect:()=>V(p),className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:O&&e.jsx(F,{size:14,className:"text-accent"})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:p.label}),p.members.length>1&&e.jsxs("span",{className:"shrink-0 text-[11px] text-faint",children:[p.members.length," builds"]}),y&&e.jsx("span",{className:"shrink-0 text-[11px]",style:{color:"var(--accent)"},children:"rebuild"}),O&&e.jsx("span",{className:"shrink-0 text-[11px] text-accent",children:"active"})]},p.key)}),e.jsx(X,{}),e.jsx("div",{className:"px-2 py-1.5 text-[11px] text-faint",children:"Install more engines below ↓"})]})]}),m&&m.members.length>1&&e.jsxs(se,{children:[e.jsxs(te,{disabled:E,className:"flex h-9 min-w-[160px] items-center gap-2 rounded-lg border border-border bg-bg px-3 text-[13px] text-ink transition-colors hover:border-[color:var(--accent)] disabled:opacity-60",children:[e.jsx(Rn,{size:14,className:"shrink-0 text-accent"}),e.jsx("span",{className:"flex-1 truncate text-left",children:a?De(a):"Choose a build"}),e.jsx(de,{size:14,className:"shrink-0 text-muted"})]}),e.jsxs(ae,{align:"end",className:"w-[260px]",children:[e.jsx("div",{className:"px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide text-faint",children:"Version"}),m.members.map(p=>e.jsxs(U,{onSelect:()=>I(p.id),className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:p.id===a?.id&&e.jsx(F,{size:14,className:"text-accent"})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:De(p)}),p.id===m.latestId&&e.jsx("span",{className:"shrink-0 text-[11px]",style:{color:"var(--ok)"},children:"latest"})]},p.id))]})]})]}),t&&e.jsx("span",{className:"text-[11px] text-muted",children:t}),j&&e.jsxs("span",{className:"flex items-center gap-1 text-[11px]",style:{color:"var(--ok)"},children:[e.jsx(ge,{size:11})," recommended for your hardware"]}),B&&e.jsxs("button",{type:"button",onClick:()=>x(!0),className:"inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors hover:opacity-80",style:{background:"color-mix(in srgb, var(--accent) 15%, transparent)",color:"var(--accent)"},children:[e.jsx(On,{size:11,className:"shrink-0"}),"Rebuild available",k?.installed&&k?.latest?` · ${k.installed} → ${k.latest}`:""]})]})]}),B&&a?.sourceRepo&&e.jsx(ue,{open:h,onOpenChange:x,repoUrl:a.sourceRepo,branch:a.sourceBranch,engineName:a.name,mode:"rebuild"})]})}function gs({rec:n,isLoading:s,activeCatalogId:i,provisioning:a}){const u=vn(a),{data:d}=Me(),{data:c}=pe(a),o=Ee(),g=Z(),h=Be(),[x,N]=b.useState(null),f=b.useMemo(()=>{const t=new Map;for(const r of u.data?.engines??[])t.set(r.id,r);return t},[u.data]);if(s||!n)return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(xe,{children:"Install & manage"}),e.jsx(oe,{className:"h-16 w-full"}),e.jsx(oe,{className:"h-16 w-full"}),e.jsx(oe,{className:"h-16 w-full"})]});const w=a||o.vllm.isPending||o.mlx.isPending||o.turboquant.isPending||o.koboldcpp.isPending||o.llamafile.isPending||o.updateVllm.isPending||o.updateMlx.isPending||o.updateTurboquant.isPending||o.updateKoboldcpp.isPending||o.updateLlamafile.isPending||g.remove.isPending||g.purge.isPending,k=t=>t.installEndpoint==="/api/v1/engines/vllm"?o.vllm:t.installEndpoint==="/api/v1/engines/mlx"?o.mlx:t.installEndpoint==="/api/v1/engines/turboquant"?o.turboquant:t.installEndpoint==="/api/v1/engines/koboldcpp"?o.koboldcpp:t.installEndpoint==="/api/v1/engines/llamafile"?o.llamafile:null,B=t=>t.installEndpoint==="/api/v1/engines/vllm"?o.updateVllm:t.installEndpoint==="/api/v1/engines/mlx"?o.updateMlx:t.installEndpoint==="/api/v1/engines/turboquant"?o.updateTurboquant:t.installEndpoint==="/api/v1/engines/koboldcpp"?o.updateKoboldcpp:t.installEndpoint==="/api/v1/engines/llamafile"?o.updateLlamafile:null,D=t=>{const r=d?.engines??[];if(t.sourceEngineId)return t.sourceEngineId;if(t.provision==="pip")return r.find(j=>j.kind===t.kind)?.id;if(t.id==="turboquant")return r.find(j=>/[\\/]engines[\\/]turboquant[\\/]/.test(j.binPath))?.id;if(t.id==="koboldcpp"||t.id==="llamafile")return r.find(j=>j.kind===t.kind)?.id},z=t=>{const r=k(t);r&&r.mutate(void 0,{onError:j=>v.error(j instanceof C?j.message:`Could not install ${t.name}.`)})},P=t=>{if(t.sourceBuilt&&t.sourceBinPath){g.add.mutate({binPath:t.sourceBinPath,name:t.name,sourceRepo:t.homepage,sourceBranch:t.sourceBranch||void 0},{onSuccess:()=>v.success(`${t.name} enabled`),onError:j=>v.error(j instanceof C?j.message:`Could not enable ${t.name}.`)});return}const r=k(t);r&&r.mutate(void 0,{onSuccess:()=>v.success(`${t.name} enabled`),onError:j=>v.error(j instanceof C?j.message:`Could not enable ${t.name}.`)})},A=t=>{const r=D(t);if(!r){v.error(`Could not find the installed ${t.name} engine.`);return}g.remove.mutate(r,{onSuccess:()=>v.success(`${t.name} disabled`),onError:j=>v.error(j instanceof C?j.message:`Could not disable ${t.name}.`)})},$=t=>{const r=B(t);r&&r.mutate(void 0,{onSuccess:()=>v.success(`Updating ${t.name} to the latest release…`),onError:j=>v.error(j instanceof C?j.message:`Could not update ${t.name}.`)})},L=(t,r)=>{const j=D(t);if(!j){v.error(`Could not find the installed ${t.name} engine.`);return}h.mutate({id:j,policy:r},{onError:E=>v.error(E instanceof C?E.message:"Could not change auto-update.")})},l=t=>{const r=D(t);if(!r){v.error(`Could not find the installed ${t.name} engine to delete.`);return}N({e:t,registryId:r})},m=()=>{x&&g.purge.mutate(x.registryId,{onSuccess:()=>{v.success(`${x.e.name} deleted`),N(null)},onError:t=>{N(null),v.error(t instanceof C?t.message:`Could not delete ${x.e.name}.`)}})};return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(xe,{children:"Install & manage"}),n.recommendation.fits.filter(t=>{const r=f.get(t.engine.id);return t.engine.id==="vllm"||!r||r.supportedHere!==!1}).map(t=>{if(t.engine.id==="llama.cpp")return e.jsx(Qe,{filter:"recommended"},t.engine.id);const r=D(f.get(t.engine.id)??t.engine);return e.jsx(bs,{fit:t,catalog:f.get(t.engine.id),isActive:i===t.engine.id,anyPending:w,provisioning:a,updateStatus:r?c?.updates[r]:void 0,policy:(r?c?.policies[r]:void 0)??"notify",installFor:k,onInstall:z,onEnable:P,onDisable:A,onUpdate:$,onDelete:l,onSetPolicy:L},t.engine.id)}),e.jsxs("div",{className:"flex items-center gap-3 rounded-[var(--radius)] border border-dashed border-border-strong bg-panel p-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-ink",children:"Add your own engine"}),e.jsx("div",{className:"mt-0.5 text-[12px] text-muted",children:"Point TurboLLM at any llama-server compatible binary — mainline llama.cpp or a community fork."})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(be,{})})]}),e.jsxs("a",{href:xs,target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1 self-start text-[12px] text-muted hover:text-ink",children:["Don't see your engine? Register it ",e.jsx(le,{size:11})]}),e.jsx($e,{open:!!x,onOpenChange:t=>{t||N(null)},children:e.jsxs(Ue,{children:[e.jsxs(Re,{children:[e.jsxs(Ie,{children:["Delete ",x?.e.name,"?"]}),e.jsx(Te,{children:"Files for this engine are removed from disk. Your models are not affected."})]}),e.jsxs(_e,{children:[e.jsx(Fe,{children:"Cancel"}),e.jsx(Oe,{onClick:m,disabled:g.purge.isPending,children:"Delete"})]})]})})]})}function bs({fit:n,catalog:s,isActive:i,anyPending:a,provisioning:u,updateStatus:d,policy:c,installFor:o,onInstall:g,onEnable:h,onDisable:x,onUpdate:N,onDelete:f,onSetPolicy:w}){const k=n.engine,[B,D]=b.useState(!1),[z,P]=b.useState(!1),A=k.id==="llama.cpp",$=!!s?.sourceBuilt,L=n.compatible.length===0,l=!L&&n.compatible.every(E=>!E.hasPrebuilt),m=k.support==="experimental",t=!!s?.installed,r=!!s?.enabled,j=t&&!r;return e.jsxs("div",{className:"flex items-start gap-3 rounded-[var(--radius)] border border-border bg-panel p-4",style:L?{opacity:.65}:void 0,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-sm font-semibold text-ink",children:k.name}),n.recommended?e.jsxs(T,{variant:"accent",children:[e.jsx(ge,{size:10})," Recommended for you"]}):i?e.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium",style:{color:"var(--ok)"},children:[e.jsx(F,{size:11})," Active"]}):r?e.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium text-muted",children:[e.jsx(F,{size:11})," Installed"]}):null,m&&e.jsx(T,{variant:"mono",children:"experimental"}),k.id==="vllm"&&e.jsx(T,{variant:"mono",children:"For power users"}),j&&e.jsx(T,{variant:"mono",children:"Disabled"}),r&&d?.hasUpdate&&!d?.rebuild&&e.jsx(T,{variant:"accent",children:"Update available"}),L&&n.incompatibleReason&&e.jsx(T,{variant:"mono",children:n.incompatibleReason}),s&&e.jsxs("a",{href:s.homepage,target:"_blank",rel:"noreferrer",className:"flex items-center gap-0.5 text-[11px] text-muted hover:text-ink",title:s.homepage,children:[e.jsx(le,{size:10})," docs"]})]}),e.jsx("div",{className:"mt-0.5 text-[12px] text-muted",children:k.description}),A&&e.jsx("div",{className:"mt-1 text-[11px] text-faint",children:"Pick a specific GPU build in Advanced below."}),!A&&r&&e.jsx("div",{className:"mt-1",children:e.jsx(Ns,{st:d})})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:A?e.jsx("span",{className:"text-[12px] text-faint",children:"built-in"}):s?t?e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(te,{"aria-label":`Actions for ${k.name}`,disabled:a,className:"grid h-8 w-8 place-items-center rounded-md text-muted hover:bg-panel-2 hover:text-ink disabled:opacity-50",children:e.jsx(ze,{size:16})}),e.jsxs(ae,{align:"end",children:[$?e.jsxs(U,{onSelect:()=>P(!0),disabled:a,children:[e.jsx(He,{size:14})," ",d?.hasUpdate?"Rebuild (new commit)":"Rebuild"]}):e.jsxs(U,{onSelect:()=>N(s),disabled:u,children:[e.jsx(Q,{size:14})," ",d?.hasUpdate?"Update now":"Update"]}),r?e.jsx(U,{onSelect:()=>x(s),children:"Disable"}):e.jsx(U,{onSelect:()=>h(s),children:"Enable"}),r&&e.jsxs(e.Fragment,{children:[e.jsx(X,{}),e.jsx("div",{className:"px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-faint",children:"Auto-update"}),["off","notify","auto"].map(E=>e.jsxs(U,{onSelect:()=>w(s,E),className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c===E&&e.jsx(F,{size:13,className:"text-accent"})}),vs[E]]},E))]}),e.jsx(X,{}),e.jsx(U,{destructive:!0,onSelect:()=>f(s),children:"Delete"})]})]}),$&&s&&e.jsx(ue,{open:z,onOpenChange:P,repoUrl:s.homepage,branch:s.sourceBranch||void 0,engineName:k.name,mode:"rebuild"})]}):l?e.jsxs(e.Fragment,{children:[e.jsx(S,{size:"sm",variant:"outline",onClick:()=>D(!0),title:"No prebuilt binary — build it from source with a guided walkthrough.",children:"Build from source"}),e.jsx(ue,{open:B,onOpenChange:D,repoUrl:s.homepage,engineName:k.name})]}):e.jsxs(S,{size:"sm",variant:"outline",disabled:a||L||s.comingSoon||!o(s),onClick:()=>g(s),title:s.comingSoon?"Not yet available":L?n.incompatibleReason??"Not supported on this hardware":`Install ${k.name}`,children:[o(s)?.isPending?e.jsx(G,{size:13,className:"animate-spin"}):e.jsx(Q,{size:13}),s.comingSoon?"Coming soon":"Install"]}):null})]})}function js(){const[n,s]=b.useState(!1);return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>s(i=>!i),"aria-expanded":n,className:"flex w-full items-center gap-2 text-left",children:[e.jsx(de,{size:14,className:"shrink-0 text-muted transition-transform",style:{transform:n?"rotate(0deg)":"rotate(-90deg)"}}),e.jsx(xe,{children:"Other llama.cpp builds"}),e.jsx("span",{className:"text-[11px] text-faint",children:"ROCm · CPU · Vulkan · SYCL"})]}),n&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-[12px] text-muted",children:"The other GPU/CPU backends for llama.cpp. Download one, then switch to it from the engine dropdown up top. The recommended backend is in “Install & manage”."}),e.jsx(Qe,{filter:"others"})]})]})}const vs={off:"Off",notify:"Notify",auto:"Auto"};function ks(n){const s=new Date(n).getTime();if(!Number.isFinite(s))return"";const i=Date.now()-s;if(i<6e4)return"just now";const a=Math.floor(i/6e4);if(a<60)return`${a}m ago`;const u=Math.floor(a/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}function Ns({st:n,repoUrl:s}){return n?n.error==="offline"?e.jsx("span",{className:"text-[11px] text-faint",children:"Couldn't check for updates (offline)"}):n.error==="no_source"||!n.comparable?e.jsx("span",{className:"text-[11px] text-faint",children:"Update status unavailable"}):n.rebuild&&n.hasUpdate?e.jsxs("span",{className:"text-[11px]",style:{color:"var(--accent)"},children:["Newer source available · rebuild"," ",s&&e.jsx("a",{href:s,target:"_blank",rel:"noreferrer",className:"underline-offset-2 hover:underline",children:"(open repo)"})]}):n.hasUpdate&&n.latest?e.jsxs("span",{className:"text-[11px]",style:{color:"var(--accent)"},children:["Update available · ",n.installed||"?"," → ",n.latest]}):e.jsxs("span",{className:"text-[11px] text-faint",children:["Up to date · ",n.latest??n.installed,n.checkedAt?` · checked ${ks(n.checkedAt)}`:""]}):null}function xe({children:n}){return e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:n})}const ys={darwin:"macOS",win32:"Windows",linux:"Linux"};function Pe(n){return ys[n]??n}export{Us as EnginesScreen};