farming-code 2.2.22 → 2.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/native-pty-host-client.js +99 -7
- package/backend/native-pty-host-path.js +20 -0
- package/backend/native-pty-host.js +46 -9
- package/backend/workspace-file-router.js +30 -6
- package/dist/assets/{App-CmZdNavW.js → App-Cm8qTjsc.js} +24 -24
- package/dist/assets/{FileEditorMarkdownPreview-KbnE8VC8.js → FileEditorMarkdownPreview-Da5jguUs.js} +1 -1
- package/dist/assets/{FileEditorPane-5_HUejjd.js → FileEditorPane-fFqHA4wW.js} +2 -2
- package/dist/assets/{ProjectFilesSection-C1RAJWOE.js → ProjectFilesSection-Cyy3Vcn8.js} +1 -1
- package/dist/assets/file-icons-BqiH0rDI.js +1 -0
- package/dist/assets/{index-RvUiMpGP.js → index-CtwKYTiC.js} +2 -2
- package/dist/assets/{workspace-view-state-BqB4HM7r.js → workspace-view-state-BiuEbmRr.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/file-icons-CHWt5nSy.js +0 -1
package/dist/assets/{FileEditorMarkdownPreview-KbnE8VC8.js → FileEditorMarkdownPreview-Da5jguUs.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-gSpX30pV.js","assets/preload-helper-mJowh_hw.js","assets/chunk-HOUHSVGY-D8tIeoPk.js","assets/src-WBW1QxJt.js","assets/chunk-DECur_0Z.js","assets/chunk-Y2CYZVJY-Di0sYzi1.js","assets/chunk-WYO6CB5R-CUxMtfK2.js","assets/chunk-ICXQ74PX-b6oQ2Q17.js","assets/dist-ClAL-Tv5.js","assets/chunk-52WLFC77-Gncjk4LF.js","assets/line-CfptFMmX.js","assets/path-YdFzr2W6.js","assets/array-HeX70jSN.js","assets/chunk-7BUUIJ7U-ZBRhjLOh.js","assets/chunk-C7G6YPKG-CiDVUP82.js","assets/chunk-OGEWGWER-DxoiMCI-.js","assets/chunk-Q4XR5HBZ-Di4H7L21.js","assets/chunk-ZGVPDNZ5-CoV2QEl0.js","assets/rough.esm-c4PR5shF.js","assets/chunk-FWX5IMBZ-DMZBccQa.js","assets/chunk-VAUOI2AC-UHNr_yhX.js","assets/chunk-ZIRB5QZD-DncwlQQc.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r,t as i}from"./jsx-runtime-BthL93pI.js";import{t as a}from"./preload-helper-mJowh_hw.js";import{g as o}from"./file-icons-CHWt5nSy.js";import{p as s}from"./workspace-editor-model-D0Im34S5.js";import{a as c,c as l,d as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./core-B9MwRjDE.js";var y=`wroot_global`,b=`__farming_global_files_project__`;function x(e){return e===y}function S(e){return String(e||``).trim().replace(/\\/g,`/`).replace(/\/+/g,`/`).replace(/^\/+/,``)}function C(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function w(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var T=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ee={};function D(e,t){return((t||ee).jsx?E:T).test(e)}var te=/[ \t\n\f\r]/g;function ne(e){return typeof e==`object`?e.type===`text`?re(e.value):!1:re(e)}function re(e){return e.replace(te,``)===``}var ie=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ie.prototype.normal={},ie.prototype.property={},ie.prototype.space=void 0;function ae(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ie(n,r,t)}function oe(e){return e.toLowerCase()}var se=class{constructor(e,t){this.attribute=t,this.property=e}};se.prototype.attribute=``,se.prototype.booleanish=!1,se.prototype.boolean=!1,se.prototype.commaOrSpaceSeparated=!1,se.prototype.commaSeparated=!1,se.prototype.defined=!1,se.prototype.mustUseProperty=!1,se.prototype.number=!1,se.prototype.overloadedBoolean=!1,se.prototype.property=``,se.prototype.spaceSeparated=!1,se.prototype.space=void 0;var ce=e({boolean:()=>O,booleanish:()=>ue,commaOrSpaceSeparated:()=>me,commaSeparated:()=>pe,number:()=>k,overloadedBoolean:()=>de,spaceSeparated:()=>fe}),le=0,O=he(),ue=he(),de=he(),k=he(),fe=he(),pe=he(),me=he();function he(){return 2**++le}var ge=Object.keys(ce),_e=class extends se{constructor(e,t,n,r){let i=-1;if(super(e,t),ve(this,`space`,r),typeof n==`number`)for(;++i<ge.length;){let e=ge[i];ve(this,ge[i],(n&ce[e])===ce[e])}}};_e.prototype.defined=!0;function ve(e,t,n){n&&(e[t]=n)}function ye(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _e(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[oe(r)]=r,n[oe(a.attribute)]=r}return new ie(t,n,e.space)}var be=ye({properties:{ariaActiveDescendant:null,ariaAtomic:ue,ariaAutoComplete:null,ariaBusy:ue,ariaChecked:ue,ariaColCount:k,ariaColIndex:k,ariaColSpan:k,ariaControls:fe,ariaCurrent:null,ariaDescribedBy:fe,ariaDetails:null,ariaDisabled:ue,ariaDropEffect:fe,ariaErrorMessage:null,ariaExpanded:ue,ariaFlowTo:fe,ariaGrabbed:ue,ariaHasPopup:null,ariaHidden:ue,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fe,ariaLevel:k,ariaLive:null,ariaModal:ue,ariaMultiLine:ue,ariaMultiSelectable:ue,ariaOrientation:null,ariaOwns:fe,ariaPlaceholder:null,ariaPosInSet:k,ariaPressed:ue,ariaReadOnly:ue,ariaRelevant:null,ariaRequired:ue,ariaRoleDescription:fe,ariaRowCount:k,ariaRowIndex:k,ariaRowSpan:k,ariaSelected:ue,ariaSetSize:k,ariaSort:null,ariaValueMax:k,ariaValueMin:k,ariaValueNow:k,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xe(e,t){return t in e?e[t]:t}function Se(e,t){return xe(e,t.toLowerCase())}var Ce=ye({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:pe,acceptCharset:fe,accessKey:fe,action:null,allow:null,allowFullScreen:O,allowPaymentRequest:O,allowUserMedia:O,alpha:O,alt:null,as:null,async:O,autoCapitalize:null,autoComplete:fe,autoFocus:O,autoPlay:O,blocking:fe,capture:null,charSet:null,checked:O,cite:null,className:fe,closedBy:null,colorSpace:null,cols:k,colSpan:k,command:null,commandFor:null,content:null,contentEditable:ue,controls:O,controlsList:fe,coords:k|pe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:O,defer:O,dir:null,dirName:null,disabled:O,download:de,draggable:ue,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:O,formTarget:null,headers:fe,height:k,hidden:de,high:k,href:null,hrefLang:null,htmlFor:fe,httpEquiv:fe,id:null,imageSizes:null,imageSrcSet:null,inert:O,inputMode:null,integrity:null,is:null,isMap:O,itemId:null,itemProp:fe,itemRef:fe,itemScope:O,itemType:fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:O,low:k,manifest:null,max:null,maxLength:k,media:null,method:null,min:null,minLength:k,multiple:O,muted:O,name:null,nonce:null,noModule:O,noValidate:O,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:O,optimum:k,pattern:null,ping:fe,placeholder:null,playsInline:O,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:O,referrerPolicy:null,rel:fe,required:O,reversed:O,rows:k,rowSpan:k,sandbox:fe,scope:null,scoped:O,seamless:O,selected:O,shadowRootClonable:O,shadowRootCustomElementRegistry:O,shadowRootDelegatesFocus:O,shadowRootMode:null,shadowRootSerializable:O,shape:null,size:k,sizes:null,slot:null,span:k,spellCheck:ue,src:null,srcDoc:null,srcLang:null,srcSet:null,start:k,step:null,style:null,tabIndex:k,target:null,title:null,translate:null,type:null,typeMustMatch:O,useMap:null,value:ue,width:k,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fe,axis:null,background:null,bgColor:null,border:k,borderColor:null,bottomMargin:k,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:O,declare:O,event:null,face:null,frame:null,frameBorder:null,hSpace:k,leftMargin:k,link:null,longDesc:null,lowSrc:null,marginHeight:k,marginWidth:k,noResize:O,noHref:O,noShade:O,noWrap:O,object:null,profile:null,prompt:null,rev:null,rightMargin:k,rules:null,scheme:null,scrolling:ue,standby:null,summary:null,text:null,topMargin:k,valueType:null,version:null,vAlign:null,vLink:null,vSpace:k,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:O,disablePictureInPicture:O,disableRemotePlayback:O,exportParts:pe,part:fe,prefix:null,property:null,results:k,security:null,unselectable:null},space:`html`,transform:Se}),we=ye({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:me,accentHeight:k,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:k,amplitude:k,arabicForm:null,ascent:k,attributeName:null,attributeType:null,azimuth:k,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:k,by:null,calcMode:null,capHeight:k,className:fe,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:k,diffuseConstant:k,direction:null,display:null,dur:null,divisor:k,dominantBaseline:null,download:O,dx:null,dy:null,edgeMode:null,editable:null,elevation:k,enableBackground:null,end:null,event:null,exponent:k,externalResourcesRequired:null,fill:null,fillOpacity:k,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:pe,g2:pe,glyphName:pe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:k,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:k,horizOriginX:k,horizOriginY:k,id:null,ideographic:k,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:k,k,k1:k,k2:k,k3:k,k4:k,kernelMatrix:me,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:k,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:k,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:k,overlineThickness:k,paintOrder:null,panose1:null,path:null,pathLength:k,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:k,pointsAtY:k,pointsAtZ:k,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:me,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:me,rev:me,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:me,requiredFeatures:me,requiredFonts:me,requiredFormats:me,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:k,specularExponent:k,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:k,strikethroughThickness:k,string:null,stroke:null,strokeDashArray:me,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:k,strokeOpacity:k,strokeWidth:null,style:null,surfaceScale:k,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:me,tabIndex:k,tableValues:null,target:null,targetX:k,targetY:k,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:me,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:k,underlineThickness:k,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:k,values:null,vAlphabetic:k,vMathematical:k,vectorEffect:null,vHanging:k,vIdeographic:k,version:null,vertAdvY:k,vertOriginX:k,vertOriginY:k,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:k,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xe}),Te=ye({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()}}),Ee=ye({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Se}),De=ye({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oe={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`},ke=/[A-Z]/g,Ae=/-[a-z]/g,je=/^data[-\w.:]+$/i;function Me(e,t){let n=oe(t),r=t,i=se;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&je.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ae,Pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ae.test(e)){let n=e.replace(ke,Ne);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_e}return new i(r,t)}function Ne(e){return`-`+e.toLowerCase()}function Pe(e){return e.charAt(1).toUpperCase()}var Fe=ae([be,Ce,Te,Ee,De],`html`),Ie=ae([be,we,Te,Ee,De],`svg`);function Le(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
2
|
+
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r,t as i}from"./jsx-runtime-BthL93pI.js";import{t as a}from"./preload-helper-mJowh_hw.js";import{g as o}from"./file-icons-BqiH0rDI.js";import{p as s}from"./workspace-editor-model-D0Im34S5.js";import{a as c,c as l,d as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./core-B9MwRjDE.js";var y=`wroot_global`,b=`__farming_global_files_project__`;function x(e){return e===y}function S(e){return String(e||``).trim().replace(/\\/g,`/`).replace(/\/+/g,`/`).replace(/^\/+/,``)}function C(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function w(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var T=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ee={};function D(e,t){return((t||ee).jsx?E:T).test(e)}var te=/[ \t\n\f\r]/g;function ne(e){return typeof e==`object`?e.type===`text`?re(e.value):!1:re(e)}function re(e){return e.replace(te,``)===``}var ie=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ie.prototype.normal={},ie.prototype.property={},ie.prototype.space=void 0;function ae(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ie(n,r,t)}function oe(e){return e.toLowerCase()}var se=class{constructor(e,t){this.attribute=t,this.property=e}};se.prototype.attribute=``,se.prototype.booleanish=!1,se.prototype.boolean=!1,se.prototype.commaOrSpaceSeparated=!1,se.prototype.commaSeparated=!1,se.prototype.defined=!1,se.prototype.mustUseProperty=!1,se.prototype.number=!1,se.prototype.overloadedBoolean=!1,se.prototype.property=``,se.prototype.spaceSeparated=!1,se.prototype.space=void 0;var ce=e({boolean:()=>O,booleanish:()=>ue,commaOrSpaceSeparated:()=>me,commaSeparated:()=>pe,number:()=>k,overloadedBoolean:()=>de,spaceSeparated:()=>fe}),le=0,O=he(),ue=he(),de=he(),k=he(),fe=he(),pe=he(),me=he();function he(){return 2**++le}var ge=Object.keys(ce),_e=class extends se{constructor(e,t,n,r){let i=-1;if(super(e,t),ve(this,`space`,r),typeof n==`number`)for(;++i<ge.length;){let e=ge[i];ve(this,ge[i],(n&ce[e])===ce[e])}}};_e.prototype.defined=!0;function ve(e,t,n){n&&(e[t]=n)}function ye(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _e(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[oe(r)]=r,n[oe(a.attribute)]=r}return new ie(t,n,e.space)}var be=ye({properties:{ariaActiveDescendant:null,ariaAtomic:ue,ariaAutoComplete:null,ariaBusy:ue,ariaChecked:ue,ariaColCount:k,ariaColIndex:k,ariaColSpan:k,ariaControls:fe,ariaCurrent:null,ariaDescribedBy:fe,ariaDetails:null,ariaDisabled:ue,ariaDropEffect:fe,ariaErrorMessage:null,ariaExpanded:ue,ariaFlowTo:fe,ariaGrabbed:ue,ariaHasPopup:null,ariaHidden:ue,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:fe,ariaLevel:k,ariaLive:null,ariaModal:ue,ariaMultiLine:ue,ariaMultiSelectable:ue,ariaOrientation:null,ariaOwns:fe,ariaPlaceholder:null,ariaPosInSet:k,ariaPressed:ue,ariaReadOnly:ue,ariaRelevant:null,ariaRequired:ue,ariaRoleDescription:fe,ariaRowCount:k,ariaRowIndex:k,ariaRowSpan:k,ariaSelected:ue,ariaSetSize:k,ariaSort:null,ariaValueMax:k,ariaValueMin:k,ariaValueNow:k,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xe(e,t){return t in e?e[t]:t}function Se(e,t){return xe(e,t.toLowerCase())}var Ce=ye({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:pe,acceptCharset:fe,accessKey:fe,action:null,allow:null,allowFullScreen:O,allowPaymentRequest:O,allowUserMedia:O,alpha:O,alt:null,as:null,async:O,autoCapitalize:null,autoComplete:fe,autoFocus:O,autoPlay:O,blocking:fe,capture:null,charSet:null,checked:O,cite:null,className:fe,closedBy:null,colorSpace:null,cols:k,colSpan:k,command:null,commandFor:null,content:null,contentEditable:ue,controls:O,controlsList:fe,coords:k|pe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:O,defer:O,dir:null,dirName:null,disabled:O,download:de,draggable:ue,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:O,formTarget:null,headers:fe,height:k,hidden:de,high:k,href:null,hrefLang:null,htmlFor:fe,httpEquiv:fe,id:null,imageSizes:null,imageSrcSet:null,inert:O,inputMode:null,integrity:null,is:null,isMap:O,itemId:null,itemProp:fe,itemRef:fe,itemScope:O,itemType:fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:O,low:k,manifest:null,max:null,maxLength:k,media:null,method:null,min:null,minLength:k,multiple:O,muted:O,name:null,nonce:null,noModule:O,noValidate:O,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:O,optimum:k,pattern:null,ping:fe,placeholder:null,playsInline:O,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:O,referrerPolicy:null,rel:fe,required:O,reversed:O,rows:k,rowSpan:k,sandbox:fe,scope:null,scoped:O,seamless:O,selected:O,shadowRootClonable:O,shadowRootCustomElementRegistry:O,shadowRootDelegatesFocus:O,shadowRootMode:null,shadowRootSerializable:O,shape:null,size:k,sizes:null,slot:null,span:k,spellCheck:ue,src:null,srcDoc:null,srcLang:null,srcSet:null,start:k,step:null,style:null,tabIndex:k,target:null,title:null,translate:null,type:null,typeMustMatch:O,useMap:null,value:ue,width:k,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:fe,axis:null,background:null,bgColor:null,border:k,borderColor:null,bottomMargin:k,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:O,declare:O,event:null,face:null,frame:null,frameBorder:null,hSpace:k,leftMargin:k,link:null,longDesc:null,lowSrc:null,marginHeight:k,marginWidth:k,noResize:O,noHref:O,noShade:O,noWrap:O,object:null,profile:null,prompt:null,rev:null,rightMargin:k,rules:null,scheme:null,scrolling:ue,standby:null,summary:null,text:null,topMargin:k,valueType:null,version:null,vAlign:null,vLink:null,vSpace:k,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:O,disablePictureInPicture:O,disableRemotePlayback:O,exportParts:pe,part:fe,prefix:null,property:null,results:k,security:null,unselectable:null},space:`html`,transform:Se}),we=ye({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:me,accentHeight:k,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:k,amplitude:k,arabicForm:null,ascent:k,attributeName:null,attributeType:null,azimuth:k,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:k,by:null,calcMode:null,capHeight:k,className:fe,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:k,diffuseConstant:k,direction:null,display:null,dur:null,divisor:k,dominantBaseline:null,download:O,dx:null,dy:null,edgeMode:null,editable:null,elevation:k,enableBackground:null,end:null,event:null,exponent:k,externalResourcesRequired:null,fill:null,fillOpacity:k,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:pe,g2:pe,glyphName:pe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:k,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:k,horizOriginX:k,horizOriginY:k,id:null,ideographic:k,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:k,k,k1:k,k2:k,k3:k,k4:k,kernelMatrix:me,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:k,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:k,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:k,overlineThickness:k,paintOrder:null,panose1:null,path:null,pathLength:k,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:k,pointsAtY:k,pointsAtZ:k,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:me,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:me,rev:me,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:me,requiredFeatures:me,requiredFonts:me,requiredFormats:me,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:k,specularExponent:k,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:k,strikethroughThickness:k,string:null,stroke:null,strokeDashArray:me,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:k,strokeOpacity:k,strokeWidth:null,style:null,surfaceScale:k,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:me,tabIndex:k,tableValues:null,target:null,targetX:k,targetY:k,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:me,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:k,underlineThickness:k,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:k,values:null,vAlphabetic:k,vMathematical:k,vectorEffect:null,vHanging:k,vIdeographic:k,version:null,vertAdvY:k,vertOriginX:k,vertOriginY:k,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:k,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xe}),Te=ye({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()}}),Ee=ye({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Se}),De=ye({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oe={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`},ke=/[A-Z]/g,Ae=/-[a-z]/g,je=/^data[-\w.:]+$/i;function Me(e,t){let n=oe(t),r=t,i=se;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&je.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ae,Pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ae.test(e)){let n=e.replace(ke,Ne);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_e}return new i(r,t)}function Ne(e){return`-`+e.toLowerCase()}function Pe(e){return e.charAt(1).toUpperCase()}var Fe=ae([be,Ce,Te,Ee,De],`html`),Ie=ae([be,we,Te,Ee,De],`svg`);function Le(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
3
3
|
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Be=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(ze());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Ve=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),He=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Be()),r=Ve();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ue=Ge(`end`),We=Ge(`start`);function Ge(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ke(e){let t=We(e),n=Ue(e);if(t&&n)return{start:t,end:n}}function qe(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ye(e.position):`start`in e||`end`in e?Ye(e):`line`in e||`column`in e?Je(e):``}function Je(e){return Xe(e&&e.line)+`:`+Xe(e&&e.column)}function Ye(e){return Je(e&&e.start)+`-`+Je(e&&e.end)}function Xe(e){return e&&typeof e==`number`?e:1}var Ze=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=qe(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.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;var Qe=t(He(),1),$e={}.hasOwnProperty,et=new Map,tt=/[A-Z]/g,nt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),rt=new Set([`td`,`th`]),it=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function at(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=gt(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ht(n,t.jsx,t.jsxs)}let 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`?Ie:Fe,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ot(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ot(e,t,n){if(t.type===`element`)return st(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ct(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ut(e,t,n);if(t.type===`mdxjsEsm`)return lt(e,t);if(t.type===`root`)return dt(e,t,n);if(t.type===`text`)return ft(e,t)}function st(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Ie,e.schema=i),e.ancestors.push(t);let a=St(e,t.tagName,!1),o=_t(e,t),s=yt(e,t);return nt.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ne(e):!0})),pt(e,o,a,t),mt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ct(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ct(e,t.position)}function lt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ct(e,t.position)}function ut(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Ie,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:St(e,t.name,!0),o=vt(e,t),s=yt(e,t);return pt(e,o,a,t),mt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function dt(e,t,n){let r={};return mt(r,yt(e,t)),e.create(t,e.Fragment,r,n)}function ft(e,t){return t.value}function pt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function mt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ht(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function gt(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=We(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function _t(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&$e.call(t.properties,i)){let a=bt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&rt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function vt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ct(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ct(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function yt(e,t){let n=[],r=-1,i=e.passKeys?new Map:et;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=ot(e,a,o);s!==void 0&&n.push(s)}return n}function bt(e,t,n){let r=Me(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?w(n):Re(n)),r.property===`style`){let t=typeof n==`object`?n:xt(e,String(n));return e.stylePropertyNameCase===`css`&&(t=wt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Oe[r.property]||r.property:r.attribute,n]}}function xt(e,t){try{return(0,Qe.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Ze("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=it+`#cannot-parse-style-attribute`,r}}function St(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=D(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=D(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return $e.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ct(e)}function Ct(e,t){let 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=it+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function wt(e){let t={},n;for(n in e)$e.call(e,n)&&(t[Tt(n)]=e[n]);return t}function Tt(e){let t=e.replace(tt,Et);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Et(e){return`-`+e.toLowerCase()}var Dt={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`]},Ot={};function kt(e,t){let n=t||Ot;return At(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function At(e,t,n){if(Mt(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 jt(e.children,t,n)}return Array.isArray(e)?jt(e,t,n):``}function jt(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=At(e[i],t,n);return r.join(``)}function Mt(e){return!!(e&&typeof e==`object`)}var Nt=document.createElement(`i`);function Pt(e){let t=`&`+e+`;`;Nt.innerHTML=t;let n=Nt.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Ft(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function It(e,t){return e.length>0?(Ft(e,e.length,0,t),e):t}var Lt={}.hasOwnProperty;function Rt(e){let t={},n=-1;for(;++n<e.length;)zt(t,e[n]);return t}function zt(e,t){let n;for(n in t){let r=(Lt.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Lt.call(r,a)||(r[a]=[]);let e=i[a];Bt(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Bt(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ft(e,0,0,r)}function Vt(e,t){let 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 Ht(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ut=$t(/[A-Za-z]/),Wt=$t(/[\dA-Za-z]/),Gt=$t(/[#-'*+\--9=?A-Z^-~]/);function Kt(e){return e!==null&&(e<32||e===127)}var qt=$t(/\d/),Jt=$t(/[\dA-Fa-f]/),Yt=$t(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function Xt(e){return e!==null&&(e<0||e===32)}function j(e){return e===-2||e===-1||e===32}var Zt=$t(/\p{P}|\p{S}/u),Qt=$t(/\s/);function $t(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function en(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Wt(e.charCodeAt(n+1))&&Wt(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function M(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return j(r)?(e.enter(n),s(r)):t(r)}function s(r){return j(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var tn={tokenize:nn};function nn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),M(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return A(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var rn={tokenize:on},an={tokenize:sn};function on(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Ft(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(an,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(an,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return A(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Ft(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function sn(e,t,n){return M(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function cn(e){if(e===null||Xt(e)||Qt(e))return 1;if(Zt(e))return 2}function ln(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var un={name:`attention`,resolveAll:dn,tokenize:fn};function dn(e,t){let n=-1,r,i,a,o,s,c,l,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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};pn(d,-c),pn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=It(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=It(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=It(l,ln(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=It(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=It(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ft(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function fn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=cn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=cn(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function pn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var mn={name:`autolink`,tokenize:hn};function hn(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Ut(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Wt(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Wt(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Kt(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Gt(t)?(e.consume(t),l):n(t)}function u(e){return Wt(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Wt(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var gn={partial:!0,tokenize:_n};function _n(e,t,n){return r;function r(t){return j(t)?M(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||A(e)?t(e):n(e)}}var vn={continuation:{tokenize:bn},exit:xn,name:`blockQuote`,tokenize:yn};function yn(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return j(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function bn(e,t,n){let r=this;return i;function i(t){return j(t)?M(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(vn,t,n)(r)}}function xn(e){e.exit(`blockQuote`)}var Sn={name:`characterEscape`,tokenize:Cn};function Cn(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Yt(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var wn={name:`characterReference`,tokenize:Tn};function Tn(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Wt,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Jt,u):(e.enter(`characterReferenceValue`),a=7,o=qt,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Wt&&!Pt(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var En={partial:!0,tokenize:kn},Dn={concrete:!0,name:`codeFenced`,tokenize:On};function On(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),j(t)?M(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||A(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(En,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||A(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):j(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),M(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||A(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||A(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&j(t)?M(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||A(t)?e.check(En,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||A(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),j(t)?M(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),j(t)?M(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||A(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function kn(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var An={name:`codeIndented`,tokenize:Mn},jn={partial:!0,tokenize:Nn};function Mn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),M(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):A(t)?e.attempt(jn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||A(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Nn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):M(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):A(e)?i(e):n(e)}}var Pn={name:`codeText`,previous:In,resolve:Fn,tokenize:Ln};function Fn(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 In(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Ln(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||A(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Rn=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&zn(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),zn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);zn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);zn(this.left,t.reverse())}}};function zn(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 Bn(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Rn(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`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Vn(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[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 Ft(e,0,1/0,u.slice(0)),!l}function Vn(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._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&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Hn={resolve:Wn,tokenize:Gn},Un={partial:!0,tokenize:Kn};function Wn(e){return Bn(e),e}function Gn(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):A(t)?e.check(Un,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Kn(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M(e,a,`linePrefix`)}function a(i){if(i===null||A(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function qn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Kt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||A(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Xt(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Kt(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Jn(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):A(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||A(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!j(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Yn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||A(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Xn(e,t){let n;return r;function r(i){return A(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):j(i)?M(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Zn={name:`definition`,tokenize:$n},Qn={partial:!0,tokenize:er};function $n(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Jn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ht(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Xt(t)?Xn(e,l)(t):l(t)}function l(t){return qn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Qn,d,d)(t)}function d(t){return j(t)?M(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||A(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function er(e,t,n){return r;function r(t){return Xt(t)?Xn(e,i)(t):n(t)}function i(t){return Yn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return j(t)?M(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||A(e)?t(e):n(e)}}var tr={name:`hardBreakEscape`,tokenize:nr};function nr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return A(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var rr={name:`headingAtx`,resolve:ir,tokenize:ar};function ir(e,t){let n=e.length-2,r=3,i,a;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},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Ft(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function ar(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Xt(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||A(n)?(e.exit(`atxHeading`),t(n)):j(n)?M(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Xt(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var or=`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`.split(`.`),sr=[`pre`,`script`,`style`,`textarea`],cr={concrete:!0,name:`htmlFlow`,resolveTo:dr,tokenize:fr},lr={partial:!0,tokenize:mr},ur={partial:!0,tokenize:pr};function dr(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 fr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):Ut(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Ut(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return Ut(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Xt(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&sr.includes(l)?(i=1,r.interrupt?t(s):D(s)):or.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Wt(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return j(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ut(t)?(e.consume(t),b):j(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Wt(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):j(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):j(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||A(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Xt(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||j(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||A(t)?D(t):j(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):A(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(lr,O,te)(t)):t===null||A(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(ur,ne,O)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||A(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return sr.includes(n)?(e.consume(t),le):D(t)}return Ut(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||A(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),le)}function O(n){return e.exit(`htmlFlow`),t(n)}}function pr(e,t,n){let r=this;return i;function i(t){return A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function mr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(gn,t,n)}}var hr={name:`htmlText`,tokenize:gr};function gr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Ut(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Ut(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):A(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):A(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):A(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):A(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return Ut(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Wt(t)?(e.consume(t),S):C(t)}function C(t){return A(t)?(o=C,ae(t)):j(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||Wt(t)?(e.consume(t),w):t===47||t===62||Xt(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||Ut(t)?(e.consume(t),E):A(t)?(o=T,ae(t)):j(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||Wt(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):A(t)?(o=ee,ae(t)):j(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):A(t)?(o=D,ae(t)):j(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):A(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Xt(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||Xt(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return j(t)?M(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var _r={name:`labelEnd`,resolveAll:xr,resolveTo:Sr,tokenize:Cr},vr={tokenize:wr},yr={tokenize:Tr},br={tokenize:Er};function xr(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ft(e,0,e.length,n),e}function Sr(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=It(s,e.slice(a+1,a+r+3)),s=It(s,[[`enter`,u,t]]),s=It(s,ln(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=It(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=It(s,e.slice(o+1)),s=It(s,[[`exit`,c,t]]),Ft(e,a,e.length,s),e}function Cr(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Ht(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(vr,u,o?u:d)(t):t===91?e.attempt(yr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(br,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function wr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Xt(t)?Xn(e,a)(t):a(t)}function a(t){return t===41?u(t):qn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Xt(t)?Xn(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Yn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Xt(t)?Xn(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Tr(e,t,n){let r=this;return i;function i(t){return Jn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ht(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Er(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Dr={name:`labelStartImage`,resolveAll:_r.resolveAll,tokenize:Or};function Or(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var kr={name:`labelStartLink`,resolveAll:_r.resolveAll,tokenize:Ar};function Ar(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var jr={name:`lineEnding`,tokenize:Mr};function Mr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),M(e,t,`linePrefix`)}}var Nr={name:`thematicBreak`,tokenize:Pr};function Pr(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||A(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),j(t)?M(e,s,`whitespace`)(t):s(t))}}var Fr={continuation:{tokenize:zr},exit:Vr,name:`list`,tokenize:Rr},Ir={partial:!0,tokenize:Hr},Lr={partial:!0,tokenize:Br};function Rr(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:qt(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Nr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return qt(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(gn,r.interrupt?n:u,e.attempt(Ir,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return j(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function zr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(gn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,M(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!j(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Lr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,M(e,e.attempt(Fr,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Br(e,t,n){let r=this;return M(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Vr(e){e.exit(this.containerState.type)}function Hr(e,t,n){let r=this;return M(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!j(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ur={name:`setextUnderline`,resolveTo:Wr,tokenize:Gr};function Wr(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Gr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),j(t)?M(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||A(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Kr={tokenize:qr};function qr(e){let t=this,n=e.attempt(gn,r,e.attempt(this.parser.constructs.flowInitial,i,M(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Hn,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Jr={resolveAll:Qr()},Yr=Zr(`string`),Xr=Zr(`text`);function Zr(e){return{resolveAll:Qr(e===`text`?$r:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Qr(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function $r(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var ei=e({attentionMarkers:()=>ci,contentInitial:()=>ni,disable:()=>li,document:()=>ti,flow:()=>ii,flowInitial:()=>ri,insideSpan:()=>si,string:()=>ai,text:()=>oi}),ti={42:Fr,43:Fr,45:Fr,48:Fr,49:Fr,50:Fr,51:Fr,52:Fr,53:Fr,54:Fr,55:Fr,56:Fr,57:Fr,62:vn},ni={91:Zn},ri={[-2]:An,[-1]:An,32:An},ii={35:rr,42:Nr,45:[Ur,Nr],60:cr,61:Ur,95:Nr,96:Dn,126:Dn},ai={38:wn,92:Sn},oi={[-5]:jr,[-4]:jr,[-3]:jr,33:Dr,38:wn,42:un,60:[mn,hr],91:kr,92:[tr,Sn],93:_r,95:un,96:Pn},si={null:[un,Jr]},ci={null:[42,95]},li={null:[]};function ui(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=It(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=ln(a,l.events,l),l.events):[]}function f(e,t){return fi(p(e),t)}function p(e){return di(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){A(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ft(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function di(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function fi(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
4
4
|
`;break;case-3:o=`\r
|
|
5
5
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function pi(e){let t={constructs:Rt([ei,...(e||{}).extensions||[]]),content:n(tn),defined:[],document:n(rn),flow:n(Kr),lazy:{},string:n(Yr),text:n(Xr)};return t;function n(e){return n;function n(n){return ui(t,e,n)}}}function mi(e){for(;!Bn(e););return e}var hi=/[\0\t\n\r]/g;function gi(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(hi.lastIndex=u,c=hi.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var _i=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vi(e){return e.replace(_i,yi)}function yi(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Vt(n.slice(t?2:1),t?16:10)}return Pt(n)||e}var bi={}.hasOwnProperty;function xi(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Si(n)(mi(pi(n).document().write(gi()(e,t,!0))))}function Si(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Te),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(xe),blockQuote:a(ge),characterEscape:T,characterReference:T,codeFenced:a(_e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(_e,o),codeText:a(ve,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(be),hardBreakEscape:a(Se),hardBreakTrailing:a(Se),htmlFlow:a(Ce,o),htmlFlowData:T,htmlText:a(Ce,o),htmlTextData:T,image:a(we),label:o,link:a(Te),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:ue,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(xe),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:he,autolinkProtocol:me,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:k,characterReferenceMarkerNumeric:k,characterReferenceValue:fe,characterReference:pe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:de,resourceDestinationString:ce,resourceTitleString:le,resource:O,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};wi(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];bi.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Ei).call(a,void 0,e[0])}for(r.position={start:Ci(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ci(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Ci(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Ei).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+qe({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Ci(e.end)}function u(){return kt(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ht(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:Ci(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Ci(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Ci(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=vi(t),n.identifier=Ht(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function O(){this.data.inReference=void 0}function ue(){this.data.referenceType=`collapsed`}function de(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ht(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function k(e){this.data.characterReferenceType=e.type}function fe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Vt(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Pt(t);let i=this.stack[this.stack.length-1];i.value+=r}function pe(e){let t=this.stack.pop();t.position.end=Ci(e.end)}function me(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ge(){return{type:`blockquote`,children:[]}}function _e(){return{type:`code`,lang:null,meta:null,value:``}}function ve(){return{type:`inlineCode`,value:``}}function ye(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function be(){return{type:`emphasis`,children:[]}}function xe(){return{type:`heading`,depth:0,children:[]}}function Se(){return{type:`break`}}function Ce(){return{type:`html`,value:``}}function we(){return{type:`image`,title:null,url:``,alt:null}}function Te(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function Ci(e){return{line:e.line,column:e.column,offset:e.offset}}function wi(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?wi(e,r):Ti(e,r)}}function Ti(e,t){let n;for(n in t)if(bi.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Ei(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+qe({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qe({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+qe({start:t.start,end:t.end})+`) is still open`)}function Di(e){let t=this;t.parser=n;function n(n){return xi(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Oi(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function ki(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{i as t,t as n}from"./jsx-runtime-BthL93pI.js";import{c as r,s as i}from"./editor.api2-B9h6iFPK.js";import{r as a}from"./monaco.contribution-BXz-lfFB.js";import{A as o,C as s,E as c,N as l,O as u,T as d,b as f,g as p,l as m,m as h,n as g,o as _,pt as v,r as y,s as b,u as x,v as S}from"./file-icons-CHWt5nSy.js";import{v as C}from"./IconGlyphs-C2WFcoJS.js";import{d as w,t as T}from"./FileEditorMarkdownPreview-KbnE8VC8.js";import{i as E,l as D,n as O,p as k,r as A,t as j,u as M}from"./workspace-working-copy-D8-s_Sgh.js";import{A as ee,C as N,D as P,E as F,M as I,N as L,O as te,_ as R,a as ne,b as re,d as z,f as ie,g as ae,h as oe,j as se,k as ce,m as le,n as ue,o as de,p as B,r as fe,t as V,u as pe,v as me,w as H,y as he}from"./workspace-editor-model-D0Im34S5.js";import{t as ge}from"./useWorkspaceMenuKeyboard-Brws6Ar9.js";import{a as _e,c as ve,d as ye,f as be,h as xe,l as U,m as W,n as Se,r as Ce,s as G,t as K,u as q}from"./workspace-editor-monaco-BIpqcWf1.js";var J=e(t()),Y=n();function we({previewOpen:e}){return e?(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M9 3.5V11.5C9 11.776 8.776 12 8.5 12C8.224 12 8 11.776 8 11.5V4.831L5.376 7.83C5.187 8.048 4.814 8.048 4.624 7.83L2 4.831V11.5C2 11.776 1.776 12 1.5 12C1.224 12 1 11.776 1 11.5V3.5C1 3.292 1.129 3.105 1.324 3.032C1.521 2.96 1.74 3.014 1.876 3.171L5 6.741L8.124 3.171C8.261 3.014 8.478 2.959 8.676 3.032C8.871 3.105 9 3.292 9 3.5ZM14.854 9.146C14.659 8.951 14.342 8.951 14.147 9.146L13.001 10.292V3.5C13.001 3.224 12.777 3 12.501 3C12.225 3 12.001 3.224 12.001 3.5V10.293L10.855 9.147C10.66 8.952 10.343 8.952 10.148 9.147C9.953 9.342 9.953 9.659 10.148 9.854L12.148 11.854C12.246 11.952 12.757 11.952 12.855 11.854L14.855 9.854C15.05 9.659 15.05 9.342 14.855 9.147L14.854 9.146Z`})}):(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M12.5 1H3.5C2.122 1 1 2.122 1 3.5V12.5C1 13.878 2.122 15 3.5 15H12.5C13.878 15 15 13.878 15 12.5V3.5C15 2.122 13.878 1 12.5 1ZM14 12.5C14 13.327 13.327 14 12.5 14H3.5C2.673 14 2 13.327 2 12.5V3.5C2 2.673 2.673 2 3.5 2H12.5C13.327 2 14 2.673 14 3.5V12.5ZM12 3H4C3.448 3 3 3.448 3 4V6C3 6.552 3.448 7 4 7H12C12.552 7 13 6.552 13 6V4C13 3.448 12.552 3 12 3ZM12 6H4V4H12V6ZM12 8H9C8.448 8 8 8.448 8 9V12C8 12.552 8.448 13 9 13H12C12.552 13 13 12.552 13 12V9C13 8.448 12.552 8 12 8ZM12 12H9V9H12V12ZM7 8.5C7 8.776 6.776 9 6.5 9H3.5C3.224 9 3 8.776 3 8.5C3 8.224 3.224 8 3.5 8H6.5C6.776 8 7 8.224 7 8.5ZM7 10.5C7 10.776 6.776 11 6.5 11H3.5C3.224 11 3 10.776 3 10.5C3 10.224 3.224 10 3.5 10H6.5C6.776 10 7 10.224 7 10.5ZM7 12.5C7 12.776 6.776 13 6.5 13H3.5C3.224 13 3 12.776 3 12.5C3 12.224 3.224 12 3.5 12H6.5C6.776 12 7 12.224 7 12.5Z`})})}function Te(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M5.5 2H2.5C1.673 2 1 2.673 1 3.5V12.5C1 13.327 1.673 14 2.5 14H5.5C6.327 14 7 13.327 7 12.5V3.5C7 2.673 6.327 2 5.5 2ZM2.5 3H5.5C5.775 3 6 3.224 6 3.5V5H2V3.5C2 3.224 2.225 3 2.5 3ZM5.5 13H2.5C2.225 13 2 12.776 2 12.5V6H6V12.5C6 12.776 5.775 13 5.5 13ZM13.5 2H10.5C9.673 2 9 2.673 9 3.5V12.5C9 13.327 9.673 14 10.5 14H13.5C14.327 14 15 13.327 15 12.5V3.5C15 2.673 14.327 2 13.5 2ZM10.5 3H13.5C13.775 3 14 3.224 14 3.5V8H10V3.5C10 3.224 10.225 3 10.5 3ZM13.5 13H10.5C10.225 13 10 12.776 10 12.5V10H14V12.5C14 12.776 13.775 13 13.5 13Z`})})}function X(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M2.5 2C1.673 2 1 2.673 1 3.5V12.5C1 13.327 1.673 14 2.5 14H13.5C14.327 14 15 13.327 15 12.5V3.5C15 2.673 14.327 2 13.5 2H2.5ZM2 3.5C2 3.224 2.225 3 2.5 3H7.5V13H2.5C2.225 13 2 12.776 2 12.5V3.5ZM8.5 13V3H13.5C13.775 3 14 3.224 14 3.5V12.5C14 12.776 13.775 13 13.5 13H8.5ZM3.5 5H6V6H3.5V5ZM3.5 7H6V8H3.5V7ZM10 5H12.5V6H10V5ZM10 7H12.5V8H10V7ZM10 9H12.5V10H10V9Z`})})}function Ee(){return(0,Y.jsxs)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:[(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5 6.5V3.75C5 2.765 4.121 2.25 3.251 2.25C2.363 2.25 1.99 2.553 1.897 2.646C1.702 2.841 1.688 3.17 1.883 3.365C2.077 3.561 2.38 3.573 2.576 3.378C2.588 3.37 2.773 3.25 3.25 3.25C3.28 3.25 4 3.256 4 3.75V4.056C3.796 4.023 3.552 4 3.25 4C1.937 4 1.25 4.754 1.25 5.5C1.25 6.246 1.937 7 3.25 7C3.622 7 3.911 6.937 4.145 6.851C4.236 6.943 4.361 7 4.5 7C4.776 7 5 6.776 5 6.5ZM3.251 5C3.623 5 3.857 5.038 4.001 5.074V5.811C3.908 5.885 3.698 6 3.251 6C2.602 6 2.251 5.742 2.251 5.5C2.251 5.258 2.602 5 3.251 5Z`}),(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.001 7C9.104 7 10.001 5.991 10.001 4.75C10.001 3.509 9.104 2.5 8.001 2.5C7.635 2.5 7.296 2.619 7.001 2.813V1.5C7.001 1.224 6.777 1 6.501 1C6.225 1 6.001 1.224 6.001 1.5V6.5C6.001 6.776 6.225 7 6.501 7C6.718 7 6.898 6.86 6.967 6.666C7.27 6.873 7.621 7 8.001 7ZM8.001 3.5C8.553 3.5 9.001 4.061 9.001 4.75C9.001 5.439 8.553 6 8.001 6C7.449 6 7.001 5.439 7.001 4.75C7.001 4.061 7.449 3.5 8.001 3.5Z`}),(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.539 13.653C4.31 13.857 3.699 13.976 3.33 13.514C3.117 13.248 3 12.888 3 12.5C3 12.112 3.118 11.752 3.33 11.486C3.701 11.022 4.311 11.141 4.54 11.347C4.744 11.533 5.06 11.515 5.246 11.311C5.431 11.106 5.415 10.79 5.209 10.605C4.422 9.895 3.233 10.009 2.549 10.861C2.195 11.305 2 11.886 2 12.5C2 13.114 2.195 13.696 2.549 14.139C2.93 14.613 3.445 14.875 4 14.875C4.441 14.875 4.859 14.709 5.208 14.395C5.413 14.21 5.43 13.894 5.245 13.689C5.059 13.484 4.743 13.466 4.539 13.653Z`}),(0,Y.jsx)(`path`,{d:`M12.5 4H11.5C11.224 4 11 4.224 11 4.5C11 4.776 11.224 5 11.5 5H12.5C12.775 5 13 5.224 13 5.5V11.499C13 11.775 12.775 11.999 12.5 11.999H8.707L9.853 10.853C10.048 10.658 10.048 10.341 9.853 10.146C9.658 9.951 9.341 9.951 9.146 10.146L7.146 12.146C7.049 12.244 7 12.372 7 12.5C7 12.628 7.048 12.756 7.146 12.854L9.146 14.854C9.341 15.049 9.658 15.049 9.853 14.854C10.048 14.659 10.048 14.342 9.853 14.147L8.707 13.001H12.5C13.327 13.001 14 12.328 14 11.501V5.5C14 4.673 13.327 4 12.5 4Z`})]})}function De(e,t,n){return e.showMarkdownPreview?n?t.showMarkdownSource:t.openMarkdownPreview:n?t.showFileSource:t.openFilePreview}function Oe({actions:e,copy:t,diffOpen:n,markdownSplitOpen:r,openFile:i,sourcePreviewOpen:a,wordWrapEnabled:o,statusText:s,onReload:c,onSave:l,onToggleMarkdownSplit:u,onToggleSourcePreview:d,onToggleWordWrap:f,onToggleDiff:p}){let m=e.showMarkdownPreview||e.showSourcePreview,h=De(e,t,a),g=r?t.closeMarkdownSplitPreview:t.openMarkdownSplitPreview;return(0,Y.jsxs)(`div`,{className:`code-file-editor-actions`,children:[e.showStatus&&s&&(0,Y.jsx)(`span`,{className:`code-file-editor-status ${i.externalChanged?`warning`:``}`,children:s}),e.showSave&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action save`,onClick:()=>l(!1),disabled:i.saving,"aria-label":t.saveFile,title:t.saveFile}),e.showDiff&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action diff ${n?`active`:``}`,onClick:p,disabled:i.saving,"aria-label":n?t.closeDiff:t.openFileDiff,title:n?t.closeDiff:t.openFileDiff,children:(0,Y.jsx)(Te,{})}),m&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action source-preview`,onClick:d,disabled:i.saving,"aria-label":h,title:h,children:(0,Y.jsx)(we,{previewOpen:a})}),e.showMarkdownPreview&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action markdown-split ${r?`active`:``}`,onClick:u,disabled:i.saving,"aria-label":g,title:g,children:(0,Y.jsx)(X,{})}),e.showWordWrap&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action word-wrap ${o?`active`:``}`,onClick:f,disabled:i.saving,"aria-pressed":o,"aria-label":o?t.disableWordWrap:t.enableWordWrap,title:o?t.disableWordWrap:t.enableWordWrap,children:(0,Y.jsx)(Ee,{})}),e.showReload&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action reload`,onClick:c,disabled:i.saving,"aria-label":t.reloadFile,title:t.reloadFile}),e.showOverwrite&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action overwrite`,onClick:()=>l(!0),disabled:i.saving,"aria-label":t.overwriteChangedFile,title:t.overwriteChangedFile,children:(0,Y.jsx)(C,{className:`code-file-editor-action-svg`})})]})}function ke({openFile:e,copy:t,onRevealInExplorer:n}){let r=(0,J.useMemo)(()=>F(e.file.path),[e.file.path]),i=L(e.workspaceRoot),a=e.workspaceRoot?`${e.workspaceRoot.replace(/[\\/]+$/,``)}/${e.file.path}`:e.file.path;return r.length===0?(0,Y.jsx)(`span`,{"aria-hidden":`true`}):(0,Y.jsxs)(`nav`,{className:`code-file-editor-breadcrumbs`,title:a,"aria-label":t.filePath,children:[i&&(0,Y.jsxs)(`button`,{type:`button`,className:`code-file-editor-breadcrumb root`,onClick:()=>n(e.agentId,``,`directory`),"aria-label":t.revealInExplorer(i),children:[(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-name`,children:i}),(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-separator`,"aria-hidden":`true`})]}),r.map((r,i,a)=>{let o=i===a.length-1,s=P(a,i);return(0,Y.jsxs)(`button`,{type:`button`,className:`code-file-editor-breadcrumb ${o?`current`:``}`,onClick:()=>n(e.agentId,s,o?`file`:`directory`),"aria-label":t.revealInExplorer(s),children:[o&&(0,Y.jsx)(`img`,{className:`code-file-editor-breadcrumb-file-icon`,src:g(e.file.path),alt:``,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-name`,children:r}),!o&&(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-separator`,"aria-hidden":`true`})]},`${i}-${r}`)})]})}function Z(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13.5 8.00023H3.70701L7.85301 3.85423C8.04801 3.65923 8.04801 3.34223 7.85301 3.14723C7.65801 2.95223 7.34101 2.95223 7.14601 3.14723L2.14601 8.14723C1.95101 8.34223 1.95101 8.65923 2.14601 8.85423L7.14601 13.8542C7.24401 13.9522 7.37201 14.0002 7.50001 14.0002C7.62801 14.0002 7.75601 13.9512 7.85401 13.8542C8.04901 13.6592 8.04901 13.3422 7.85401 13.1472L3.70801 9.00123H13.501C13.777 9.00123 14.001 8.77723 14.001 8.50123C14.001 8.22523 13.777 8.00123 13.501 8.00123L13.5 8.00023Z`})})}function Ae(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13.854 8.14576L8.854 3.14576C8.659 2.95076 8.342 2.95076 8.147 3.14576C7.952 3.34076 7.952 3.65776 8.147 3.85276L12.293 7.99876H2.5C2.224 7.99876 2 8.22276 2 8.49876C2 8.77476 2.224 8.99876 2.5 8.99876H12.293L8.147 13.1448C7.952 13.3398 7.952 13.6568 8.147 13.8518C8.245 13.9498 8.373 13.9978 8.501 13.9978C8.629 13.9978 8.757 13.9488 8.855 13.8518L13.855 8.85176C14.05 8.65676 14.05 8.33976 13.855 8.14476L13.854 8.14576Z`})})}function je(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13 13.5C13 13.776 12.776 14 12.5 14C9.46198 14 6.99998 11.538 6.99998 8.50001V3.70701L4.35398 6.35301C4.15898 6.54801 3.84198 6.54801 3.64698 6.35301C3.45198 6.15801 3.45198 5.84101 3.64698 5.64601L7.14698 2.14601C7.34198 1.95101 7.65898 1.95101 7.85398 2.14601L11.354 5.64601C11.549 5.84101 11.549 6.15801 11.354 6.35301C11.159 6.54801 10.842 6.54801 10.647 6.35301L8.00098 3.70701V8.50001C8.00098 10.985 10.016 13 12.501 13C12.777 13 13.001 13.224 13.001 13.5H13Z`})})}function Me({openFile:e,openFiles:t,copy:n,onBackToAgent:r,onSelectOpenFile:i,canNavigateBack:a,canNavigateForward:o,onNavigateHistory:s,onSetTabRef:c,onOpenTabContextMenu:l,onTabAuxClick:u,onTabKeyDown:d,onCloseTab:f,actions:p}){return(0,Y.jsxs)(`div`,{className:`code-file-editor-tab-strip`,children:[(0,Y.jsxs)(`div`,{className:`code-file-editor-navigation`,children:[e.sourceAgentId&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-agent-return`,onClick:()=>r(e.sourceAgentId),"aria-label":n.backToAgent,title:n.backToAgent,"data-testid":`code-file-editor-back`,children:(0,Y.jsx)(je,{})}),(0,Y.jsx)(`span`,{className:`code-file-editor-navigation-divider`,"aria-hidden":`true`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-history-back`,onClick:()=>{s(-1)},disabled:!a,"aria-label":n.goBack,title:n.goBack,"data-testid":`code-file-editor-history-back`,children:(0,Y.jsx)(Z,{})}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-history-forward`,onClick:()=>{s(1)},disabled:!o,"aria-label":n.goForward,title:n.goForward,"data-testid":`code-file-editor-history-forward`,children:(0,Y.jsx)(Ae,{})})]}),(0,Y.jsx)(`div`,{className:`code-file-editor-tabs`,role:`tablist`,children:t.map((t,r)=>{let a=H(t),o=a===H(e),s=k(t),p=M(t);return(0,Y.jsxs)(`div`,{id:ee(t),ref:e=>c(a,e),className:`code-file-editor-tab ${o?`active`:``} ${s}`.trim(),title:t.file.path,role:`tab`,"aria-selected":o,"aria-controls":`code-file-editor-panel`,"aria-label":se(t),tabIndex:o?0:-1,onClick:()=>i(t.agentId,t.file.path),onContextMenu:e=>l(e,r),onAuxClick:e=>u(e,r),onKeyDown:e=>d(e,r),children:[(0,Y.jsx)(`img`,{className:`code-file-type-icon file`,src:g(t.file.path),alt:``,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`code-file-editor-tab-name`,children:B(t.file.path)}),(0,Y.jsxs)(`span`,{className:`code-file-editor-tab-tail`,children:[p&&(0,Y.jsx)(`span`,{className:`code-file-editor-dirty`,title:p===`external`?n.changedOnDisk:n.unsavedChanges}),(0,Y.jsx)(`button`,{type:`button`,tabIndex:-1,className:`code-file-editor-close`,onClick:e=>{e.stopPropagation(),f(r)},"aria-label":n.closeFile(t.file.path)})]})]},a)})}),p]})}function Ne({openFile:e,openFiles:t,editorMode:n,copy:r,statusText:i,onBackToAgent:a,onSelectOpenFile:o,canNavigateBack:s,canNavigateForward:c,onNavigateHistory:l,onSetTabRef:u,onOpenTabContextMenu:d,onTabAuxClick:f,onTabKeyDown:p,onCloseTab:m,onRevealInExplorer:h,onSave:g,onReload:_,onToggleSourcePreview:v,onToggleMarkdownSplit:y,onToggleWordWrap:b,onToggleDiff:x,canPreviewMarkdown:S,canPreviewSource:C,diffOpen:w,markdownPreviewVisible:T,markdownSplitOpen:E,sourcePreviewOpen:D,wordWrapEnabled:O}){let k=!!e.file.path&&!T;return(0,Y.jsxs)(`header`,{className:`code-file-editor-header`,children:[(0,Y.jsx)(Me,{openFile:e,openFiles:t,copy:r,onBackToAgent:a,onSelectOpenFile:o,canNavigateBack:s,canNavigateForward:c,onNavigateHistory:l,onSetTabRef:u,onOpenTabContextMenu:d,onTabAuxClick:f,onTabKeyDown:p,onCloseTab:m,actions:(0,Y.jsx)(Oe,{actions:ie(e,n,{canPreviewMarkdown:S,canPreviewSource:C,statusText:i,showBreadcrumbs:k}),copy:r,diffOpen:w,openFile:e,markdownSplitOpen:E,sourcePreviewOpen:D,wordWrapEnabled:O,statusText:i,onReload:_,onSave:g,onToggleMarkdownSplit:y,onToggleSourcePreview:v,onToggleWordWrap:b,onToggleDiff:x})}),k&&(0,Y.jsx)(`div`,{className:`code-file-editor-bar`,children:(0,Y.jsx)(ke,{openFile:e,copy:r,onRevealInExplorer:h})})]})}function Q({blame:e,loading:t,error:n,copy:r}){return!t&&!n&&(!e||e.isGitRepo&&e.lines.length>0)?null:(0,Y.jsx)(`div`,{className:`code-file-blame-toast ${n?`error`:``}`,"data-testid":`code-file-blame-state`,children:t?r.loadingBlame:n||(e&&!e.isGitRepo?r.notGitRepository:r.noCommittedLines)})}function Pe({x:e,y:t,copy:n,blameOpen:r,readOnly:i,showBlameContextAction:a,showLineChangesContextActions:o,onClose:s,onRunAction:c}){let l=(0,J.useRef)(null),u=ge({menuOpen:!0,menuRef:l,onClose:s});return(0,Y.jsxs)(`div`,{ref:l,className:`code-editor-context-menu`,"data-testid":`code-editor-context-menu`,role:`menu`,style:{left:e,top:t},onKeyDown:u,onMouseDown:e=>e.stopPropagation(),children:[a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`toggle-blame`),children:r?n.hideBlame:n.annotateWithBlame}),(0,Y.jsx)(`div`,{className:`code-editor-context-separator`,role:`separator`})]}),o&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`line-changes-previous`),children:n.openLineChangesWithPreviousRevision}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`line-changes-working`),children:n.openLineChangesWithWorkingFile}),(0,Y.jsx)(`div`,{className:`code-editor-context-separator`,role:`separator`})]}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`cut`),disabled:i,children:n.cut}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`copy`),children:n.copy}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`paste`),disabled:i,children:n.paste}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`select-all`),children:n.selectAll})]})}function Fe({label:e,saving:t,copy:n,onConfirmSave:r,onDiscard:i,onCancel:a}){return(0,Y.jsx)(`div`,{className:`code-file-save-confirm-backdrop`,"data-testid":`code-file-save-confirm`,role:`presentation`,onMouseDown:e=>e.stopPropagation(),children:(0,Y.jsxs)(`div`,{className:`code-file-save-confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`code-file-save-confirm-title`,"aria-describedby":`code-file-save-confirm-description`,onKeyDown:e=>{e.key===`Escape`&&!t&&(e.preventDefault(),a())},children:[(0,Y.jsx)(`div`,{className:`code-file-save-confirm-brand`,"aria-hidden":`true`,children:`F`}),(0,Y.jsx)(`h2`,{id:`code-file-save-confirm-title`,children:n.saveBeforeCloseTitle(e)}),(0,Y.jsx)(`p`,{id:`code-file-save-confirm-description`,children:n.saveBeforeCloseDescription}),(0,Y.jsxs)(`div`,{className:`code-file-save-confirm-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`primary`,onClick:r,disabled:t,children:t?n.savingFile:n.save}),(0,Y.jsx)(`button`,{type:`button`,onClick:i,disabled:t,children:n.dontSave}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,disabled:t,children:n.cancel})]})]})})}function Ie({menu:e,openFiles:t,copy:n,onRunAction:r}){return(0,Y.jsxs)(`div`,{className:`code-context-menu code-file-tab-context-menu`,"data-testid":`code-file-tab-context-menu`,role:`menu`,style:{left:e.x,top:e.y},children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close`),children:n.close}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-others`),disabled:t.length<=1,children:n.closeOthers}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-right`),disabled:e.index>=t.length-1,children:n.closeToRight}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-saved`),disabled:!j(t),children:n.closeSaved}),(0,Y.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-all`),children:n.closeAll})]})}function Le({blame:e,blameError:t,blameLoading:n,blameOpen:r,copy:i,editorContextMenu:a,readOnly:o,openFiles:s,pendingCloseOpen:c,pendingCloseLabel:l,pendingCloseSaving:u,showBlameContextAction:d,showLineChangesContextActions:f,tabContextMenu:p,onCancelPendingClose:m,onCloseEditorContextMenu:h,onConfirmSaveAndClose:g,onDiscardAndClose:_,onRunEditorContextAction:v,onRunTabContextAction:y}){return(0,Y.jsxs)(Y.Fragment,{children:[a&&(0,Y.jsx)(Pe,{x:a.x,y:a.y,copy:i,blameOpen:r,readOnly:o,showBlameContextAction:d,showLineChangesContextActions:f,onClose:h,onRunAction:e=>void v(e)}),p&&(0,Y.jsx)(Ie,{menu:p,openFiles:s,copy:i,onRunAction:y}),c&&(0,Y.jsx)(Fe,{label:l,saving:u,copy:i,onConfirmSave:()=>void g(),onDiscard:_,onCancel:m}),r&&(0,Y.jsx)(Q,{blame:e,loading:n,error:t,copy:i})]})}function Re({filePath:e,line:t,authorProfileUrl:n,copy:r,onClose:i}){return(0,Y.jsxs)(`section`,{className:`code-file-blame-detail`,"data-testid":`code-file-blame-detail`,"aria-label":r.gitBlameDetails,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-main`,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-title`,children:[(0,Y.jsx)(`strong`,{children:t.summary||t.shortCommit}),(0,Y.jsx)(`code`,{title:t.commit,children:t.shortCommit})]}),(0,Y.jsx)(`div`,{className:`code-file-blame-detail-subtitle`,children:e})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-rows`,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.author}),n?(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,children:t.author}):(0,Y.jsx)(`strong`,{children:t.author||r.unknown})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.commit}),(0,Y.jsx)(`strong`,{title:t.commit,children:t.shortCommit})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.date}),(0,Y.jsx)(`strong`,{children:ue(t.authorTime)||r.uncommitted})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.line}),(0,Y.jsx)(`strong`,{children:t.lineNumber})]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-blame-detail-close`,onClick:i,"aria-label":r.closeBlameDetails})]})}function ze(e,t){if(e.loading)return t.loadingDiff;if(e.error)return e.error;let n=e.diff;return n?n.isGitRepo?n.binary?t.binaryDiffUnavailable:n.truncated?t.diffTooLarge:n.patch.trim()?typeof n.originalContent!=`string`||typeof n.modifiedContent!=`string`?t.diffUnavailable:``:t.noFileDiff:t.notGitRepository:``}function Be(e){let t=e.diff;return!!(t&&t.isGitRepo&&!t.binary&&!t.truncated&&t.patch.trim()&&typeof t.originalContent==`string`&&typeof t.modifiedContent==`string`)}function Ve(e,t){let n=D(e.file.path,e.workspaceRoot);return i.from({scheme:`farming-diff`,path:n.startsWith(`/`)?n:`/${n}`,query:t})}function He(e,t,n,i){let a=Ve(e,t);return r.getModel(a)?.dispose(),r.createModel(n,i,a)}function Ue({openFile:e,diffState:t,copy:n,onClose:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=Be(t),u=(0,J.useMemo)(()=>ze(t,n),[n,t]);return(0,J.useEffect)(()=>{if(!l)return;let e=a.current;if(!e)return;Se(),K();let t=r.createDiffEditor(e,{theme:W(),automaticLayout:!1,renderSideBySide:!v(),originalEditable:!1,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,renderOverviewRuler:!0,enableSplitViewResizing:!v(),ignoreTrimWhitespace:!1,glyphMargin:!0,lineNumbersMinChars:4,unicodeHighlight:{ambiguousCharacters:!1,invisibleCharacters:!0,nonBasicASCII:!1}});o.current=t;let n=new ResizeObserver(()=>t.layout());n.observe(e);let i=new MutationObserver(()=>K(t));return i.observe(document.body,{attributes:!0,attributeFilter:[`data-appearance`]}),window.requestAnimationFrame(()=>t.layout()),()=>{n.disconnect(),i.disconnect(),t.dispose(),s.current?.dispose(),c.current?.dispose(),s.current=null,c.current=null,o.current=null}},[l]),(0,J.useEffect)(()=>{if(!l||!t.diff)return;let n=o.current;if(!n)return;s.current?.dispose(),c.current?.dispose();let r=ye(e.file.path,t.diff.modifiedContent),i=He(e,`original`,t.diff.originalContent??``,r),a=He(e,`modified`,t.diff.modifiedContent??``,r);s.current=i,c.current=a,n.setModel({original:i,modified:a}),window.requestAnimationFrame(()=>n.layout())},[t.diff,e,l]),(0,Y.jsxs)(`section`,{className:`code-file-diff-view`,"data-testid":`code-file-diff-view`,"aria-label":n.fileDiff,children:[(0,Y.jsxs)(`header`,{className:`code-file-diff-header`,children:[(0,Y.jsxs)(`div`,{className:`code-file-diff-title`,children:[(0,Y.jsx)(`strong`,{children:n.fileDiff}),(0,Y.jsx)(`span`,{children:e.file.path})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-diff-close`,"aria-label":n.closeDiff,onClick:i})]}),u&&(0,Y.jsx)(`div`,{className:`code-file-diff-state ${t.error?`error`:``}`,children:u}),(0,Y.jsx)(`div`,{ref:a,className:`code-file-diff-monaco ${l?``:`hidden`}`,"data-testid":`code-file-diff-monaco`})]})}function We({left:e,width:t,rows:n,copy:r,onShowDetail:i}){return n.length===0?null:(0,Y.jsx)(`div`,{className:`code-file-inline-blame-layer`,"aria-label":r.gitBlameAnnotations,children:n.map(({line:n,top:a})=>(0,Y.jsx)(`button`,{type:`button`,className:`code-file-inline-blame ${n.uncommitted?`uncommitted`:``}`,style:{left:e,top:a,width:t},title:`${n.shortCommit} ${n.author||r.unknown} ${n.summary}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i(n)},children:z(n)},`${n.lineNumber}-${n.commit}-${n.author}`))})}function Ge(e,t){return e===`previous`?t.openLineChangesWithPreviousRevision:t.openLineChangesWithWorkingFile}function Ke({mode:e,lineNumber:t,loading:n,error:r,changes:i,copy:a,onClose:o}){let s=i?.commit?`${i.commit.shortHash} ${i.commit.summary||``}`.trim():``,c=n?a.loadingLineChanges:r||(i&&!i.available?a.noLineChanges:``),l=i?.patch?i.patch.split(`
|
|
2
|
-
`):[];return(0,Y.jsxs)(`div`,{className:`code-file-line-changes-panel`,"data-testid":`code-file-line-changes-panel`,children:[(0,Y.jsxs)(`div`,{className:`code-file-line-changes-main`,children:[(0,Y.jsxs)(`div`,{className:`code-file-line-changes-title`,children:[(0,Y.jsx)(`strong`,{children:Ge(e,a)}),(0,Y.jsxs)(`code`,{children:[a.line,` `,t]})]}),s&&(0,Y.jsx)(`div`,{className:`code-file-line-changes-subtitle`,children:s}),c&&(0,Y.jsx)(`div`,{className:`code-file-line-changes-state ${r?`error`:``}`,children:c}),!n&&!r&&i?.available&&(0,Y.jsx)(`pre`,{className:`code-file-line-changes-patch`,"aria-label":a.lineChanges,children:l.map((e,t)=>(0,Y.jsx)(`span`,{className:`code-file-line-changes-line ${re(e)}`,children:e||` `},`${t}-${e}`))})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-line-changes-close`,"aria-label":a.closeLineChanges,onClick:o})]})}function qe({openFile:e,activeTabDomId:t,copy:n,sourcePreviewOpen:r}){let i=e.file.preview??null,a=r&&de(e.file.path)?{kind:`image`,mediaType:`image/svg+xml`}:null,o=i?.kind===`image`?i:a,s=i?.kind===`pdf`?i:null,c=i?.kind===`binary`?i:null;return o?(0,Y.jsx)(`section`,{className:`code-file-preview-panel`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,tabIndex:-1,children:(0,Y.jsx)(`div`,{className:`code-file-image-preview-frame`,children:(0,Y.jsx)(`img`,{className:`code-file-image-preview`,"data-testid":`code-file-image-preview`,src:p(e.agentId,e.file.path,e.file.sha1),alt:B(e.file.path),draggable:!1})})}):s?(0,Y.jsx)(`section`,{className:`code-file-preview-panel`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,tabIndex:-1,children:(0,Y.jsx)(`iframe`,{className:`code-file-pdf-preview`,"data-testid":`code-file-pdf-preview`,src:p(e.agentId,e.file.path,e.file.sha1),title:n.previewFor(e.file.path)})}):c?(0,Y.jsx)(`section`,{className:`code-file-preview-panel metadata`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,"aria-label":n.previewFor(e.file.path),tabIndex:-1,children:(0,Y.jsx)(`img`,{className:`code-file-metadata-preview-icon`,"data-testid":`code-file-metadata-preview-icon`,src:g(e.file.path),alt:``,"aria-hidden":`true`,draggable:!1})}):null}function Je({activeTabDomId:e,blame:t,blameAuthorProfileUrl:n,blameDetailLine:r,blameOpen:i,blameOverlay:a,copy:o,cursorPosition:s,diffState:c,editorMode:l,editorHostRef:u,lineChanges:d,markdownSplitOpen:f,markdownPreviewOpen:p,sourcePreviewOpen:m,openFile:h,onClearBlameDetail:g,onCloseLineChanges:_,onCloseDiff:v,onOpenFilePath:y,onShowBlameDetail:b}){let x=ce({diffOnly:l.diffOnly,diffOpen:c.open,markdownSplitOpen:f,markdownPreviewOpen:p,sourcePreviewOpen:m,visualPreview:l.visualPreview}),S=(0,J.useRef)(null),C=x.showEditorOverlays||x.showMarkdownPreview;return(0,Y.jsxs)(Y.Fragment,{children:[x.showDiffView&&(0,Y.jsx)(Ue,{openFile:h,diffState:c,copy:o,onClose:v}),(0,Y.jsxs)(`div`,{className:`code-file-editor-source-region ${x.showMarkdownSplit?`markdown-split`:``} ${x.showMonaco||x.showMarkdownSplit?``:`hidden`}`.trim(),"data-testid":x.showMarkdownSplit?`code-file-markdown-split`:void 0,children:[(0,Y.jsx)(`div`,{id:`code-file-editor-panel`,ref:u,className:`code-file-monaco`,"data-testid":`code-file-monaco`,role:`tabpanel`,"aria-labelledby":e,tabIndex:-1}),x.showMarkdownSplit&&(0,Y.jsx)(T,{ref:S,activeTabDomId:e,openFile:h,onOpenFilePath:y,copy:o})]}),x.showDiffOnlyPreview&&(0,Y.jsx)(`section`,{className:`code-file-preview-panel metadata`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":e,tabIndex:-1,children:(0,Y.jsx)(`div`,{className:`code-file-diff-state`,children:o.deletedFileDiffOnly})}),x.showMarkdownPreview&&(0,Y.jsx)(T,{activeTabDomId:e,openFile:h,onOpenFilePath:y,copy:o}),x.showEditorOverlays&&i&&t?.isGitRepo&&(0,Y.jsx)(We,{left:a.left,width:a.width,rows:a.rows,copy:o,onShowDetail:b}),(0,Y.jsx)(qe,{openFile:h,activeTabDomId:e,copy:o,sourcePreviewOpen:x.showSourcePreview}),x.showEditorOverlays&&i&&r&&(0,Y.jsx)(Re,{filePath:h.file.path,line:r,authorProfileUrl:n,copy:o,onClose:g}),x.showEditorOverlays&&d&&(0,Y.jsx)(Ke,{mode:d.mode,lineNumber:d.lineNumber,loading:d.loading,error:d.error,changes:d.changes,copy:o,onClose:_}),C&&(0,Y.jsx)(`div`,{className:`code-file-editor-statusbar`,"data-testid":`code-file-editor-statusbar`,children:(0,Y.jsx)(`span`,{className:`code-file-editor-cursor-position`,children:o.cursorPosition(s.lineNumber,s.column)})})]})}function Ye(e){return e instanceof y&&fe(e.status)}function Xe({openFile:e,disabled:t,onRevealLine:n}){let r=(0,J.useRef)(0),i=(0,J.useRef)(0),a=(0,J.useRef)(H(e)),o=(0,J.useRef)(t),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(`unknown`),[v,y]=(0,J.useState)(null);a.current=H(e),o.current=t;let x=(0,J.useMemo)(()=>{let e=d?.lines??[];return{compact:V(e,!0),regular:V(e,!1)}},[d]),S=(0,J.useCallback)(()=>{y(null)},[]),C=(0,J.useCallback)(async()=>{if(t)return g(`unavailable`),null;let n=H(e),i=r.current+1;r.current=i,u(!0),m(null);try{let t=await _(e.agentId,e.file.path);return r.current!==i||a.current!==n||o.current?null:(f(t),g(t.isGitRepo&&t.lines.length>0?`available`:`unavailable`),t)}catch(e){return r.current!==i||a.current!==n||o.current?null:(f(null),m(e instanceof Error?e.message:`Failed to load blame`),g(Ye(e)?`unavailable`:`unknown`),null)}finally{r.current===i&&a.current===n&&!o.current&&u(!1)}},[t,e.agentId,e.file.path,e.file.sha1,e.workspaceRoot]),w=(0,J.useCallback)(async()=>{if(t)return g(`unavailable`),`unavailable`;let n=H(e),r=i.current+1;i.current=r;try{let t=await b(e.agentId,e.file.path);if(i.current!==r||a.current!==n)return null;let o=t.available?`available`:`unavailable`;return g(o),o}catch{return i.current!==r||a.current!==n?null:(g(`unavailable`),`unavailable`)}},[t,e]),T=(0,J.useCallback)(async()=>{if(t)return;if(s){c(!1),y(null);return}let n=H(e),r=h===`unknown`?await w():h;r!==null&&r!==`unavailable`&&a.current===n&&!o.current&&c(!0)},[h,s,w,t,e]),E=(0,J.useCallback)(e=>{n(e.lineNumber,{focusEditor:!1}),y({line:e})},[n]);return(0,J.useEffect)(()=>{f(null),u(!1),m(null),g(t?`unavailable`:`unknown`)},[t,e.agentId,e.file]),(0,J.useEffect)(()=>{t&&(c(!1),f(null),m(null),g(`unavailable`))},[t,e.agentId,e.file.path]),(0,J.useEffect)(()=>{if(!s)return;let e=!1;return C().then(t=>{e||(!t?.isGitRepo||t.lines.length===0)&&(c(!1),y(null))}),()=>{e=!0}},[s,C]),(0,J.useEffect)(()=>{y(null)},[s,e.agentId,e.file.path]),{blameOpen:s,blameLoading:l,blame:d,blameError:p,blameCapability:h,blameDetail:v,blameLabelWidths:x,checkBlameCapability:w,toggleBlame:T,showBlameDetail:E,clearBlameDetail:S}}function Ze({blame:e,blameLabelWidths:t,blameOpen:n,editorHostRef:i,editorRef:a,disabled:o}){let[s,c]=(0,J.useState)({left:0,width:112,rows:[]}),l=(0,J.useCallback)(()=>{let s=a.current,l=i.current;if(!s||!l||!n||!e?.isGitRepo||o){c({left:0,width:112,rows:[]}),s?.updateOptions({lineDecorationsWidth:10});return}let u=l.clientWidth<=520?t.compact:t.regular;s.updateOptions({lineDecorationsWidth:u+12});let d=s.getLayoutInfo(),f=l.offsetTop,p=s.getScrollTop(),m=s.getOption(r.EditorOption.lineHeight),h=l.offsetLeft+Math.max(0,d.contentLeft-u-8),g=I({visibleRanges:s.getVisibleRanges(),scrollTop:p,hostHeight:l.clientHeight,lineHeight:m});c({left:h,width:u,rows:le(e.lines,{...g,hostTop:f,scrollTop:p,hostHeight:l.clientHeight,lineHeight:m,getTopForLineNumber:e=>s.getTopForLineNumber(e)})})},[e,t,n,o,i,a]);return(0,J.useEffect)(()=>{let e=a.current;if(!e)return;l();let t=e.onDidScrollChange(l),n=e.onDidLayoutChange(l),r=window.requestAnimationFrame(l);return()=>{t.dispose(),n.dispose(),window.cancelAnimationFrame(r)}},[a,l]),{blameOverlay:s}}function Qe({blameCapability:e,blameOpen:t,canShowBlame:n,canShowLineChanges:i,editorRef:a,readOnly:o,onCheckBlameCapability:s,onClearBlameDetail:c,onCloseTabContextMenu:l,onOpenLineChanges:u,onToggleBlame:d}){let[f,p]=(0,J.useState)(null),m=(0,J.useCallback)(()=>{p(null)},[]),h=(0,J.useCallback)(e=>{let i=e.target.type,o=new Set([r.MouseTargetType.GUTTER_GLYPH_MARGIN,r.MouseTargetType.GUTTER_LINE_NUMBERS,r.MouseTargetType.GUTTER_LINE_DECORATIONS,r.MouseTargetType.GUTTER_VIEW_ZONE]),u=e.target.position?.lineNumber??a.current?.getPosition()?.lineNumber??1,d=o.has(i)?`gutter`:`editor`;e.event.preventDefault(),e.event.stopPropagation(),c(),l();let f={x:Math.max(8,Math.min(e.event.posx,window.innerWidth-220)),y:Math.max(8,Math.min(e.event.posy,window.innerHeight-230)),kind:d,lineNumber:u};if(d===`gutter`&&n&&!t){s().then(e=>{e!==null&&p(f)});return}p(f)},[t,n,a,s,c,l]),g=(0,J.useCallback)(async e=>{let t=a.current,r=f;if(m(),!t)return;let s=t.getModel(),c=t.getSelection();if(e===`toggle-blame`){if(!n)return;await d();return}if(e===`line-changes-previous`||e===`line-changes-working`){if(!i)return;let n=r?.lineNumber??t.getPosition()?.lineNumber??1;await u(e===`line-changes-previous`?`previous`:`working`,n);return}if(e===`select-all`&&s){t.setSelection(s.getFullModelRange()),t.focus();return}if(!(!s||!c)){if(e===`copy`||e===`cut`){let n=s.getValueInRange(c);n&&await navigator.clipboard?.writeText(n).catch(()=>{}),e===`cut`&&n&&!o&&t.executeEdits(`farming-context-menu`,[{range:c,text:``,forceMoveMarkers:!0}]),t.focus();return}if(e===`paste`&&!o){let e=await navigator.clipboard?.readText().catch(()=>``)??``;e&&t.executeEdits(`farming-context-menu`,[{range:c,text:e,forceMoveMarkers:!0}]),t.focus()}}},[n,i,m,f,a,u,d,o]),_=!!(f&&f.kind===`gutter`&&n&&(t||e===`available`)),v=!!(f&&f.kind===`gutter`&&i);return(0,J.useEffect)(()=>{let e=e=>{let t=e.target;t instanceof Element&&t.closest(`.code-editor-context-menu, .code-file-tab-context-menu, .code-file-blame-detail, .code-file-inline-blame, .code-file-line-changes-panel`)||(p(null),l())},t=e=>{e.key===`Escape`&&(p(null),l())};return document.addEventListener(`mousedown`,e,!0),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`mousedown`,e,!0),document.removeEventListener(`keydown`,t,!0)}},[l]),{editorContextMenu:f,closeEditorContextMenu:m,openEditorContextMenu:h,runEditorContextAction:g,showBlameContextAction:_,showLineChangesContextActions:v}}function $e({openFile:e,diffDisabled:t,onClearBlameDetail:n}){let r=(0,J.useRef)(0),i=(0,J.useRef)(void 0),a=(0,J.useRef)(H(e)),[o,s]=(0,J.useState)({open:!1,loading:!1,error:null,diff:null});a.current=H(e);let c=(0,J.useCallback)(()=>{r.current+=1,s({open:!1,loading:!1,error:null,diff:null})},[]),l=(0,J.useCallback)(async()=>{if(t)return;let i=r.current+1,o=H(e);r.current=i,n(),s({open:!0,loading:!0,error:null,diff:null});try{let t=await m(e.agentId,e.file.path);if(r.current!==i||a.current!==o)return;s({open:!0,loading:!1,error:null,diff:t})}catch(e){if(r.current!==i||a.current!==o)return;s({open:!0,loading:!1,error:e instanceof Error?e.message:`Failed to load diff`,diff:null})}},[t,n,e]),u=(0,J.useCallback)(()=>{if(o.open){c();return}l()},[c,o.open,l]);return(0,J.useEffect)(()=>{r.current+=1,s({open:!1,loading:!1,error:null,diff:null})},[t,e.agentId,e.file]),(0,J.useEffect)(()=>{!e.diffRequestId||t||i.current===e.diffRequestId||(i.current=e.diffRequestId,l())},[t,l,e.diffRequestId]),{diffState:o,closeDiff:c,toggleDiff:u}}function et({openFile:e,disabled:t,onClearBlameDetail:n,onRevealLine:r}){let i=(0,J.useRef)(0),a=(0,J.useRef)(H(e)),[o,s]=(0,J.useState)(null);a.current=H(e);let c=(0,J.useCallback)(()=>{s(null)},[]),l=(0,J.useCallback)(async(o,c)=>{if(t)return;let l=i.current+1,u=H(e);i.current=l,n(),s(he(o,c)),r(c,{focusEditor:!1});try{let t=await h(e.agentId,e.file.path,c,o);if(i.current!==l||a.current!==u)return;s(me(o,c,t))}catch(e){if(i.current!==l||a.current!==u)return;s(R(o,c,e))}},[t,n,r,e]);return(0,J.useEffect)(()=>{i.current+=1,s(null)},[t,e.agentId,e.file]),{lineChanges:o,openLineChanges:l,closeLineChanges:c}}function tt({editorRef:e,onFocusEditor:t}){(0,J.useEffect)(()=>{if(!window.__FARMING_E2E__)return;let n={focus(){return t(),!!e.current},revealLine(t){let n=e.current,r=n?.getModel();if(!n||!r)return!1;let i=Math.min(Math.max(1,t),r.getLineCount());return n.setPosition({lineNumber:i,column:1}),n.revealLineInCenter(i),n.focus(),!0},insertText(t){let n=e.current,r=n?.getSelection();return!n||!r?!1:(n.pushUndoStop(),n.executeEdits(`farming-e2e`,[{range:r,text:t,forceMoveMarkers:!0}]),n.pushUndoStop(),n.focus(),!0)},undo(){let t=e.current;return t?(t.focus(),t.trigger(`farming-e2e`,`undo`,null),!0):!1},getValue(){return e.current?.getValue()??``},getScrollTop(){return e.current?.getScrollTop()??0},getMarkers(){let t=e.current?.getModel();return t?r.getModelMarkers({resource:t.uri}).map(e=>({code:String(e.code??``),message:e.message,severity:e.severity})):[]},getTypeScriptDiagnosticsOptions(){return a.getDiagnosticsOptions()}};return window.__farmingFileEditorTest=n,()=>{window.__farmingFileEditorTest===n&&delete window.__farmingFileEditorTest}},[e,t])}function nt({openFile:e,openFiles:t,readOnly:n,wordWrapEnabled:i,editorLabel:a,onChangeDraft:o,onFocusFilesSearch:l,onRecordNavigationCursor:u,onSaveShortcut:p,onOpenContextMenuRef:m}){let h=(0,J.useRef)(null),g=(0,J.useRef)(null),_=(0,J.useRef)(new Map),v=(0,J.useRef)(null),y=(0,J.useRef)(new Map),b=(0,J.useRef)(null),x=(0,J.useRef)(null),S=(0,J.useRef)(null),C=(0,J.useRef)(null),w=(0,J.useRef)(null),T=(0,J.useRef)(o),E=(0,J.useRef)(l),D=(0,J.useRef)(u),O=(0,J.useRef)(p),k=(0,J.useRef)(e.agentId),A=(0,J.useRef)(e.file.path),j=(0,J.useRef)(e.workspaceRoot),M=(0,J.useRef)(i),ee=(0,J.useRef)(a),P=(0,J.useRef)(null),F=(0,J.useRef)(0),I=(0,J.useRef)(0),[L,te]=(0,J.useState)({lineNumber:1,column:1});T.current=o,E.current=l,D.current=u,O.current=p,k.current=e.agentId,A.current=e.file.path,j.current=e.workspaceRoot,M.current=i,ee.current=a;let R=(0,J.useCallback)(e=>{let t=e?.getPosition();t&&te(e=>e.lineNumber===t.lineNumber&&e.column===t.column?e:{lineNumber:t.lineNumber,column:t.column})},[]),ne=(0,J.useCallback)(()=>{let e=()=>{let e=g.current;e&&e.focus()};e(),window.requestAnimationFrame(e)},[]),re=(0,J.useCallback)((e,t={})=>{let n=g.current;n&&(n.setPosition({lineNumber:e,column:1}),n.revealLineInCenter(e),t.focusEditor!==!1&&n.focus())},[]),z=(0,J.useCallback)(e=>{if(!e)return;let t=e.getVisibleRanges()[0]?.startLineNumber;if(!t||t<1)return;let n=e.getPosition(),r=j.current||`agent:${k.current}`,i=A.current;c({version:1,surface:`file`,resource:{kind:`file`,workspace:r,path:i},locator:{kind:`file-line`,id:i},position:{unit:`line-column`,value:t,...n?.column?{column:n.column}:{}}})},[]);return tt({editorRef:g,onFocusEditor:ne}),(0,J.useEffect)(()=>{let t=h.current;if(!t)return;Se(),K();let n=r.create(t,q({value:e.draft,language:ye(e.file.path,e.draft),ariaLabel:ee.current,wordWrapEnabled:M.current}));K(n);let i=()=>U(n,M.current),a=xe(),o=()=>i();typeof a.addEventListener==`function`?a.addEventListener(`change`,o):a.addListener(o),i(),g.current=n,b.current=n.onDidChangeModelContent(()=>{F.current>0||T.current(n.getValue())}),x.current=n.onDidChangeCursorPosition(e=>{if(R(n),z(n),I.current>0||e.reason!==r.CursorChangeReason.Explicit||e.source===`api`)return;let t=n.getSelection();D.current?.({agentId:k.current,filePath:A.current,lineNumber:e.position.lineNumber,column:e.position.column,endColumn:t?.endColumn})}),S.current=n.onDidScrollChange(()=>{z(n)}),ve(n,{getAgentId:()=>k.current,onFocusFilesSearch:e=>E.current(e),onSaveShortcut:()=>O.current()}),C.current=n.onContextMenu(e=>m.current(e));let s=e=>{let t=_e(n,e);t&&m.current(t)};t.addEventListener(`contextmenu`,s,!0),w.current=new ResizeObserver(()=>n.layout()),w.current.observe(t);let c=new MutationObserver(()=>K(n));return c.observe(document.body,{attributes:!0,attributeFilter:[`data-appearance`]}),()=>{let e=v.current;e&&_.current.set(e,n.saveViewState()),z(n),w.current?.disconnect(),w.current=null,c.disconnect(),C.current?.dispose(),C.current=null,t.removeEventListener(`contextmenu`,s,!0),typeof a.removeEventListener==`function`?a.removeEventListener(`change`,o):a.removeListener(o),x.current?.dispose(),x.current=null,S.current?.dispose(),S.current=null,b.current?.dispose(),b.current=null,n.dispose(),Ce(),_.current.clear(),g.current=null,v.current=null}},[m,z,R]),(0,J.useEffect)(()=>{let t=g.current;if(!t)return;let n=H(e),r=N(e),i=v.current;i&&i!==n&&_.current.set(i,t.saveViewState());let a=be(e);t.getModel()!==a&&t.setModel(a);let o=y.current.get(n);if((i!==n||o!==r)&&a.getValue()!==e.draft){F.current+=1;try{a.setValue(e.draft)}finally{--F.current}}if(y.current.set(n,r),i!==n){let r=_.current.get(n);if(r)t.restoreViewState(r);else{let n=d(e.workspaceRoot||`agent:${e.agentId}`,e.file.path),r=s(n);r?.surface===`file`&&r.resource.kind===`file`&&r.position.value<=a.getLineCount()?t.revealLineInCenter(r.position.value):r&&f(n)}v.current=n}R(t)},[e,R]),(0,J.useEffect)(()=>{G([...t,e],_.current)},[e,t]),(0,J.useEffect)(()=>{let t=g.current,n=e.cursor;if(!t||!n||P.current===n.requestId)return;let r=t.getModel(),i=oe(n,{lineCount:r?.getLineCount()??1,getLineMaxColumn:e=>r?.getLineMaxColumn(e)??1});I.current+=1;try{t.setSelection(i),t.revealLineInCenter(i.startLineNumber),t.focus()}finally{window.setTimeout(()=>{I.current=Math.max(0,I.current-1)},120)}P.current=n.requestId,te({lineNumber:i.startLineNumber,column:i.startColumn})},[e.cursor,e.file.path]),(0,J.useEffect)(()=>{let e=g.current;e&&e.updateOptions({readOnly:n,domReadOnly:n})},[n]),(0,J.useEffect)(()=>{let e=g.current;e&&U(e,i)},[i]),{editorHostRef:h,editorRef:g,cursorPosition:L,focusEditor:ne,revealLine:re}}function rt({openFile:e,openFiles:t,onCloseEditorTab:n,onFocusEditorTab:r,onFocusFilesSearch:i,onSaveFile:a}){let o=(0,J.useCallback)(e=>{i(e),window.requestAnimationFrame(()=>i(e)),window.setTimeout(()=>i(e),120)},[i]);return(0,J.useCallback)(i=>{if(i.altKey||!(i.ctrlKey||i.metaKey))return;if(i.key.toLowerCase()===`p`){i.preventDefault(),i.stopPropagation(),o(e.agentId);return}if(i.key.toLowerCase()===`s`){i.preventDefault(),i.stopPropagation(),a(!1);return}let s=t.findIndex(t=>H(t)===H(e));if(s!==-1){if(i.key===`PageUp`){i.preventDefault(),i.stopPropagation(),r((s-1+t.length)%t.length);return}if(i.key===`PageDown`){i.preventDefault(),i.stopPropagation(),r((s+1)%t.length);return}i.key.toLowerCase()===`w`&&(i.preventDefault(),i.stopPropagation(),n(s))}},[n,r,a,e,t,o])}function $(e){return H(e)}function it(e){return e.filter((e,t,n)=>n.findIndex(t=>$(t)===$(e))===t)}function at(e,t,n){let r=e[n];if(!r||$(r)!==$(t))return t;let i=e.filter(e=>$(e)!==$(r));return i[Math.max(0,n-1)]??i[n]??null}function ot(e,t,n){let r=new Set(n.map($)),i=e.filter(e=>!r.has($(e)));return i.find(e=>$(e)===$(t))??i[0]??null}function st(e,t){let n=it(e),r=n.filter(E);return{closeFiles:n,dirtyFiles:r,pendingClose:r.length>0?{files:r,closeFiles:n,nextFocusFile:t}:null,nextFocusFile:t}}function ct(e){return e.nextFocusFile&&e.closeFiles.some(t=>$(t)===$(e.nextFocusFile))?null:e.nextFocusFile}function lt(e,t,n){if(e===`close`){let e=t[n];return e?[e]:[]}return e===`close-others`?t.filter((e,t)=>t!==n):e===`close-right`?t.slice(n+1):e===`close-saved`?t.filter(O):[...t]}function ut({openFile:e,openFiles:t,filesLabel:n,onSelectOpenFile:r,onCloseOpenFile:i,onCloseOpenFiles:a,onDismissEditorContextMenu:o,onSaveOpenFile:s}){let c=(0,J.useRef)(new Map),l=(0,J.useRef)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=(0,J.useCallback)(()=>{d(null)},[]),_=(0,J.useCallback)((e,t)=>{t?c.current.set(e,t):c.current.delete(e)},[]),v=(0,J.useCallback)(e=>{let n=t[e];n&&(l.current=H(n),r(n.agentId,n.file.path))},[r,t]),y=(0,J.useCallback)((e,t)=>{if(e.length===0)return;let n=e.map(e=>({agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot}));if(l.current=t?H(t):null,n.length===1){let e=n[0];e&&i(e.agentId,e.filePath,e.workspaceRoot);return}a(n)},[i,a]),b=(0,J.useCallback)((e,t)=>{let n=st(e,t),r=n.closeFiles;if(r.length!==0){if(n.pendingClose){p(n.pendingClose),h(!1);return}y(r,n.nextFocusFile)}},[y]),x=(0,J.useCallback)(n=>{let r=t[n];r&&b([r],at(t,e,n))},[e,t,b]),S=(0,J.useCallback)(n=>{b(n,ot(t,e,n))},[e,t,b]),C=(0,J.useCallback)((e,n)=>{e.preventDefault(),e.stopPropagation();let i=t[n];i&&r(i.agentId,i.file.path),o(),d({x:Math.max(8,Math.min(e.clientX,window.innerWidth-230)),y:Math.max(8,Math.min(e.clientY,window.innerHeight-190)),index:n})},[o,r,t]),w=(0,J.useCallback)(e=>{if(!u)return;let n=u.index;if(d(null),e===`close`){x(n);return}S(lt(e,t,n))},[x,S,t,u]),T=(0,J.useCallback)((e,n)=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`ArrowLeft`){e.preventDefault(),v((n-1+t.length)%t.length);return}if(e.key===`ArrowRight`){e.preventDefault(),v((n+1)%t.length);return}if(e.key===`Home`){e.preventDefault(),v(0);return}if(e.key===`End`){e.preventDefault(),v(t.length-1);return}if(e.key===`Enter`||e.key===` `){e.preventDefault(),v(n);return}(e.key===`Delete`||e.key===`Backspace`)&&(e.preventDefault(),x(n))}},[x,v,t.length]),E=(0,J.useCallback)((e,t)=>{e.button===1&&(e.preventDefault(),e.stopPropagation(),x(t))},[x]),D=(0,J.useCallback)(async()=>{if(!f||m)return;h(!0);for(let e of f.files)if(!await s(e,!1)){h(!1);return}let e=ct(f),t=f.closeFiles;p(null),h(!1),y(t,e)},[y,s,f,m]),O=(0,J.useCallback)(()=>{if(!f)return;let e=ct(f),t=f.closeFiles;p(null),h(!1),y(t,e)},[y,f]),k=(0,J.useCallback)(()=>{p(null),h(!1)},[]),A=(0,J.useMemo)(()=>f?f.files.length===1?B(f.files[0]?.file.path??``):`${f.files.length} ${n}`:``,[n,f]);return(0,J.useEffect)(()=>{let t=H(e),n=c.current.get(t);n?.scrollIntoView({block:`nearest`,inline:`nearest`}),l.current===t&&(n?.focus(),l.current=null)},[e,t.length]),{tabContextMenu:u,pendingClose:f,pendingCloseSaving:m,pendingCloseLabel:A,closeTabContextMenu:g,setTabRef:_,focusEditorTab:v,closeEditorTab:x,openEditorTabContextMenu:C,runTabContextAction:w,handleEditorTabKeyDown:T,handleEditorTabAuxClick:E,confirmSaveAndClose:D,discardAndClose:O,cancelPendingClose:k}}var dt=1;function ft(){let e=dt;return dt+=1,e}function pt({openFile:e,readOnly:t,onUpdateOpenFile:n}){let r=(0,J.useCallback)(async(e,t=!1)=>{if(A(e))return!0;let r={agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot},i=ft(),a=n(r,e=>e.saving||!t&&!e.dirty?e:u(e,i));if(!a)return!1;if(a.saveRequestId!==i)return!a.dirty&&!a.saving;let s={...r,saveRequestId:i};try{let e=await S(a.agentId,a.file.path,a.draft,a.file.sha1,t),r=n(s,t=>o(t,i,e));return!!(r&&!r.dirty)}catch(e){let t=e instanceof y&&e.status===409;if(!(e instanceof y)||e.status>=500)try{let e=await x(a.agentId,a.file.path);if(e.content===a.draft){let t=n(s,t=>o(t,i,e));return!!(t&&!t.dirty)}}catch{}return n(s,n=>l(n,i,e instanceof Error?e.message:`Failed to save file`,t)),!1}},[n]);return{saveOpenWorkspaceFile:r,saveFile:(0,J.useCallback)(async(n=!1)=>{t||await r(e,n)},[e,t,r]),reloadFile:(0,J.useCallback)(async()=>{let t={agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot},r=ft(),i=n(t,e=>e.saving?e:u(e,r));if(!i||i.saveRequestId!==r)return;let a={...t,saveRequestId:r};try{let e=await x(i.agentId,i.file.path);n(a,t=>o(t,r,e))}catch(e){n(a,t=>l(t,r,e instanceof Error?e.message:`Failed to reload file`,!1))}},[n,e])}}var mt=``,ht=`farming.code.fileEditor.wordWrap`;function gt(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(ht)===`1`}catch{return!1}}function _t(e){if(!(typeof window>`u`))try{window.localStorage.setItem(ht,e?`1`:`0`)}catch{}}function vt({openFile:e,openFiles:t,onChangeDraft:n,onUpdateOpenFile:r,onSelectOpenFile:i,onOpenFilePath:a,canNavigateBack:o,canNavigateForward:s,onNavigateHistory:c,onCloseOpenFile:l,onCloseOpenFiles:u,onRevealInExplorer:d,onFocusFilesSearch:f,onRecordNavigationCursor:p,onBackToAgent:m,copy:h}){let g=(0,J.useRef)(()=>{}),_=(0,J.useRef)(()=>{}),v=ee(e),y=ae(e),[b,x]=(0,J.useState)({}),[S,C]=(0,J.useState)({}),[T,E]=(0,J.useState)(gt),D=H(e),O=!y.preview&&!y.diffOnly&&ne(e.file.path),k=!y.preview&&!y.diffOnly&&de(e.file.path),A=b[D],j=O||k?A!==!1:!1,M=O&&j,N=M&&S[D]===!0,P=M&&!N,F=k&&j,I=!y.canEditText||w(e.agentId)||e.file.readOnly===!0,L=y.canShowBlame&&e.file.external!==!0,R=y.canShowLineChanges&&e.file.external!==!0,{saveOpenWorkspaceFile:re,saveFile:z,reloadFile:ie}=pt({openFile:e,readOnly:I,onUpdateOpenFile:r}),{tabContextMenu:oe,pendingClose:se,pendingCloseSaving:ce,pendingCloseLabel:le,closeTabContextMenu:ue,setTabRef:B,focusEditorTab:fe,closeEditorTab:V,openEditorTabContextMenu:me,runTabContextAction:he,handleEditorTabKeyDown:ge,handleEditorTabAuxClick:_e,confirmSaveAndClose:ve,discardAndClose:ye,cancelPendingClose:be}=ut({openFile:e,openFiles:t,filesLabel:h.files,onSelectOpenFile:i,onCloseOpenFile:l,onCloseOpenFiles:u,onDismissEditorContextMenu:()=>_.current(),onSaveOpenFile:re}),xe=rt({openFile:e,openFiles:t,onCloseEditorTab:V,onFocusEditorTab:fe,onFocusFilesSearch:f,onSaveFile:z}),{editorHostRef:U,editorRef:W,cursorPosition:Se,revealLine:Ce}=nt({openFile:e,openFiles:t,readOnly:I,wordWrapEnabled:T,editorLabel:h.editorFor(e.file.path),onChangeDraft:n,onFocusFilesSearch:f,onRecordNavigationCursor:p,onSaveShortcut:()=>{z(!1)},onOpenContextMenuRef:g}),{blameOpen:G,blameLoading:K,blame:q,blameError:we,blameCapability:Te,blameDetail:X,blameLabelWidths:Ee,checkBlameCapability:De,toggleBlame:Oe,showBlameDetail:ke,clearBlameDetail:Z}=Xe({openFile:e,disabled:!L,onRevealLine:Ce}),{lineChanges:Ae,openLineChanges:je,closeLineChanges:Me}=et({openFile:e,disabled:!R,onClearBlameDetail:Z,onRevealLine:Ce}),{diffState:Q,closeDiff:Pe,toggleDiff:Fe}=$e({openFile:e,diffDisabled:!y.canShowDiff,onClearBlameDetail:Z}),Ie=P&&!Q.open,{blameOverlay:Re}=Ze({blame:q,blameLabelWidths:Ee,blameOpen:G,editorHostRef:U,editorRef:W,disabled:!L}),{editorContextMenu:ze,closeEditorContextMenu:Be,openEditorContextMenu:Ve,runEditorContextAction:He,showBlameContextAction:Ue,showLineChangesContextActions:We}=Qe({blameCapability:Te,blameOpen:G,canShowBlame:L,canShowLineChanges:R,editorRef:W,readOnly:I,onCheckBlameCapability:De,onClearBlameDetail:Z,onCloseTabContextMenu:ue,onOpenLineChanges:je,onToggleBlame:Oe});g.current=Ve,_.current=Be;let Ge=te(e)===`changedOnDisk`?h.changedOnDisk:null,Ke=X?pe(X.line.author,mt):``;return(0,J.useEffect)(()=>{if(!(typeof document>`u`))return document.body.classList.toggle(`code-mobile-markdown-reading`,M),()=>{document.body.classList.remove(`code-mobile-markdown-reading`)}},[M]),(0,J.useEffect)(()=>{let e=W.current;if(!e)return;let t=window.requestAnimationFrame(()=>e.layout());return()=>window.cancelAnimationFrame(t)},[W,N,P,j]),(0,Y.jsxs)(`section`,{className:`code-file-editor ${M?`markdown-reading`:``}`.trim(),"data-testid":`code-file-editor`,onKeyDownCapture:xe,children:[(0,Y.jsx)(Ne,{openFile:e,openFiles:t,editorMode:y,copy:h,statusText:Ge,onBackToAgent:m,onSelectOpenFile:i,canNavigateBack:o,canNavigateForward:s,onNavigateHistory:c,onSetTabRef:B,onOpenTabContextMenu:me,onTabAuxClick:_e,onTabKeyDown:ge,onCloseTab:V,onRevealInExplorer:d,onSave:z,onReload:ie,onToggleSourcePreview:()=>{if(!O&&!k)return;let e=!j;x(t=>({...t,[D]:e})),O&&!e&&C(e=>({...e,[D]:!1}))},onToggleMarkdownSplit:()=>{O&&(x(e=>({...e,[D]:!0})),C(e=>({...e,[D]:!N})))},onToggleWordWrap:()=>{E(e=>{let t=!e;return _t(t),t})},onToggleDiff:Fe,canPreviewMarkdown:O,canPreviewSource:k,diffOpen:Q.open,markdownPreviewVisible:Ie,markdownSplitOpen:N,sourcePreviewOpen:j,wordWrapEnabled:T}),e.error&&(0,Y.jsx)(`div`,{className:`code-file-editor-alert`,"data-testid":`code-file-editor-alert`,children:e.error}),(0,Y.jsx)(Je,{activeTabDomId:v,blame:q,blameAuthorProfileUrl:Ke,blameDetailLine:X?.line??null,blameOpen:G,blameOverlay:Re,copy:h,cursorPosition:Se,diffState:Q,editorMode:y,editorHostRef:U,lineChanges:Ae,markdownSplitOpen:N,markdownPreviewOpen:P,sourcePreviewOpen:F,openFile:e,onClearBlameDetail:Z,onCloseDiff:Pe,onCloseLineChanges:Me,onOpenFilePath:a,onShowBlameDetail:ke}),(0,Y.jsx)(Le,{blame:q,blameError:we,blameLoading:K,blameOpen:G,copy:h,editorContextMenu:ze,readOnly:I,openFiles:t,pendingCloseOpen:!!se,pendingCloseLabel:le,pendingCloseSaving:ce,showBlameContextAction:Ue,showLineChangesContextActions:We,tabContextMenu:oe,onCancelPendingClose:be,onCloseEditorContextMenu:Be,onConfirmSaveAndClose:ve,onDiscardAndClose:ye,onRunEditorContextAction:He,onRunTabContextAction:he})]})}export{vt as FileEditorPane};
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{i as t,t as n}from"./jsx-runtime-BthL93pI.js";import{c as r,s as i}from"./editor.api2-B9h6iFPK.js";import{r as a}from"./monaco.contribution-BXz-lfFB.js";import{A as o,C as s,E as c,N as l,O as u,T as d,b as f,g as p,l as m,m as h,n as g,o as _,pt as v,r as y,s as b,u as x,v as S}from"./file-icons-BqiH0rDI.js";import{v as C}from"./IconGlyphs-C2WFcoJS.js";import{d as w,t as T}from"./FileEditorMarkdownPreview-Da5jguUs.js";import{i as E,l as D,n as O,p as k,r as A,t as j,u as M}from"./workspace-working-copy-D8-s_Sgh.js";import{A as ee,C as N,D as P,E as F,M as I,N as L,O as te,_ as R,a as ne,b as re,d as z,f as ie,g as ae,h as oe,j as se,k as ce,m as le,n as ue,o as de,p as B,r as fe,t as V,u as pe,v as me,w as H,y as he}from"./workspace-editor-model-D0Im34S5.js";import{t as ge}from"./useWorkspaceMenuKeyboard-Brws6Ar9.js";import{a as _e,c as ve,d as ye,f as be,h as xe,l as U,m as W,n as Se,r as Ce,s as G,t as K,u as q}from"./workspace-editor-monaco-BIpqcWf1.js";var J=e(t()),Y=n();function we({previewOpen:e}){return e?(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M9 3.5V11.5C9 11.776 8.776 12 8.5 12C8.224 12 8 11.776 8 11.5V4.831L5.376 7.83C5.187 8.048 4.814 8.048 4.624 7.83L2 4.831V11.5C2 11.776 1.776 12 1.5 12C1.224 12 1 11.776 1 11.5V3.5C1 3.292 1.129 3.105 1.324 3.032C1.521 2.96 1.74 3.014 1.876 3.171L5 6.741L8.124 3.171C8.261 3.014 8.478 2.959 8.676 3.032C8.871 3.105 9 3.292 9 3.5ZM14.854 9.146C14.659 8.951 14.342 8.951 14.147 9.146L13.001 10.292V3.5C13.001 3.224 12.777 3 12.501 3C12.225 3 12.001 3.224 12.001 3.5V10.293L10.855 9.147C10.66 8.952 10.343 8.952 10.148 9.147C9.953 9.342 9.953 9.659 10.148 9.854L12.148 11.854C12.246 11.952 12.757 11.952 12.855 11.854L14.855 9.854C15.05 9.659 15.05 9.342 14.855 9.147L14.854 9.146Z`})}):(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M12.5 1H3.5C2.122 1 1 2.122 1 3.5V12.5C1 13.878 2.122 15 3.5 15H12.5C13.878 15 15 13.878 15 12.5V3.5C15 2.122 13.878 1 12.5 1ZM14 12.5C14 13.327 13.327 14 12.5 14H3.5C2.673 14 2 13.327 2 12.5V3.5C2 2.673 2.673 2 3.5 2H12.5C13.327 2 14 2.673 14 3.5V12.5ZM12 3H4C3.448 3 3 3.448 3 4V6C3 6.552 3.448 7 4 7H12C12.552 7 13 6.552 13 6V4C13 3.448 12.552 3 12 3ZM12 6H4V4H12V6ZM12 8H9C8.448 8 8 8.448 8 9V12C8 12.552 8.448 13 9 13H12C12.552 13 13 12.552 13 12V9C13 8.448 12.552 8 12 8ZM12 12H9V9H12V12ZM7 8.5C7 8.776 6.776 9 6.5 9H3.5C3.224 9 3 8.776 3 8.5C3 8.224 3.224 8 3.5 8H6.5C6.776 8 7 8.224 7 8.5ZM7 10.5C7 10.776 6.776 11 6.5 11H3.5C3.224 11 3 10.776 3 10.5C3 10.224 3.224 10 3.5 10H6.5C6.776 10 7 10.224 7 10.5ZM7 12.5C7 12.776 6.776 13 6.5 13H3.5C3.224 13 3 12.776 3 12.5C3 12.224 3.224 12 3.5 12H6.5C6.776 12 7 12.224 7 12.5Z`})})}function Te(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M5.5 2H2.5C1.673 2 1 2.673 1 3.5V12.5C1 13.327 1.673 14 2.5 14H5.5C6.327 14 7 13.327 7 12.5V3.5C7 2.673 6.327 2 5.5 2ZM2.5 3H5.5C5.775 3 6 3.224 6 3.5V5H2V3.5C2 3.224 2.225 3 2.5 3ZM5.5 13H2.5C2.225 13 2 12.776 2 12.5V6H6V12.5C6 12.776 5.775 13 5.5 13ZM13.5 2H10.5C9.673 2 9 2.673 9 3.5V12.5C9 13.327 9.673 14 10.5 14H13.5C14.327 14 15 13.327 15 12.5V3.5C15 2.673 14.327 2 13.5 2ZM10.5 3H13.5C13.775 3 14 3.224 14 3.5V8H10V3.5C10 3.224 10.225 3 10.5 3ZM13.5 13H10.5C10.225 13 10 12.776 10 12.5V10H14V12.5C14 12.776 13.775 13 13.5 13Z`})})}function X(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M2.5 2C1.673 2 1 2.673 1 3.5V12.5C1 13.327 1.673 14 2.5 14H13.5C14.327 14 15 13.327 15 12.5V3.5C15 2.673 14.327 2 13.5 2H2.5ZM2 3.5C2 3.224 2.225 3 2.5 3H7.5V13H2.5C2.225 13 2 12.776 2 12.5V3.5ZM8.5 13V3H13.5C13.775 3 14 3.224 14 3.5V12.5C14 12.776 13.775 13 13.5 13H8.5ZM3.5 5H6V6H3.5V5ZM3.5 7H6V8H3.5V7ZM10 5H12.5V6H10V5ZM10 7H12.5V8H10V7ZM10 9H12.5V10H10V9Z`})})}function Ee(){return(0,Y.jsxs)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:[(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5 6.5V3.75C5 2.765 4.121 2.25 3.251 2.25C2.363 2.25 1.99 2.553 1.897 2.646C1.702 2.841 1.688 3.17 1.883 3.365C2.077 3.561 2.38 3.573 2.576 3.378C2.588 3.37 2.773 3.25 3.25 3.25C3.28 3.25 4 3.256 4 3.75V4.056C3.796 4.023 3.552 4 3.25 4C1.937 4 1.25 4.754 1.25 5.5C1.25 6.246 1.937 7 3.25 7C3.622 7 3.911 6.937 4.145 6.851C4.236 6.943 4.361 7 4.5 7C4.776 7 5 6.776 5 6.5ZM3.251 5C3.623 5 3.857 5.038 4.001 5.074V5.811C3.908 5.885 3.698 6 3.251 6C2.602 6 2.251 5.742 2.251 5.5C2.251 5.258 2.602 5 3.251 5Z`}),(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.001 7C9.104 7 10.001 5.991 10.001 4.75C10.001 3.509 9.104 2.5 8.001 2.5C7.635 2.5 7.296 2.619 7.001 2.813V1.5C7.001 1.224 6.777 1 6.501 1C6.225 1 6.001 1.224 6.001 1.5V6.5C6.001 6.776 6.225 7 6.501 7C6.718 7 6.898 6.86 6.967 6.666C7.27 6.873 7.621 7 8.001 7ZM8.001 3.5C8.553 3.5 9.001 4.061 9.001 4.75C9.001 5.439 8.553 6 8.001 6C7.449 6 7.001 5.439 7.001 4.75C7.001 4.061 7.449 3.5 8.001 3.5Z`}),(0,Y.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.539 13.653C4.31 13.857 3.699 13.976 3.33 13.514C3.117 13.248 3 12.888 3 12.5C3 12.112 3.118 11.752 3.33 11.486C3.701 11.022 4.311 11.141 4.54 11.347C4.744 11.533 5.06 11.515 5.246 11.311C5.431 11.106 5.415 10.79 5.209 10.605C4.422 9.895 3.233 10.009 2.549 10.861C2.195 11.305 2 11.886 2 12.5C2 13.114 2.195 13.696 2.549 14.139C2.93 14.613 3.445 14.875 4 14.875C4.441 14.875 4.859 14.709 5.208 14.395C5.413 14.21 5.43 13.894 5.245 13.689C5.059 13.484 4.743 13.466 4.539 13.653Z`}),(0,Y.jsx)(`path`,{d:`M12.5 4H11.5C11.224 4 11 4.224 11 4.5C11 4.776 11.224 5 11.5 5H12.5C12.775 5 13 5.224 13 5.5V11.499C13 11.775 12.775 11.999 12.5 11.999H8.707L9.853 10.853C10.048 10.658 10.048 10.341 9.853 10.146C9.658 9.951 9.341 9.951 9.146 10.146L7.146 12.146C7.049 12.244 7 12.372 7 12.5C7 12.628 7.048 12.756 7.146 12.854L9.146 14.854C9.341 15.049 9.658 15.049 9.853 14.854C10.048 14.659 10.048 14.342 9.853 14.147L8.707 13.001H12.5C13.327 13.001 14 12.328 14 11.501V5.5C14 4.673 13.327 4 12.5 4Z`})]})}function De(e,t,n){return e.showMarkdownPreview?n?t.showMarkdownSource:t.openMarkdownPreview:n?t.showFileSource:t.openFilePreview}function Oe({actions:e,copy:t,diffOpen:n,markdownSplitOpen:r,openFile:i,sourcePreviewOpen:a,wordWrapEnabled:o,statusText:s,onReload:c,onSave:l,onToggleMarkdownSplit:u,onToggleSourcePreview:d,onToggleWordWrap:f,onToggleDiff:p}){let m=e.showMarkdownPreview||e.showSourcePreview,h=De(e,t,a),g=r?t.closeMarkdownSplitPreview:t.openMarkdownSplitPreview;return(0,Y.jsxs)(`div`,{className:`code-file-editor-actions`,children:[e.showStatus&&s&&(0,Y.jsx)(`span`,{className:`code-file-editor-status ${i.externalChanged?`warning`:``}`,children:s}),e.showSave&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action save`,onClick:()=>l(!1),disabled:i.saving,"aria-label":t.saveFile,title:t.saveFile}),e.showDiff&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action diff ${n?`active`:``}`,onClick:p,disabled:i.saving,"aria-label":n?t.closeDiff:t.openFileDiff,title:n?t.closeDiff:t.openFileDiff,children:(0,Y.jsx)(Te,{})}),m&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action source-preview`,onClick:d,disabled:i.saving,"aria-label":h,title:h,children:(0,Y.jsx)(we,{previewOpen:a})}),e.showMarkdownPreview&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action markdown-split ${r?`active`:``}`,onClick:u,disabled:i.saving,"aria-label":g,title:g,children:(0,Y.jsx)(X,{})}),e.showWordWrap&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action word-wrap ${o?`active`:``}`,onClick:f,disabled:i.saving,"aria-pressed":o,"aria-label":o?t.disableWordWrap:t.enableWordWrap,title:o?t.disableWordWrap:t.enableWordWrap,children:(0,Y.jsx)(Ee,{})}),e.showReload&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action reload`,onClick:c,disabled:i.saving,"aria-label":t.reloadFile,title:t.reloadFile}),e.showOverwrite&&(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action overwrite`,onClick:()=>l(!0),disabled:i.saving,"aria-label":t.overwriteChangedFile,title:t.overwriteChangedFile,children:(0,Y.jsx)(C,{className:`code-file-editor-action-svg`})})]})}function ke({openFile:e,copy:t,onRevealInExplorer:n}){let r=(0,J.useMemo)(()=>F(e.file.path),[e.file.path]),i=L(e.workspaceRoot),a=e.workspaceRoot?`${e.workspaceRoot.replace(/[\\/]+$/,``)}/${e.file.path}`:e.file.path;return r.length===0?(0,Y.jsx)(`span`,{"aria-hidden":`true`}):(0,Y.jsxs)(`nav`,{className:`code-file-editor-breadcrumbs`,title:a,"aria-label":t.filePath,children:[i&&(0,Y.jsxs)(`button`,{type:`button`,className:`code-file-editor-breadcrumb root`,onClick:()=>n(e.agentId,``,`directory`),"aria-label":t.revealInExplorer(i),children:[(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-name`,children:i}),(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-separator`,"aria-hidden":`true`})]}),r.map((r,i,a)=>{let o=i===a.length-1,s=P(a,i);return(0,Y.jsxs)(`button`,{type:`button`,className:`code-file-editor-breadcrumb ${o?`current`:``}`,onClick:()=>n(e.agentId,s,o?`file`:`directory`),"aria-label":t.revealInExplorer(s),children:[o&&(0,Y.jsx)(`img`,{className:`code-file-editor-breadcrumb-file-icon`,src:g(e.file.path),alt:``,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-name`,children:r}),!o&&(0,Y.jsx)(`span`,{className:`code-file-editor-breadcrumb-separator`,"aria-hidden":`true`})]},`${i}-${r}`)})]})}function Z(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13.5 8.00023H3.70701L7.85301 3.85423C8.04801 3.65923 8.04801 3.34223 7.85301 3.14723C7.65801 2.95223 7.34101 2.95223 7.14601 3.14723L2.14601 8.14723C1.95101 8.34223 1.95101 8.65923 2.14601 8.85423L7.14601 13.8542C7.24401 13.9522 7.37201 14.0002 7.50001 14.0002C7.62801 14.0002 7.75601 13.9512 7.85401 13.8542C8.04901 13.6592 8.04901 13.3422 7.85401 13.1472L3.70801 9.00123H13.501C13.777 9.00123 14.001 8.77723 14.001 8.50123C14.001 8.22523 13.777 8.00123 13.501 8.00123L13.5 8.00023Z`})})}function Ae(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13.854 8.14576L8.854 3.14576C8.659 2.95076 8.342 2.95076 8.147 3.14576C7.952 3.34076 7.952 3.65776 8.147 3.85276L12.293 7.99876H2.5C2.224 7.99876 2 8.22276 2 8.49876C2 8.77476 2.224 8.99876 2.5 8.99876H12.293L8.147 13.1448C7.952 13.3398 7.952 13.6568 8.147 13.8518C8.245 13.9498 8.373 13.9978 8.501 13.9978C8.629 13.9978 8.757 13.9488 8.855 13.8518L13.855 8.85176C14.05 8.65676 14.05 8.33976 13.855 8.14476L13.854 8.14576Z`})})}function je(){return(0,Y.jsx)(`svg`,{className:`code-file-editor-action-svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,Y.jsx)(`path`,{d:`M13 13.5C13 13.776 12.776 14 12.5 14C9.46198 14 6.99998 11.538 6.99998 8.50001V3.70701L4.35398 6.35301C4.15898 6.54801 3.84198 6.54801 3.64698 6.35301C3.45198 6.15801 3.45198 5.84101 3.64698 5.64601L7.14698 2.14601C7.34198 1.95101 7.65898 1.95101 7.85398 2.14601L11.354 5.64601C11.549 5.84101 11.549 6.15801 11.354 6.35301C11.159 6.54801 10.842 6.54801 10.647 6.35301L8.00098 3.70701V8.50001C8.00098 10.985 10.016 13 12.501 13C12.777 13 13.001 13.224 13.001 13.5H13Z`})})}function Me({openFile:e,openFiles:t,copy:n,onBackToAgent:r,onSelectOpenFile:i,canNavigateBack:a,canNavigateForward:o,onNavigateHistory:s,onSetTabRef:c,onOpenTabContextMenu:l,onTabAuxClick:u,onTabKeyDown:d,onCloseTab:f,actions:p}){return(0,Y.jsxs)(`div`,{className:`code-file-editor-tab-strip`,children:[(0,Y.jsxs)(`div`,{className:`code-file-editor-navigation`,children:[e.sourceAgentId&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-agent-return`,onClick:()=>r(e.sourceAgentId),"aria-label":n.backToAgent,title:n.backToAgent,"data-testid":`code-file-editor-back`,children:(0,Y.jsx)(je,{})}),(0,Y.jsx)(`span`,{className:`code-file-editor-navigation-divider`,"aria-hidden":`true`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-history-back`,onClick:()=>{s(-1)},disabled:!a,"aria-label":n.goBack,title:n.goBack,"data-testid":`code-file-editor-history-back`,children:(0,Y.jsx)(Z,{})}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-editor-action code-file-editor-history-forward`,onClick:()=>{s(1)},disabled:!o,"aria-label":n.goForward,title:n.goForward,"data-testid":`code-file-editor-history-forward`,children:(0,Y.jsx)(Ae,{})})]}),(0,Y.jsx)(`div`,{className:`code-file-editor-tabs`,role:`tablist`,children:t.map((t,r)=>{let a=H(t),o=a===H(e),s=k(t),p=M(t);return(0,Y.jsxs)(`div`,{id:ee(t),ref:e=>c(a,e),className:`code-file-editor-tab ${o?`active`:``} ${s}`.trim(),title:t.file.path,role:`tab`,"aria-selected":o,"aria-controls":`code-file-editor-panel`,"aria-label":se(t),tabIndex:o?0:-1,onClick:()=>i(t.agentId,t.file.path),onContextMenu:e=>l(e,r),onAuxClick:e=>u(e,r),onKeyDown:e=>d(e,r),children:[(0,Y.jsx)(`img`,{className:`code-file-type-icon file`,src:g(t.file.path),alt:``,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`code-file-editor-tab-name`,children:B(t.file.path)}),(0,Y.jsxs)(`span`,{className:`code-file-editor-tab-tail`,children:[p&&(0,Y.jsx)(`span`,{className:`code-file-editor-dirty`,title:p===`external`?n.changedOnDisk:n.unsavedChanges}),(0,Y.jsx)(`button`,{type:`button`,tabIndex:-1,className:`code-file-editor-close`,onClick:e=>{e.stopPropagation(),f(r)},"aria-label":n.closeFile(t.file.path)})]})]},a)})}),p]})}function Ne({openFile:e,openFiles:t,editorMode:n,copy:r,statusText:i,onBackToAgent:a,onSelectOpenFile:o,canNavigateBack:s,canNavigateForward:c,onNavigateHistory:l,onSetTabRef:u,onOpenTabContextMenu:d,onTabAuxClick:f,onTabKeyDown:p,onCloseTab:m,onRevealInExplorer:h,onSave:g,onReload:_,onToggleSourcePreview:v,onToggleMarkdownSplit:y,onToggleWordWrap:b,onToggleDiff:x,canPreviewMarkdown:S,canPreviewSource:C,diffOpen:w,markdownPreviewVisible:T,markdownSplitOpen:E,sourcePreviewOpen:D,wordWrapEnabled:O}){let k=!!e.file.path&&!T;return(0,Y.jsxs)(`header`,{className:`code-file-editor-header`,children:[(0,Y.jsx)(Me,{openFile:e,openFiles:t,copy:r,onBackToAgent:a,onSelectOpenFile:o,canNavigateBack:s,canNavigateForward:c,onNavigateHistory:l,onSetTabRef:u,onOpenTabContextMenu:d,onTabAuxClick:f,onTabKeyDown:p,onCloseTab:m,actions:(0,Y.jsx)(Oe,{actions:ie(e,n,{canPreviewMarkdown:S,canPreviewSource:C,statusText:i,showBreadcrumbs:k}),copy:r,diffOpen:w,openFile:e,markdownSplitOpen:E,sourcePreviewOpen:D,wordWrapEnabled:O,statusText:i,onReload:_,onSave:g,onToggleMarkdownSplit:y,onToggleSourcePreview:v,onToggleWordWrap:b,onToggleDiff:x})}),k&&(0,Y.jsx)(`div`,{className:`code-file-editor-bar`,children:(0,Y.jsx)(ke,{openFile:e,copy:r,onRevealInExplorer:h})})]})}function Q({blame:e,loading:t,error:n,copy:r}){return!t&&!n&&(!e||e.isGitRepo&&e.lines.length>0)?null:(0,Y.jsx)(`div`,{className:`code-file-blame-toast ${n?`error`:``}`,"data-testid":`code-file-blame-state`,children:t?r.loadingBlame:n||(e&&!e.isGitRepo?r.notGitRepository:r.noCommittedLines)})}function Pe({x:e,y:t,copy:n,blameOpen:r,readOnly:i,showBlameContextAction:a,showLineChangesContextActions:o,onClose:s,onRunAction:c}){let l=(0,J.useRef)(null),u=ge({menuOpen:!0,menuRef:l,onClose:s});return(0,Y.jsxs)(`div`,{ref:l,className:`code-editor-context-menu`,"data-testid":`code-editor-context-menu`,role:`menu`,style:{left:e,top:t},onKeyDown:u,onMouseDown:e=>e.stopPropagation(),children:[a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`toggle-blame`),children:r?n.hideBlame:n.annotateWithBlame}),(0,Y.jsx)(`div`,{className:`code-editor-context-separator`,role:`separator`})]}),o&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`line-changes-previous`),children:n.openLineChangesWithPreviousRevision}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`line-changes-working`),children:n.openLineChangesWithWorkingFile}),(0,Y.jsx)(`div`,{className:`code-editor-context-separator`,role:`separator`})]}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`cut`),disabled:i,children:n.cut}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`copy`),children:n.copy}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`paste`),disabled:i,children:n.paste}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>c(`select-all`),children:n.selectAll})]})}function Fe({label:e,saving:t,copy:n,onConfirmSave:r,onDiscard:i,onCancel:a}){return(0,Y.jsx)(`div`,{className:`code-file-save-confirm-backdrop`,"data-testid":`code-file-save-confirm`,role:`presentation`,onMouseDown:e=>e.stopPropagation(),children:(0,Y.jsxs)(`div`,{className:`code-file-save-confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`code-file-save-confirm-title`,"aria-describedby":`code-file-save-confirm-description`,onKeyDown:e=>{e.key===`Escape`&&!t&&(e.preventDefault(),a())},children:[(0,Y.jsx)(`div`,{className:`code-file-save-confirm-brand`,"aria-hidden":`true`,children:`F`}),(0,Y.jsx)(`h2`,{id:`code-file-save-confirm-title`,children:n.saveBeforeCloseTitle(e)}),(0,Y.jsx)(`p`,{id:`code-file-save-confirm-description`,children:n.saveBeforeCloseDescription}),(0,Y.jsxs)(`div`,{className:`code-file-save-confirm-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`primary`,onClick:r,disabled:t,children:t?n.savingFile:n.save}),(0,Y.jsx)(`button`,{type:`button`,onClick:i,disabled:t,children:n.dontSave}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,disabled:t,children:n.cancel})]})]})})}function Ie({menu:e,openFiles:t,copy:n,onRunAction:r}){return(0,Y.jsxs)(`div`,{className:`code-context-menu code-file-tab-context-menu`,"data-testid":`code-file-tab-context-menu`,role:`menu`,style:{left:e.x,top:e.y},children:[(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close`),children:n.close}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-others`),disabled:t.length<=1,children:n.closeOthers}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-right`),disabled:e.index>=t.length-1,children:n.closeToRight}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-saved`),disabled:!j(t),children:n.closeSaved}),(0,Y.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>r(`close-all`),children:n.closeAll})]})}function Le({blame:e,blameError:t,blameLoading:n,blameOpen:r,copy:i,editorContextMenu:a,readOnly:o,openFiles:s,pendingCloseOpen:c,pendingCloseLabel:l,pendingCloseSaving:u,showBlameContextAction:d,showLineChangesContextActions:f,tabContextMenu:p,onCancelPendingClose:m,onCloseEditorContextMenu:h,onConfirmSaveAndClose:g,onDiscardAndClose:_,onRunEditorContextAction:v,onRunTabContextAction:y}){return(0,Y.jsxs)(Y.Fragment,{children:[a&&(0,Y.jsx)(Pe,{x:a.x,y:a.y,copy:i,blameOpen:r,readOnly:o,showBlameContextAction:d,showLineChangesContextActions:f,onClose:h,onRunAction:e=>void v(e)}),p&&(0,Y.jsx)(Ie,{menu:p,openFiles:s,copy:i,onRunAction:y}),c&&(0,Y.jsx)(Fe,{label:l,saving:u,copy:i,onConfirmSave:()=>void g(),onDiscard:_,onCancel:m}),r&&(0,Y.jsx)(Q,{blame:e,loading:n,error:t,copy:i})]})}function Re({filePath:e,line:t,authorProfileUrl:n,copy:r,onClose:i}){return(0,Y.jsxs)(`section`,{className:`code-file-blame-detail`,"data-testid":`code-file-blame-detail`,"aria-label":r.gitBlameDetails,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-main`,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-title`,children:[(0,Y.jsx)(`strong`,{children:t.summary||t.shortCommit}),(0,Y.jsx)(`code`,{title:t.commit,children:t.shortCommit})]}),(0,Y.jsx)(`div`,{className:`code-file-blame-detail-subtitle`,children:e})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-rows`,children:[(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.author}),n?(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,children:t.author}):(0,Y.jsx)(`strong`,{children:t.author||r.unknown})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.commit}),(0,Y.jsx)(`strong`,{title:t.commit,children:t.shortCommit})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.date}),(0,Y.jsx)(`strong`,{children:ue(t.authorTime)||r.uncommitted})]}),(0,Y.jsxs)(`div`,{className:`code-file-blame-detail-row`,children:[(0,Y.jsx)(`span`,{children:r.line}),(0,Y.jsx)(`strong`,{children:t.lineNumber})]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-blame-detail-close`,onClick:i,"aria-label":r.closeBlameDetails})]})}function ze(e,t){if(e.loading)return t.loadingDiff;if(e.error)return e.error;let n=e.diff;return n?n.isGitRepo?n.binary?t.binaryDiffUnavailable:n.truncated?t.diffTooLarge:n.patch.trim()?typeof n.originalContent!=`string`||typeof n.modifiedContent!=`string`?t.diffUnavailable:``:t.noFileDiff:t.notGitRepository:``}function Be(e){let t=e.diff;return!!(t&&t.isGitRepo&&!t.binary&&!t.truncated&&t.patch.trim()&&typeof t.originalContent==`string`&&typeof t.modifiedContent==`string`)}function Ve(e,t){let n=D(e.file.path,e.workspaceRoot);return i.from({scheme:`farming-diff`,path:n.startsWith(`/`)?n:`/${n}`,query:t})}function He(e,t,n,i){let a=Ve(e,t);return r.getModel(a)?.dispose(),r.createModel(n,i,a)}function Ue({openFile:e,diffState:t,copy:n,onClose:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=Be(t),u=(0,J.useMemo)(()=>ze(t,n),[n,t]);return(0,J.useEffect)(()=>{if(!l)return;let e=a.current;if(!e)return;Se(),K();let t=r.createDiffEditor(e,{theme:W(),automaticLayout:!1,renderSideBySide:!v(),originalEditable:!1,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,renderOverviewRuler:!0,enableSplitViewResizing:!v(),ignoreTrimWhitespace:!1,glyphMargin:!0,lineNumbersMinChars:4,unicodeHighlight:{ambiguousCharacters:!1,invisibleCharacters:!0,nonBasicASCII:!1}});o.current=t;let n=new ResizeObserver(()=>t.layout());n.observe(e);let i=new MutationObserver(()=>K(t));return i.observe(document.body,{attributes:!0,attributeFilter:[`data-appearance`]}),window.requestAnimationFrame(()=>t.layout()),()=>{n.disconnect(),i.disconnect(),t.dispose(),s.current?.dispose(),c.current?.dispose(),s.current=null,c.current=null,o.current=null}},[l]),(0,J.useEffect)(()=>{if(!l||!t.diff)return;let n=o.current;if(!n)return;s.current?.dispose(),c.current?.dispose();let r=ye(e.file.path,t.diff.modifiedContent),i=He(e,`original`,t.diff.originalContent??``,r),a=He(e,`modified`,t.diff.modifiedContent??``,r);s.current=i,c.current=a,n.setModel({original:i,modified:a}),window.requestAnimationFrame(()=>n.layout())},[t.diff,e,l]),(0,Y.jsxs)(`section`,{className:`code-file-diff-view`,"data-testid":`code-file-diff-view`,"aria-label":n.fileDiff,children:[(0,Y.jsxs)(`header`,{className:`code-file-diff-header`,children:[(0,Y.jsxs)(`div`,{className:`code-file-diff-title`,children:[(0,Y.jsx)(`strong`,{children:n.fileDiff}),(0,Y.jsx)(`span`,{children:e.file.path})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-diff-close`,"aria-label":n.closeDiff,onClick:i})]}),u&&(0,Y.jsx)(`div`,{className:`code-file-diff-state ${t.error?`error`:``}`,children:u}),(0,Y.jsx)(`div`,{ref:a,className:`code-file-diff-monaco ${l?``:`hidden`}`,"data-testid":`code-file-diff-monaco`})]})}function We({left:e,width:t,rows:n,copy:r,onShowDetail:i}){return n.length===0?null:(0,Y.jsx)(`div`,{className:`code-file-inline-blame-layer`,"aria-label":r.gitBlameAnnotations,children:n.map(({line:n,top:a})=>(0,Y.jsx)(`button`,{type:`button`,className:`code-file-inline-blame ${n.uncommitted?`uncommitted`:``}`,style:{left:e,top:a,width:t},title:`${n.shortCommit} ${n.author||r.unknown} ${n.summary}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i(n)},children:z(n)},`${n.lineNumber}-${n.commit}-${n.author}`))})}function Ge(e,t){return e===`previous`?t.openLineChangesWithPreviousRevision:t.openLineChangesWithWorkingFile}function Ke({mode:e,lineNumber:t,loading:n,error:r,changes:i,copy:a,onClose:o}){let s=i?.commit?`${i.commit.shortHash} ${i.commit.summary||``}`.trim():``,c=n?a.loadingLineChanges:r||(i&&!i.available?a.noLineChanges:``),l=i?.patch?i.patch.split(`
|
|
2
|
+
`):[];return(0,Y.jsxs)(`div`,{className:`code-file-line-changes-panel`,"data-testid":`code-file-line-changes-panel`,children:[(0,Y.jsxs)(`div`,{className:`code-file-line-changes-main`,children:[(0,Y.jsxs)(`div`,{className:`code-file-line-changes-title`,children:[(0,Y.jsx)(`strong`,{children:Ge(e,a)}),(0,Y.jsxs)(`code`,{children:[a.line,` `,t]})]}),s&&(0,Y.jsx)(`div`,{className:`code-file-line-changes-subtitle`,children:s}),c&&(0,Y.jsx)(`div`,{className:`code-file-line-changes-state ${r?`error`:``}`,children:c}),!n&&!r&&i?.available&&(0,Y.jsx)(`pre`,{className:`code-file-line-changes-patch`,"aria-label":a.lineChanges,children:l.map((e,t)=>(0,Y.jsx)(`span`,{className:`code-file-line-changes-line ${re(e)}`,children:e||` `},`${t}-${e}`))})]}),(0,Y.jsx)(`button`,{type:`button`,className:`code-file-line-changes-close`,"aria-label":a.closeLineChanges,onClick:o})]})}function qe({openFile:e,activeTabDomId:t,copy:n,sourcePreviewOpen:r}){let i=e.file.preview??null,a=r&&de(e.file.path)?{kind:`image`,mediaType:`image/svg+xml`}:null,o=i?.kind===`image`?i:a,s=i?.kind===`pdf`?i:null,c=i?.kind===`binary`?i:null;return o?(0,Y.jsx)(`section`,{className:`code-file-preview-panel`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,tabIndex:-1,children:(0,Y.jsx)(`div`,{className:`code-file-image-preview-frame`,children:(0,Y.jsx)(`img`,{className:`code-file-image-preview`,"data-testid":`code-file-image-preview`,src:p(e.agentId,e.file.path,e.file.sha1,{exactExternal:e.exactExternal}),alt:B(e.file.path),draggable:!1})})}):s?(0,Y.jsx)(`section`,{className:`code-file-preview-panel`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,tabIndex:-1,children:(0,Y.jsx)(`iframe`,{className:`code-file-pdf-preview`,"data-testid":`code-file-pdf-preview`,src:p(e.agentId,e.file.path,e.file.sha1,{exactExternal:e.exactExternal}),title:n.previewFor(e.file.path)})}):c?(0,Y.jsx)(`section`,{className:`code-file-preview-panel metadata`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":t,"aria-label":n.previewFor(e.file.path),tabIndex:-1,children:(0,Y.jsx)(`img`,{className:`code-file-metadata-preview-icon`,"data-testid":`code-file-metadata-preview-icon`,src:g(e.file.path),alt:``,"aria-hidden":`true`,draggable:!1})}):null}function Je({activeTabDomId:e,blame:t,blameAuthorProfileUrl:n,blameDetailLine:r,blameOpen:i,blameOverlay:a,copy:o,cursorPosition:s,diffState:c,editorMode:l,editorHostRef:u,lineChanges:d,markdownSplitOpen:f,markdownPreviewOpen:p,sourcePreviewOpen:m,openFile:h,onClearBlameDetail:g,onCloseLineChanges:_,onCloseDiff:v,onOpenFilePath:y,onShowBlameDetail:b}){let x=ce({diffOnly:l.diffOnly,diffOpen:c.open,markdownSplitOpen:f,markdownPreviewOpen:p,sourcePreviewOpen:m,visualPreview:l.visualPreview}),S=(0,J.useRef)(null),C=x.showEditorOverlays||x.showMarkdownPreview;return(0,Y.jsxs)(Y.Fragment,{children:[x.showDiffView&&(0,Y.jsx)(Ue,{openFile:h,diffState:c,copy:o,onClose:v}),(0,Y.jsxs)(`div`,{className:`code-file-editor-source-region ${x.showMarkdownSplit?`markdown-split`:``} ${x.showMonaco||x.showMarkdownSplit?``:`hidden`}`.trim(),"data-testid":x.showMarkdownSplit?`code-file-markdown-split`:void 0,children:[(0,Y.jsx)(`div`,{id:`code-file-editor-panel`,ref:u,className:`code-file-monaco`,"data-testid":`code-file-monaco`,role:`tabpanel`,"aria-labelledby":e,tabIndex:-1}),x.showMarkdownSplit&&(0,Y.jsx)(T,{ref:S,activeTabDomId:e,openFile:h,onOpenFilePath:y,copy:o})]}),x.showDiffOnlyPreview&&(0,Y.jsx)(`section`,{className:`code-file-preview-panel metadata`,"data-testid":`code-file-preview-panel`,role:`tabpanel`,"aria-labelledby":e,tabIndex:-1,children:(0,Y.jsx)(`div`,{className:`code-file-diff-state`,children:o.deletedFileDiffOnly})}),x.showMarkdownPreview&&(0,Y.jsx)(T,{activeTabDomId:e,openFile:h,onOpenFilePath:y,copy:o}),x.showEditorOverlays&&i&&t?.isGitRepo&&(0,Y.jsx)(We,{left:a.left,width:a.width,rows:a.rows,copy:o,onShowDetail:b}),(0,Y.jsx)(qe,{openFile:h,activeTabDomId:e,copy:o,sourcePreviewOpen:x.showSourcePreview}),x.showEditorOverlays&&i&&r&&(0,Y.jsx)(Re,{filePath:h.file.path,line:r,authorProfileUrl:n,copy:o,onClose:g}),x.showEditorOverlays&&d&&(0,Y.jsx)(Ke,{mode:d.mode,lineNumber:d.lineNumber,loading:d.loading,error:d.error,changes:d.changes,copy:o,onClose:_}),C&&(0,Y.jsx)(`div`,{className:`code-file-editor-statusbar`,"data-testid":`code-file-editor-statusbar`,children:(0,Y.jsx)(`span`,{className:`code-file-editor-cursor-position`,children:o.cursorPosition(s.lineNumber,s.column)})})]})}function Ye(e){return e instanceof y&&fe(e.status)}function Xe({openFile:e,disabled:t,onRevealLine:n}){let r=(0,J.useRef)(0),i=(0,J.useRef)(0),a=(0,J.useRef)(H(e)),o=(0,J.useRef)(t),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(`unknown`),[v,y]=(0,J.useState)(null);a.current=H(e),o.current=t;let x=(0,J.useMemo)(()=>{let e=d?.lines??[];return{compact:V(e,!0),regular:V(e,!1)}},[d]),S=(0,J.useCallback)(()=>{y(null)},[]),C=(0,J.useCallback)(async()=>{if(t)return g(`unavailable`),null;let n=H(e),i=r.current+1;r.current=i,u(!0),m(null);try{let t=await _(e.agentId,e.file.path);return r.current!==i||a.current!==n||o.current?null:(f(t),g(t.isGitRepo&&t.lines.length>0?`available`:`unavailable`),t)}catch(e){return r.current!==i||a.current!==n||o.current?null:(f(null),m(e instanceof Error?e.message:`Failed to load blame`),g(Ye(e)?`unavailable`:`unknown`),null)}finally{r.current===i&&a.current===n&&!o.current&&u(!1)}},[t,e.agentId,e.file.path,e.file.sha1,e.workspaceRoot]),w=(0,J.useCallback)(async()=>{if(t)return g(`unavailable`),`unavailable`;let n=H(e),r=i.current+1;i.current=r;try{let t=await b(e.agentId,e.file.path);if(i.current!==r||a.current!==n)return null;let o=t.available?`available`:`unavailable`;return g(o),o}catch{return i.current!==r||a.current!==n?null:(g(`unavailable`),`unavailable`)}},[t,e]),T=(0,J.useCallback)(async()=>{if(t)return;if(s){c(!1),y(null);return}let n=H(e),r=h===`unknown`?await w():h;r!==null&&r!==`unavailable`&&a.current===n&&!o.current&&c(!0)},[h,s,w,t,e]),E=(0,J.useCallback)(e=>{n(e.lineNumber,{focusEditor:!1}),y({line:e})},[n]);return(0,J.useEffect)(()=>{f(null),u(!1),m(null),g(t?`unavailable`:`unknown`)},[t,e.agentId,e.file]),(0,J.useEffect)(()=>{t&&(c(!1),f(null),m(null),g(`unavailable`))},[t,e.agentId,e.file.path]),(0,J.useEffect)(()=>{if(!s)return;let e=!1;return C().then(t=>{e||(!t?.isGitRepo||t.lines.length===0)&&(c(!1),y(null))}),()=>{e=!0}},[s,C]),(0,J.useEffect)(()=>{y(null)},[s,e.agentId,e.file.path]),{blameOpen:s,blameLoading:l,blame:d,blameError:p,blameCapability:h,blameDetail:v,blameLabelWidths:x,checkBlameCapability:w,toggleBlame:T,showBlameDetail:E,clearBlameDetail:S}}function Ze({blame:e,blameLabelWidths:t,blameOpen:n,editorHostRef:i,editorRef:a,disabled:o}){let[s,c]=(0,J.useState)({left:0,width:112,rows:[]}),l=(0,J.useCallback)(()=>{let s=a.current,l=i.current;if(!s||!l||!n||!e?.isGitRepo||o){c({left:0,width:112,rows:[]}),s?.updateOptions({lineDecorationsWidth:10});return}let u=l.clientWidth<=520?t.compact:t.regular;s.updateOptions({lineDecorationsWidth:u+12});let d=s.getLayoutInfo(),f=l.offsetTop,p=s.getScrollTop(),m=s.getOption(r.EditorOption.lineHeight),h=l.offsetLeft+Math.max(0,d.contentLeft-u-8),g=I({visibleRanges:s.getVisibleRanges(),scrollTop:p,hostHeight:l.clientHeight,lineHeight:m});c({left:h,width:u,rows:le(e.lines,{...g,hostTop:f,scrollTop:p,hostHeight:l.clientHeight,lineHeight:m,getTopForLineNumber:e=>s.getTopForLineNumber(e)})})},[e,t,n,o,i,a]);return(0,J.useEffect)(()=>{let e=a.current;if(!e)return;l();let t=e.onDidScrollChange(l),n=e.onDidLayoutChange(l),r=window.requestAnimationFrame(l);return()=>{t.dispose(),n.dispose(),window.cancelAnimationFrame(r)}},[a,l]),{blameOverlay:s}}function Qe({blameCapability:e,blameOpen:t,canShowBlame:n,canShowLineChanges:i,editorRef:a,readOnly:o,onCheckBlameCapability:s,onClearBlameDetail:c,onCloseTabContextMenu:l,onOpenLineChanges:u,onToggleBlame:d}){let[f,p]=(0,J.useState)(null),m=(0,J.useCallback)(()=>{p(null)},[]),h=(0,J.useCallback)(e=>{let i=e.target.type,o=new Set([r.MouseTargetType.GUTTER_GLYPH_MARGIN,r.MouseTargetType.GUTTER_LINE_NUMBERS,r.MouseTargetType.GUTTER_LINE_DECORATIONS,r.MouseTargetType.GUTTER_VIEW_ZONE]),u=e.target.position?.lineNumber??a.current?.getPosition()?.lineNumber??1,d=o.has(i)?`gutter`:`editor`;e.event.preventDefault(),e.event.stopPropagation(),c(),l();let f={x:Math.max(8,Math.min(e.event.posx,window.innerWidth-220)),y:Math.max(8,Math.min(e.event.posy,window.innerHeight-230)),kind:d,lineNumber:u};if(d===`gutter`&&n&&!t){s().then(e=>{e!==null&&p(f)});return}p(f)},[t,n,a,s,c,l]),g=(0,J.useCallback)(async e=>{let t=a.current,r=f;if(m(),!t)return;let s=t.getModel(),c=t.getSelection();if(e===`toggle-blame`){if(!n)return;await d();return}if(e===`line-changes-previous`||e===`line-changes-working`){if(!i)return;let n=r?.lineNumber??t.getPosition()?.lineNumber??1;await u(e===`line-changes-previous`?`previous`:`working`,n);return}if(e===`select-all`&&s){t.setSelection(s.getFullModelRange()),t.focus();return}if(!(!s||!c)){if(e===`copy`||e===`cut`){let n=s.getValueInRange(c);n&&await navigator.clipboard?.writeText(n).catch(()=>{}),e===`cut`&&n&&!o&&t.executeEdits(`farming-context-menu`,[{range:c,text:``,forceMoveMarkers:!0}]),t.focus();return}if(e===`paste`&&!o){let e=await navigator.clipboard?.readText().catch(()=>``)??``;e&&t.executeEdits(`farming-context-menu`,[{range:c,text:e,forceMoveMarkers:!0}]),t.focus()}}},[n,i,m,f,a,u,d,o]),_=!!(f&&f.kind===`gutter`&&n&&(t||e===`available`)),v=!!(f&&f.kind===`gutter`&&i);return(0,J.useEffect)(()=>{let e=e=>{let t=e.target;t instanceof Element&&t.closest(`.code-editor-context-menu, .code-file-tab-context-menu, .code-file-blame-detail, .code-file-inline-blame, .code-file-line-changes-panel`)||(p(null),l())},t=e=>{e.key===`Escape`&&(p(null),l())};return document.addEventListener(`mousedown`,e,!0),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`mousedown`,e,!0),document.removeEventListener(`keydown`,t,!0)}},[l]),{editorContextMenu:f,closeEditorContextMenu:m,openEditorContextMenu:h,runEditorContextAction:g,showBlameContextAction:_,showLineChangesContextActions:v}}function $e({openFile:e,diffDisabled:t,onClearBlameDetail:n}){let r=(0,J.useRef)(0),i=(0,J.useRef)(void 0),a=(0,J.useRef)(H(e)),[o,s]=(0,J.useState)({open:!1,loading:!1,error:null,diff:null});a.current=H(e);let c=(0,J.useCallback)(()=>{r.current+=1,s({open:!1,loading:!1,error:null,diff:null})},[]),l=(0,J.useCallback)(async()=>{if(t)return;let i=r.current+1,o=H(e);r.current=i,n(),s({open:!0,loading:!0,error:null,diff:null});try{let t=await m(e.agentId,e.file.path);if(r.current!==i||a.current!==o)return;s({open:!0,loading:!1,error:null,diff:t})}catch(e){if(r.current!==i||a.current!==o)return;s({open:!0,loading:!1,error:e instanceof Error?e.message:`Failed to load diff`,diff:null})}},[t,n,e]),u=(0,J.useCallback)(()=>{if(o.open){c();return}l()},[c,o.open,l]);return(0,J.useEffect)(()=>{r.current+=1,s({open:!1,loading:!1,error:null,diff:null})},[t,e.agentId,e.file]),(0,J.useEffect)(()=>{!e.diffRequestId||t||i.current===e.diffRequestId||(i.current=e.diffRequestId,l())},[t,l,e.diffRequestId]),{diffState:o,closeDiff:c,toggleDiff:u}}function et({openFile:e,disabled:t,onClearBlameDetail:n,onRevealLine:r}){let i=(0,J.useRef)(0),a=(0,J.useRef)(H(e)),[o,s]=(0,J.useState)(null);a.current=H(e);let c=(0,J.useCallback)(()=>{s(null)},[]),l=(0,J.useCallback)(async(o,c)=>{if(t)return;let l=i.current+1,u=H(e);i.current=l,n(),s(he(o,c)),r(c,{focusEditor:!1});try{let t=await h(e.agentId,e.file.path,c,o);if(i.current!==l||a.current!==u)return;s(me(o,c,t))}catch(e){if(i.current!==l||a.current!==u)return;s(R(o,c,e))}},[t,n,r,e]);return(0,J.useEffect)(()=>{i.current+=1,s(null)},[t,e.agentId,e.file]),{lineChanges:o,openLineChanges:l,closeLineChanges:c}}function tt({editorRef:e,onFocusEditor:t}){(0,J.useEffect)(()=>{if(!window.__FARMING_E2E__)return;let n={focus(){return t(),!!e.current},revealLine(t){let n=e.current,r=n?.getModel();if(!n||!r)return!1;let i=Math.min(Math.max(1,t),r.getLineCount());return n.setPosition({lineNumber:i,column:1}),n.revealLineInCenter(i),n.focus(),!0},insertText(t){let n=e.current,r=n?.getSelection();return!n||!r?!1:(n.pushUndoStop(),n.executeEdits(`farming-e2e`,[{range:r,text:t,forceMoveMarkers:!0}]),n.pushUndoStop(),n.focus(),!0)},undo(){let t=e.current;return t?(t.focus(),t.trigger(`farming-e2e`,`undo`,null),!0):!1},getValue(){return e.current?.getValue()??``},getScrollTop(){return e.current?.getScrollTop()??0},getMarkers(){let t=e.current?.getModel();return t?r.getModelMarkers({resource:t.uri}).map(e=>({code:String(e.code??``),message:e.message,severity:e.severity})):[]},getTypeScriptDiagnosticsOptions(){return a.getDiagnosticsOptions()}};return window.__farmingFileEditorTest=n,()=>{window.__farmingFileEditorTest===n&&delete window.__farmingFileEditorTest}},[e,t])}function nt({openFile:e,openFiles:t,readOnly:n,wordWrapEnabled:i,editorLabel:a,onChangeDraft:o,onFocusFilesSearch:l,onRecordNavigationCursor:u,onSaveShortcut:p,onOpenContextMenuRef:m}){let h=(0,J.useRef)(null),g=(0,J.useRef)(null),_=(0,J.useRef)(new Map),v=(0,J.useRef)(null),y=(0,J.useRef)(new Map),b=(0,J.useRef)(null),x=(0,J.useRef)(null),S=(0,J.useRef)(null),C=(0,J.useRef)(null),w=(0,J.useRef)(null),T=(0,J.useRef)(o),E=(0,J.useRef)(l),D=(0,J.useRef)(u),O=(0,J.useRef)(p),k=(0,J.useRef)(e.agentId),A=(0,J.useRef)(e.file.path),j=(0,J.useRef)(e.workspaceRoot),M=(0,J.useRef)(i),ee=(0,J.useRef)(a),P=(0,J.useRef)(null),F=(0,J.useRef)(0),I=(0,J.useRef)(0),[L,te]=(0,J.useState)({lineNumber:1,column:1});T.current=o,E.current=l,D.current=u,O.current=p,k.current=e.agentId,A.current=e.file.path,j.current=e.workspaceRoot,M.current=i,ee.current=a;let R=(0,J.useCallback)(e=>{let t=e?.getPosition();t&&te(e=>e.lineNumber===t.lineNumber&&e.column===t.column?e:{lineNumber:t.lineNumber,column:t.column})},[]),ne=(0,J.useCallback)(()=>{let e=()=>{let e=g.current;e&&e.focus()};e(),window.requestAnimationFrame(e)},[]),re=(0,J.useCallback)((e,t={})=>{let n=g.current;n&&(n.setPosition({lineNumber:e,column:1}),n.revealLineInCenter(e),t.focusEditor!==!1&&n.focus())},[]),z=(0,J.useCallback)(e=>{if(!e)return;let t=e.getVisibleRanges()[0]?.startLineNumber;if(!t||t<1)return;let n=e.getPosition(),r=j.current||`agent:${k.current}`,i=A.current;c({version:1,surface:`file`,resource:{kind:`file`,workspace:r,path:i},locator:{kind:`file-line`,id:i},position:{unit:`line-column`,value:t,...n?.column?{column:n.column}:{}}})},[]);return tt({editorRef:g,onFocusEditor:ne}),(0,J.useEffect)(()=>{let t=h.current;if(!t)return;Se(),K();let n=r.create(t,q({value:e.draft,language:ye(e.file.path,e.draft),ariaLabel:ee.current,wordWrapEnabled:M.current}));K(n);let i=()=>U(n,M.current),a=xe(),o=()=>i();typeof a.addEventListener==`function`?a.addEventListener(`change`,o):a.addListener(o),i(),g.current=n,b.current=n.onDidChangeModelContent(()=>{F.current>0||T.current(n.getValue())}),x.current=n.onDidChangeCursorPosition(e=>{if(R(n),z(n),I.current>0||e.reason!==r.CursorChangeReason.Explicit||e.source===`api`)return;let t=n.getSelection();D.current?.({agentId:k.current,filePath:A.current,lineNumber:e.position.lineNumber,column:e.position.column,endColumn:t?.endColumn})}),S.current=n.onDidScrollChange(()=>{z(n)}),ve(n,{getAgentId:()=>k.current,onFocusFilesSearch:e=>E.current(e),onSaveShortcut:()=>O.current()}),C.current=n.onContextMenu(e=>m.current(e));let s=e=>{let t=_e(n,e);t&&m.current(t)};t.addEventListener(`contextmenu`,s,!0),w.current=new ResizeObserver(()=>n.layout()),w.current.observe(t);let c=new MutationObserver(()=>K(n));return c.observe(document.body,{attributes:!0,attributeFilter:[`data-appearance`]}),()=>{let e=v.current;e&&_.current.set(e,n.saveViewState()),z(n),w.current?.disconnect(),w.current=null,c.disconnect(),C.current?.dispose(),C.current=null,t.removeEventListener(`contextmenu`,s,!0),typeof a.removeEventListener==`function`?a.removeEventListener(`change`,o):a.removeListener(o),x.current?.dispose(),x.current=null,S.current?.dispose(),S.current=null,b.current?.dispose(),b.current=null,n.dispose(),Ce(),_.current.clear(),g.current=null,v.current=null}},[m,z,R]),(0,J.useEffect)(()=>{let t=g.current;if(!t)return;let n=H(e),r=N(e),i=v.current;i&&i!==n&&_.current.set(i,t.saveViewState());let a=be(e);t.getModel()!==a&&t.setModel(a);let o=y.current.get(n);if((i!==n||o!==r)&&a.getValue()!==e.draft){F.current+=1;try{a.setValue(e.draft)}finally{--F.current}}if(y.current.set(n,r),i!==n){let r=_.current.get(n);if(r)t.restoreViewState(r);else{let n=d(e.workspaceRoot||`agent:${e.agentId}`,e.file.path),r=s(n);r?.surface===`file`&&r.resource.kind===`file`&&r.position.value<=a.getLineCount()?t.revealLineInCenter(r.position.value):r&&f(n)}v.current=n}R(t)},[e,R]),(0,J.useEffect)(()=>{G([...t,e],_.current)},[e,t]),(0,J.useEffect)(()=>{let t=g.current,n=e.cursor;if(!t||!n||P.current===n.requestId)return;let r=t.getModel(),i=oe(n,{lineCount:r?.getLineCount()??1,getLineMaxColumn:e=>r?.getLineMaxColumn(e)??1});I.current+=1;try{t.setSelection(i),t.revealLineInCenter(i.startLineNumber),t.focus()}finally{window.setTimeout(()=>{I.current=Math.max(0,I.current-1)},120)}P.current=n.requestId,te({lineNumber:i.startLineNumber,column:i.startColumn})},[e.cursor,e.file.path]),(0,J.useEffect)(()=>{let e=g.current;e&&e.updateOptions({readOnly:n,domReadOnly:n})},[n]),(0,J.useEffect)(()=>{let e=g.current;e&&U(e,i)},[i]),{editorHostRef:h,editorRef:g,cursorPosition:L,focusEditor:ne,revealLine:re}}function rt({openFile:e,openFiles:t,onCloseEditorTab:n,onFocusEditorTab:r,onFocusFilesSearch:i,onSaveFile:a}){let o=(0,J.useCallback)(e=>{i(e),window.requestAnimationFrame(()=>i(e)),window.setTimeout(()=>i(e),120)},[i]);return(0,J.useCallback)(i=>{if(i.altKey||!(i.ctrlKey||i.metaKey))return;if(i.key.toLowerCase()===`p`){i.preventDefault(),i.stopPropagation(),o(e.agentId);return}if(i.key.toLowerCase()===`s`){i.preventDefault(),i.stopPropagation(),a(!1);return}let s=t.findIndex(t=>H(t)===H(e));if(s!==-1){if(i.key===`PageUp`){i.preventDefault(),i.stopPropagation(),r((s-1+t.length)%t.length);return}if(i.key===`PageDown`){i.preventDefault(),i.stopPropagation(),r((s+1)%t.length);return}i.key.toLowerCase()===`w`&&(i.preventDefault(),i.stopPropagation(),n(s))}},[n,r,a,e,t,o])}function $(e){return H(e)}function it(e){return e.filter((e,t,n)=>n.findIndex(t=>$(t)===$(e))===t)}function at(e,t,n){let r=e[n];if(!r||$(r)!==$(t))return t;let i=e.filter(e=>$(e)!==$(r));return i[Math.max(0,n-1)]??i[n]??null}function ot(e,t,n){let r=new Set(n.map($)),i=e.filter(e=>!r.has($(e)));return i.find(e=>$(e)===$(t))??i[0]??null}function st(e,t){let n=it(e),r=n.filter(E);return{closeFiles:n,dirtyFiles:r,pendingClose:r.length>0?{files:r,closeFiles:n,nextFocusFile:t}:null,nextFocusFile:t}}function ct(e){return e.nextFocusFile&&e.closeFiles.some(t=>$(t)===$(e.nextFocusFile))?null:e.nextFocusFile}function lt(e,t,n){if(e===`close`){let e=t[n];return e?[e]:[]}return e===`close-others`?t.filter((e,t)=>t!==n):e===`close-right`?t.slice(n+1):e===`close-saved`?t.filter(O):[...t]}function ut({openFile:e,openFiles:t,filesLabel:n,onSelectOpenFile:r,onCloseOpenFile:i,onCloseOpenFiles:a,onDismissEditorContextMenu:o,onSaveOpenFile:s}){let c=(0,J.useRef)(new Map),l=(0,J.useRef)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=(0,J.useCallback)(()=>{d(null)},[]),_=(0,J.useCallback)((e,t)=>{t?c.current.set(e,t):c.current.delete(e)},[]),v=(0,J.useCallback)(e=>{let n=t[e];n&&(l.current=H(n),r(n.agentId,n.file.path))},[r,t]),y=(0,J.useCallback)((e,t)=>{if(e.length===0)return;let n=e.map(e=>({agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot}));if(l.current=t?H(t):null,n.length===1){let e=n[0];e&&i(e.agentId,e.filePath,e.workspaceRoot);return}a(n)},[i,a]),b=(0,J.useCallback)((e,t)=>{let n=st(e,t),r=n.closeFiles;if(r.length!==0){if(n.pendingClose){p(n.pendingClose),h(!1);return}y(r,n.nextFocusFile)}},[y]),x=(0,J.useCallback)(n=>{let r=t[n];r&&b([r],at(t,e,n))},[e,t,b]),S=(0,J.useCallback)(n=>{b(n,ot(t,e,n))},[e,t,b]),C=(0,J.useCallback)((e,n)=>{e.preventDefault(),e.stopPropagation();let i=t[n];i&&r(i.agentId,i.file.path),o(),d({x:Math.max(8,Math.min(e.clientX,window.innerWidth-230)),y:Math.max(8,Math.min(e.clientY,window.innerHeight-190)),index:n})},[o,r,t]),w=(0,J.useCallback)(e=>{if(!u)return;let n=u.index;if(d(null),e===`close`){x(n);return}S(lt(e,t,n))},[x,S,t,u]),T=(0,J.useCallback)((e,n)=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`ArrowLeft`){e.preventDefault(),v((n-1+t.length)%t.length);return}if(e.key===`ArrowRight`){e.preventDefault(),v((n+1)%t.length);return}if(e.key===`Home`){e.preventDefault(),v(0);return}if(e.key===`End`){e.preventDefault(),v(t.length-1);return}if(e.key===`Enter`||e.key===` `){e.preventDefault(),v(n);return}(e.key===`Delete`||e.key===`Backspace`)&&(e.preventDefault(),x(n))}},[x,v,t.length]),E=(0,J.useCallback)((e,t)=>{e.button===1&&(e.preventDefault(),e.stopPropagation(),x(t))},[x]),D=(0,J.useCallback)(async()=>{if(!f||m)return;h(!0);for(let e of f.files)if(!await s(e,!1)){h(!1);return}let e=ct(f),t=f.closeFiles;p(null),h(!1),y(t,e)},[y,s,f,m]),O=(0,J.useCallback)(()=>{if(!f)return;let e=ct(f),t=f.closeFiles;p(null),h(!1),y(t,e)},[y,f]),k=(0,J.useCallback)(()=>{p(null),h(!1)},[]),A=(0,J.useMemo)(()=>f?f.files.length===1?B(f.files[0]?.file.path??``):`${f.files.length} ${n}`:``,[n,f]);return(0,J.useEffect)(()=>{let t=H(e),n=c.current.get(t);n?.scrollIntoView({block:`nearest`,inline:`nearest`}),l.current===t&&(n?.focus(),l.current=null)},[e,t.length]),{tabContextMenu:u,pendingClose:f,pendingCloseSaving:m,pendingCloseLabel:A,closeTabContextMenu:g,setTabRef:_,focusEditorTab:v,closeEditorTab:x,openEditorTabContextMenu:C,runTabContextAction:w,handleEditorTabKeyDown:T,handleEditorTabAuxClick:E,confirmSaveAndClose:D,discardAndClose:O,cancelPendingClose:k}}var dt=1;function ft(){let e=dt;return dt+=1,e}function pt({openFile:e,readOnly:t,onUpdateOpenFile:n}){let r=(0,J.useCallback)(async(e,t=!1)=>{if(A(e))return!0;let r={agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot},i=ft(),a=n(r,e=>e.saving||!t&&!e.dirty?e:u(e,i));if(!a)return!1;if(a.saveRequestId!==i)return!a.dirty&&!a.saving;let s={...r,saveRequestId:i};try{let e=await S(a.agentId,a.file.path,a.draft,a.file.sha1,t),r=n(s,t=>o(t,i,e));return!!(r&&!r.dirty)}catch(e){let t=e instanceof y&&e.status===409;if(!(e instanceof y)||e.status>=500)try{let e=await x(a.agentId,a.file.path);if(e.content===a.draft){let t=n(s,t=>o(t,i,e));return!!(t&&!t.dirty)}}catch{}return n(s,n=>l(n,i,e instanceof Error?e.message:`Failed to save file`,t)),!1}},[n]);return{saveOpenWorkspaceFile:r,saveFile:(0,J.useCallback)(async(n=!1)=>{t||await r(e,n)},[e,t,r]),reloadFile:(0,J.useCallback)(async()=>{let t={agentId:e.agentId,filePath:e.file.path,workspaceRoot:e.workspaceRoot},r=ft(),i=n(t,e=>e.saving?e:u(e,r));if(!i||i.saveRequestId!==r)return;let a={...t,saveRequestId:r};try{let e=await x(i.agentId,i.file.path,{exactExternal:i.exactExternal});n(a,t=>o(t,r,e))}catch(e){n(a,t=>l(t,r,e instanceof Error?e.message:`Failed to reload file`,!1))}},[n,e])}}var mt=``,ht=`farming.code.fileEditor.wordWrap`;function gt(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(ht)===`1`}catch{return!1}}function _t(e){if(!(typeof window>`u`))try{window.localStorage.setItem(ht,e?`1`:`0`)}catch{}}function vt({openFile:e,openFiles:t,onChangeDraft:n,onUpdateOpenFile:r,onSelectOpenFile:i,onOpenFilePath:a,canNavigateBack:o,canNavigateForward:s,onNavigateHistory:c,onCloseOpenFile:l,onCloseOpenFiles:u,onRevealInExplorer:d,onFocusFilesSearch:f,onRecordNavigationCursor:p,onBackToAgent:m,copy:h}){let g=(0,J.useRef)(()=>{}),_=(0,J.useRef)(()=>{}),v=ee(e),y=ae(e),[b,x]=(0,J.useState)({}),[S,C]=(0,J.useState)({}),[T,E]=(0,J.useState)(gt),D=H(e),O=!y.preview&&!y.diffOnly&&ne(e.file.path),k=!y.preview&&!y.diffOnly&&de(e.file.path),A=b[D],j=O||k?A!==!1:!1,M=O&&j,N=M&&S[D]===!0,P=M&&!N,F=k&&j,I=!y.canEditText||w(e.agentId)||e.file.readOnly===!0,L=y.canShowBlame&&e.file.external!==!0,R=y.canShowLineChanges&&e.file.external!==!0,{saveOpenWorkspaceFile:re,saveFile:z,reloadFile:ie}=pt({openFile:e,readOnly:I,onUpdateOpenFile:r}),{tabContextMenu:oe,pendingClose:se,pendingCloseSaving:ce,pendingCloseLabel:le,closeTabContextMenu:ue,setTabRef:B,focusEditorTab:fe,closeEditorTab:V,openEditorTabContextMenu:me,runTabContextAction:he,handleEditorTabKeyDown:ge,handleEditorTabAuxClick:_e,confirmSaveAndClose:ve,discardAndClose:ye,cancelPendingClose:be}=ut({openFile:e,openFiles:t,filesLabel:h.files,onSelectOpenFile:i,onCloseOpenFile:l,onCloseOpenFiles:u,onDismissEditorContextMenu:()=>_.current(),onSaveOpenFile:re}),xe=rt({openFile:e,openFiles:t,onCloseEditorTab:V,onFocusEditorTab:fe,onFocusFilesSearch:f,onSaveFile:z}),{editorHostRef:U,editorRef:W,cursorPosition:Se,revealLine:Ce}=nt({openFile:e,openFiles:t,readOnly:I,wordWrapEnabled:T,editorLabel:h.editorFor(e.file.path),onChangeDraft:n,onFocusFilesSearch:f,onRecordNavigationCursor:p,onSaveShortcut:()=>{z(!1)},onOpenContextMenuRef:g}),{blameOpen:G,blameLoading:K,blame:q,blameError:we,blameCapability:Te,blameDetail:X,blameLabelWidths:Ee,checkBlameCapability:De,toggleBlame:Oe,showBlameDetail:ke,clearBlameDetail:Z}=Xe({openFile:e,disabled:!L,onRevealLine:Ce}),{lineChanges:Ae,openLineChanges:je,closeLineChanges:Me}=et({openFile:e,disabled:!R,onClearBlameDetail:Z,onRevealLine:Ce}),{diffState:Q,closeDiff:Pe,toggleDiff:Fe}=$e({openFile:e,diffDisabled:!y.canShowDiff,onClearBlameDetail:Z}),Ie=P&&!Q.open,{blameOverlay:Re}=Ze({blame:q,blameLabelWidths:Ee,blameOpen:G,editorHostRef:U,editorRef:W,disabled:!L}),{editorContextMenu:ze,closeEditorContextMenu:Be,openEditorContextMenu:Ve,runEditorContextAction:He,showBlameContextAction:Ue,showLineChangesContextActions:We}=Qe({blameCapability:Te,blameOpen:G,canShowBlame:L,canShowLineChanges:R,editorRef:W,readOnly:I,onCheckBlameCapability:De,onClearBlameDetail:Z,onCloseTabContextMenu:ue,onOpenLineChanges:je,onToggleBlame:Oe});g.current=Ve,_.current=Be;let Ge=te(e)===`changedOnDisk`?h.changedOnDisk:null,Ke=X?pe(X.line.author,mt):``;return(0,J.useEffect)(()=>{if(!(typeof document>`u`))return document.body.classList.toggle(`code-mobile-markdown-reading`,M),()=>{document.body.classList.remove(`code-mobile-markdown-reading`)}},[M]),(0,J.useEffect)(()=>{let e=W.current;if(!e)return;let t=window.requestAnimationFrame(()=>e.layout());return()=>window.cancelAnimationFrame(t)},[W,N,P,j]),(0,Y.jsxs)(`section`,{className:`code-file-editor ${M?`markdown-reading`:``}`.trim(),"data-testid":`code-file-editor`,onKeyDownCapture:xe,children:[(0,Y.jsx)(Ne,{openFile:e,openFiles:t,editorMode:y,copy:h,statusText:Ge,onBackToAgent:m,onSelectOpenFile:i,canNavigateBack:o,canNavigateForward:s,onNavigateHistory:c,onSetTabRef:B,onOpenTabContextMenu:me,onTabAuxClick:_e,onTabKeyDown:ge,onCloseTab:V,onRevealInExplorer:d,onSave:z,onReload:ie,onToggleSourcePreview:()=>{if(!O&&!k)return;let e=!j;x(t=>({...t,[D]:e})),O&&!e&&C(e=>({...e,[D]:!1}))},onToggleMarkdownSplit:()=>{O&&(x(e=>({...e,[D]:!0})),C(e=>({...e,[D]:!N})))},onToggleWordWrap:()=>{E(e=>{let t=!e;return _t(t),t})},onToggleDiff:Fe,canPreviewMarkdown:O,canPreviewSource:k,diffOpen:Q.open,markdownPreviewVisible:Ie,markdownSplitOpen:N,sourcePreviewOpen:j,wordWrapEnabled:T}),e.error&&(0,Y.jsx)(`div`,{className:`code-file-editor-alert`,"data-testid":`code-file-editor-alert`,children:e.error}),(0,Y.jsx)(Je,{activeTabDomId:v,blame:q,blameAuthorProfileUrl:Ke,blameDetailLine:X?.line??null,blameOpen:G,blameOverlay:Re,copy:h,cursorPosition:Se,diffState:Q,editorMode:y,editorHostRef:U,lineChanges:Ae,markdownSplitOpen:N,markdownPreviewOpen:P,sourcePreviewOpen:F,openFile:e,onClearBlameDetail:Z,onCloseDiff:Pe,onCloseLineChanges:Me,onOpenFilePath:a,onShowBlameDetail:ke}),(0,Y.jsx)(Le,{blame:q,blameError:we,blameLoading:K,blameOpen:G,copy:h,editorContextMenu:ze,readOnly:I,openFiles:t,pendingCloseOpen:!!se,pendingCloseLabel:le,pendingCloseSaving:ce,showBlameContextAction:Ue,showLineChangesContextActions:We,tabContextMenu:oe,onCancelPendingClose:be,onCloseEditorContextMenu:Be,onConfirmSaveAndClose:ve,onDiscardAndClose:ye,onRunEditorContextAction:He,onRunTabContextAction:he})]})}export{vt as FileEditorPane};
|