@tom2012/cc-web 1.5.33 → 1.5.34
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/README.md +1 -1
- package/frontend/dist/assets/{index-Bu8tNK3Q.js → index-8diGU2NE.js} +1 -1
- package/frontend/dist/assets/{index-D4tLJwVT.js → index-B-wMwBVN.js} +5 -5
- package/frontend/dist/assets/index-Hr2XDpOR.css +32 -0
- package/frontend/dist/assets/{jszip.min-CwNvmrBU.js → jszip.min-CtbQrs-f.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-BJgG8u4U.css +0 -32
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-8diGU2NE.js","assets/jszip.min-CtbQrs-f.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function aL(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var $c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sY(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var eC={exports:{}},Fu={},tC={exports:{}},Se={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -476,7 +476,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
476
476
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
477
477
|
* http://bellard.org/jslinux/
|
|
478
478
|
* Copyright (c) 2011 Fabrice Bellard
|
|
479
|
-
*/var G$=2,W$=1,V$=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},o=a.top+a.bottom,l=a.right+a.left,c=r-o,d=i-l-t;return{cols:Math.max(G$,Math.floor(d/e.css.cell.width)),rows:Math.max(W$,Math.floor(c/e.css.cell.height))}}};const yk={background:"#09090b",foreground:"#e4e4e7",cursor:"#a1a1aa",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#18181b",brightBlack:"#3f3f46",red:"#ef4444",brightRed:"#f87171",green:"#22c55e",brightGreen:"#4ade80",yellow:"#eab308",brightYellow:"#facc15",blue:"#3b82f6",brightBlue:"#60a5fa",magenta:"#a855f7",brightMagenta:"#c084fc",cyan:"#06b6d4",brightCyan:"#22d3ee",white:"#e4e4e7",brightWhite:"#f4f4f5"},_k={background:"#ffffff",foreground:"#1c1c1c",cursor:"#6b7280",cursorAccent:"#ffffff",selectionBackground:"#d1d5db",black:"#1c1c1c",brightBlack:"#6b7280",red:"#dc2626",brightRed:"#ef4444",green:"#16a34a",brightGreen:"#22c55e",yellow:"#ca8a04",brightYellow:"#eab308",blue:"#2563eb",brightBlue:"#3b82f6",magenta:"#9333ea",brightMagenta:"#a855f7",cyan:"#0891b2",brightCyan:"#06b6d4",white:"#e5e7eb",brightWhite:"#f9fafb"},xN=b.forwardRef(({onInput:e,onResize:t,onReady:n},r)=>{const i=b.useRef(null),s=b.useRef(null),a=b.useRef(null),o=b.useRef(e),l=b.useRef(t),c=b.useRef(n),d=b.useRef(!1),u=b.useRef(null);o.current=e,l.current=t,c.current=n;const{resolved:p}=jm();return b.useImperativeHandle(r,()=>({write:f=>{var g;(g=s.current)==null||g.write(f)}})),b.useEffect(()=>{if(!i.current)return;const f=new H$({theme:p==="dark"?yk:_k,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace',fontSize:13,lineHeight:1.5,cursorBlink:!0,convertEol:!1,scrollback:5e3,allowProposedApi:!0}),g=new V$;f.loadAddon(g),f.open(i.current),requestAnimationFrame(()=>{var _;g.fit();const{cols:v,rows:y}=f;d.current||(d.current=!0,(_=c.current)==null||_.call(c,v,y)),l.current(v,y)}),s.current=f,a.current=g,u.current=p,f.onData(v=>{o.current(v)});const m=new ResizeObserver(()=>{requestAnimationFrame(()=>{g.fit(),l.current(f.cols,f.rows)})});return m.observe(i.current),()=>{m.disconnect(),f.dispose(),s.current=null,a.current=null}},[]),b.useEffect(()=>{const f=s.current;if(!f||u.current===p)return;u.current=p,f.options.theme=p==="dark"?yk:_k;const g=p==="dark"?"dark":"light";o.current(`/theme ${g}\r`)},[p]),h.jsx("div",{ref:i,className:"h-full w-full bg-background",style:{overflow:"hidden",padding:"4px"}})});xN.displayName="WebTerminal";function vk(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function q$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const K$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X$={};function Sk(e,t){return(X$.jsx?Y$:K$).test(e)}const Z$=/[ \t\n\f\r]/g;function Q$(e){return typeof e=="object"?e.type==="text"?wk(e.value):!1:wk(e)}function wk(e){return e.replace(Z$,"")===""}class yl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}yl.prototype.normal={};yl.prototype.property={};yl.prototype.space=void 0;function EN(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new yl(n,r,t)}function Xo(e){return e.toLowerCase()}class Qt{constructor(t,n){this.attribute=n,this.property=t}}Qt.prototype.attribute="";Qt.prototype.booleanish=!1;Qt.prototype.boolean=!1;Qt.prototype.commaOrSpaceSeparated=!1;Qt.prototype.commaSeparated=!1;Qt.prototype.defined=!1;Qt.prototype.mustUseProperty=!1;Qt.prototype.number=!1;Qt.prototype.overloadedBoolean=!1;Qt.prototype.property="";Qt.prototype.spaceSeparated=!1;Qt.prototype.space=void 0;let J$=0;const fe=gs(),Ze=gs(),ng=gs(),q=gs(),Ie=gs(),Qs=gs(),nn=gs();function gs(){return 2**++J$}const rg=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Ze,commaOrSpaceSeparated:nn,commaSeparated:Qs,number:q,overloadedBoolean:ng,spaceSeparated:Ie},Symbol.toStringTag,{value:"Module"})),$h=Object.keys(rg);class Xm extends Qt{constructor(t,n,r,i){let s=-1;if(super(t,n),xk(this,"space",i),typeof r=="number")for(;++s<$h.length;){const a=$h[s];xk(this,$h[s],(r&rg[a])===rg[a])}}}Xm.prototype.defined=!0;function xk(e,t,n){n&&(e[t]=n)}function wa(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Xm(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Xo(r)]=r,n[Xo(s.attribute)]=r}return new yl(t,n,e.space)}const kN=wa({properties:{ariaActiveDescendant:null,ariaAtomic:Ze,ariaAutoComplete:null,ariaBusy:Ze,ariaChecked:Ze,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:Ie,ariaCurrent:null,ariaDescribedBy:Ie,ariaDetails:null,ariaDisabled:Ze,ariaDropEffect:Ie,ariaErrorMessage:null,ariaExpanded:Ze,ariaFlowTo:Ie,ariaGrabbed:Ze,ariaHasPopup:null,ariaHidden:Ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ie,ariaLevel:q,ariaLive:null,ariaModal:Ze,ariaMultiLine:Ze,ariaMultiSelectable:Ze,ariaOrientation:null,ariaOwns:Ie,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:Ze,ariaReadOnly:Ze,ariaRelevant:null,ariaRequired:Ze,ariaRoleDescription:Ie,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:Ze,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CN(e,t){return t in e?e[t]:t}function TN(e,t){return CN(e,t.toLowerCase())}const ez=wa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qs,acceptCharset:Ie,accessKey:Ie,action:null,allow:null,allowFullScreen:fe,allowPaymentRequest:fe,allowUserMedia:fe,alt:null,as:null,async:fe,autoCapitalize:null,autoComplete:Ie,autoFocus:fe,autoPlay:fe,blocking:Ie,capture:null,charSet:null,checked:fe,cite:null,className:Ie,cols:q,colSpan:null,content:null,contentEditable:Ze,controls:fe,controlsList:Ie,coords:q|Qs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:fe,defer:fe,dir:null,dirName:null,disabled:fe,download:ng,draggable:Ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:fe,formTarget:null,headers:Ie,height:q,hidden:ng,high:q,href:null,hrefLang:null,htmlFor:Ie,httpEquiv:Ie,id:null,imageSizes:null,imageSrcSet:null,inert:fe,inputMode:null,integrity:null,is:null,isMap:fe,itemId:null,itemProp:Ie,itemRef:Ie,itemScope:fe,itemType:Ie,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:fe,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:fe,muted:fe,name:null,nonce:null,noModule:fe,noValidate:fe,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:fe,optimum:q,pattern:null,ping:Ie,placeholder:null,playsInline:fe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:fe,referrerPolicy:null,rel:Ie,required:fe,reversed:fe,rows:q,rowSpan:q,sandbox:Ie,scope:null,scoped:fe,seamless:fe,selected:fe,shadowRootClonable:fe,shadowRootDelegatesFocus:fe,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:Ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:fe,useMap:null,value:Ze,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ie,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:fe,declare:fe,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:fe,noHref:fe,noShade:fe,noWrap:fe,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:Ze,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:fe,disableRemotePlayback:fe,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:TN}),tz=wa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:nn,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:Ie,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:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:fe,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,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:Qs,g2:Qs,glyphName:Qs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,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:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ie,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nn,rev:nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nn,requiredFeatures:nn,requiredFonts:nn,requiredFormats:nn,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:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nn,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CN}),AN=wa({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()}}),NN=wa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TN}),RN=wa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nz={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"},rz=/[A-Z]/g,Ek=/-[a-z]/g,iz=/^data[-\w.:]+$/i;function IN(e,t){const n=Xo(t);let r=t,i=Qt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iz.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ek,az);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ek.test(s)){let a=s.replace(rz,sz);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Xm}return new i(r,t)}function sz(e){return"-"+e.toLowerCase()}function az(e){return e.charAt(1).toUpperCase()}const ON=EN([kN,ez,AN,NN,RN],"html"),bd=EN([kN,tz,AN,NN,RN],"svg");function kk(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function oz(e){return e.join(" ").trim()}var Zm={},Ck=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,lz=/\n/g,cz=/^\s*/,uz=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,dz=/^:\s*/,hz=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pz=/^[;\s]*/,fz=/^\s+|\s+$/g,gz=`
|
|
479
|
+
*/var G$=2,W$=1,V$=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},o=a.top+a.bottom,l=a.right+a.left,c=r-o,d=i-l-t;return{cols:Math.max(G$,Math.floor(d/e.css.cell.width)),rows:Math.max(W$,Math.floor(c/e.css.cell.height))}}};const yk={background:"#09090b",foreground:"#e4e4e7",cursor:"#a1a1aa",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#18181b",brightBlack:"#3f3f46",red:"#ef4444",brightRed:"#f87171",green:"#22c55e",brightGreen:"#4ade80",yellow:"#eab308",brightYellow:"#facc15",blue:"#3b82f6",brightBlue:"#60a5fa",magenta:"#a855f7",brightMagenta:"#c084fc",cyan:"#06b6d4",brightCyan:"#22d3ee",white:"#e4e4e7",brightWhite:"#f4f4f5"},_k={background:"#ffffff",foreground:"#1c1c1c",cursor:"#6b7280",cursorAccent:"#ffffff",selectionBackground:"#d1d5db",black:"#1c1c1c",brightBlack:"#6b7280",red:"#dc2626",brightRed:"#ef4444",green:"#16a34a",brightGreen:"#22c55e",yellow:"#ca8a04",brightYellow:"#eab308",blue:"#2563eb",brightBlue:"#3b82f6",magenta:"#9333ea",brightMagenta:"#a855f7",cyan:"#0891b2",brightCyan:"#06b6d4",white:"#e5e7eb",brightWhite:"#f9fafb"},xN=b.forwardRef(({onInput:e,onResize:t,onReady:n},r)=>{const i=b.useRef(null),s=b.useRef(null),a=b.useRef(null),o=b.useRef(e),l=b.useRef(t),c=b.useRef(n),d=b.useRef(!1),u=b.useRef(null);o.current=e,l.current=t,c.current=n;const{resolved:p}=jm();return b.useImperativeHandle(r,()=>({write:f=>{var g;(g=s.current)==null||g.write(f)}})),b.useEffect(()=>{if(!i.current)return;const f=new H$({theme:p==="dark"?yk:_k,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace',fontSize:13,lineHeight:1.5,cursorBlink:!0,convertEol:!1,scrollback:5e3,allowProposedApi:!0}),g=new V$;f.loadAddon(g),f.open(i.current),requestAnimationFrame(()=>{var _;g.fit();const{cols:v,rows:y}=f;d.current||(d.current=!0,(_=c.current)==null||_.call(c,v,y)),l.current(v,y)}),s.current=f,a.current=g,u.current=p,f.onData(v=>{o.current(v)});const m=new ResizeObserver(()=>{requestAnimationFrame(()=>{!i.current||i.current.offsetParent===null||(g.fit(),l.current(f.cols,f.rows))})});return m.observe(i.current),()=>{m.disconnect(),f.dispose(),s.current=null,a.current=null}},[]),b.useEffect(()=>{const f=s.current;if(!f||u.current===p)return;u.current=p,f.options.theme=p==="dark"?yk:_k;const g=p==="dark"?"dark":"light";o.current(`/theme ${g}\r`)},[p]),h.jsx("div",{ref:i,className:"h-full w-full bg-background",style:{overflow:"hidden",padding:"4px"}})});xN.displayName="WebTerminal";function vk(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function q$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const K$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X$={};function Sk(e,t){return(X$.jsx?Y$:K$).test(e)}const Z$=/[ \t\n\f\r]/g;function Q$(e){return typeof e=="object"?e.type==="text"?wk(e.value):!1:wk(e)}function wk(e){return e.replace(Z$,"")===""}class yl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}yl.prototype.normal={};yl.prototype.property={};yl.prototype.space=void 0;function EN(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new yl(n,r,t)}function Xo(e){return e.toLowerCase()}class Qt{constructor(t,n){this.attribute=n,this.property=t}}Qt.prototype.attribute="";Qt.prototype.booleanish=!1;Qt.prototype.boolean=!1;Qt.prototype.commaOrSpaceSeparated=!1;Qt.prototype.commaSeparated=!1;Qt.prototype.defined=!1;Qt.prototype.mustUseProperty=!1;Qt.prototype.number=!1;Qt.prototype.overloadedBoolean=!1;Qt.prototype.property="";Qt.prototype.spaceSeparated=!1;Qt.prototype.space=void 0;let J$=0;const fe=gs(),Ze=gs(),ng=gs(),q=gs(),Ie=gs(),Qs=gs(),nn=gs();function gs(){return 2**++J$}const rg=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Ze,commaOrSpaceSeparated:nn,commaSeparated:Qs,number:q,overloadedBoolean:ng,spaceSeparated:Ie},Symbol.toStringTag,{value:"Module"})),$h=Object.keys(rg);class Xm extends Qt{constructor(t,n,r,i){let s=-1;if(super(t,n),xk(this,"space",i),typeof r=="number")for(;++s<$h.length;){const a=$h[s];xk(this,$h[s],(r&rg[a])===rg[a])}}}Xm.prototype.defined=!0;function xk(e,t,n){n&&(e[t]=n)}function wa(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Xm(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Xo(r)]=r,n[Xo(s.attribute)]=r}return new yl(t,n,e.space)}const kN=wa({properties:{ariaActiveDescendant:null,ariaAtomic:Ze,ariaAutoComplete:null,ariaBusy:Ze,ariaChecked:Ze,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:Ie,ariaCurrent:null,ariaDescribedBy:Ie,ariaDetails:null,ariaDisabled:Ze,ariaDropEffect:Ie,ariaErrorMessage:null,ariaExpanded:Ze,ariaFlowTo:Ie,ariaGrabbed:Ze,ariaHasPopup:null,ariaHidden:Ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ie,ariaLevel:q,ariaLive:null,ariaModal:Ze,ariaMultiLine:Ze,ariaMultiSelectable:Ze,ariaOrientation:null,ariaOwns:Ie,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:Ze,ariaReadOnly:Ze,ariaRelevant:null,ariaRequired:Ze,ariaRoleDescription:Ie,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:Ze,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CN(e,t){return t in e?e[t]:t}function TN(e,t){return CN(e,t.toLowerCase())}const ez=wa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qs,acceptCharset:Ie,accessKey:Ie,action:null,allow:null,allowFullScreen:fe,allowPaymentRequest:fe,allowUserMedia:fe,alt:null,as:null,async:fe,autoCapitalize:null,autoComplete:Ie,autoFocus:fe,autoPlay:fe,blocking:Ie,capture:null,charSet:null,checked:fe,cite:null,className:Ie,cols:q,colSpan:null,content:null,contentEditable:Ze,controls:fe,controlsList:Ie,coords:q|Qs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:fe,defer:fe,dir:null,dirName:null,disabled:fe,download:ng,draggable:Ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:fe,formTarget:null,headers:Ie,height:q,hidden:ng,high:q,href:null,hrefLang:null,htmlFor:Ie,httpEquiv:Ie,id:null,imageSizes:null,imageSrcSet:null,inert:fe,inputMode:null,integrity:null,is:null,isMap:fe,itemId:null,itemProp:Ie,itemRef:Ie,itemScope:fe,itemType:Ie,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:fe,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:fe,muted:fe,name:null,nonce:null,noModule:fe,noValidate:fe,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:fe,optimum:q,pattern:null,ping:Ie,placeholder:null,playsInline:fe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:fe,referrerPolicy:null,rel:Ie,required:fe,reversed:fe,rows:q,rowSpan:q,sandbox:Ie,scope:null,scoped:fe,seamless:fe,selected:fe,shadowRootClonable:fe,shadowRootDelegatesFocus:fe,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:Ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:fe,useMap:null,value:Ze,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ie,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:fe,declare:fe,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:fe,noHref:fe,noShade:fe,noWrap:fe,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:Ze,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:fe,disableRemotePlayback:fe,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:TN}),tz=wa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:nn,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:Ie,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:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:fe,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,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:Qs,g2:Qs,glyphName:Qs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,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:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ie,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nn,rev:nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nn,requiredFeatures:nn,requiredFonts:nn,requiredFormats:nn,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:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nn,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CN}),AN=wa({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()}}),NN=wa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:TN}),RN=wa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nz={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"},rz=/[A-Z]/g,Ek=/-[a-z]/g,iz=/^data[-\w.:]+$/i;function IN(e,t){const n=Xo(t);let r=t,i=Qt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iz.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ek,az);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ek.test(s)){let a=s.replace(rz,sz);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Xm}return new i(r,t)}function sz(e){return"-"+e.toLowerCase()}function az(e){return e.charAt(1).toUpperCase()}const ON=EN([kN,ez,AN,NN,RN],"html"),bd=EN([kN,tz,AN,NN,RN],"svg");function kk(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function oz(e){return e.join(" ").trim()}var Zm={},Ck=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,lz=/\n/g,cz=/^\s*/,uz=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,dz=/^:\s*/,hz=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pz=/^[;\s]*/,fz=/^\s+|\s+$/g,gz=`
|
|
480
480
|
`,Tk="/",Ak="*",Oi="",mz="comment",bz="declaration";function yz(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var m=g.match(lz);m&&(n+=m.length);var v=g.lastIndexOf(gz);r=~v?g.length-v:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new a(g),c(),m}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(g){var m=new Error(t.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(g){var m=g.exec(e);if(m){var v=m[0];return i(v),e=e.slice(v.length),m}}function c(){l(cz)}function d(g){var m;for(g=g||[];m=u();)m!==!1&&g.push(m);return g}function u(){var g=s();if(!(Tk!=e.charAt(0)||Ak!=e.charAt(1))){for(var m=2;Oi!=e.charAt(m)&&(Ak!=e.charAt(m)||Tk!=e.charAt(m+1));)++m;if(m+=2,Oi===e.charAt(m-1))return o("End of comment missing");var v=e.slice(2,m-2);return r+=2,i(v),e=e.slice(m),r+=2,g({type:mz,comment:v})}}function p(){var g=s(),m=l(uz);if(m){if(u(),!l(dz))return o("property missing ':'");var v=l(hz),y=g({type:bz,property:Nk(m[0].replace(Ck,Oi)),value:v?Nk(v[0].replace(Ck,Oi)):Oi});return l(pz),y}}function f(){var g=[];d(g);for(var m;m=p();)m!==!1&&(g.push(m),d(g));return g}return c(),f()}function Nk(e){return e?e.replace(fz,Oi):Oi}var _z=yz,vz=$c&&$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.default=wz;const Sz=vz(_z);function wz(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Sz.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:o}=s;i?t(a,o,s):o&&(n=n||{},n[a]=o)}),n}var yd={};Object.defineProperty(yd,"__esModule",{value:!0});yd.camelCase=void 0;var xz=/^--[a-zA-Z0-9_-]+$/,Ez=/-([a-z])/g,kz=/^[^-]+$/,Cz=/^-(webkit|moz|ms|o|khtml)-/,Tz=/^-(ms)-/,Az=function(e){return!e||kz.test(e)||xz.test(e)},Nz=function(e,t){return t.toUpperCase()},Rk=function(e,t){return"".concat(t,"-")},Rz=function(e,t){return t===void 0&&(t={}),Az(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Tz,Rk):e=e.replace(Cz,Rk),e.replace(Ez,Nz))};yd.camelCase=Rz;var Iz=$c&&$c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Oz=Iz(Zm),Lz=yd;function ig(e,t){var n={};return!e||typeof e!="string"||(0,Oz.default)(e,function(r,i){r&&i&&(n[(0,Lz.camelCase)(r,t)]=i)}),n}ig.default=ig;var Dz=ig;const Mz=Pu(Dz),LN=DN("end"),Qm=DN("start");function DN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Pz(e){const t=Qm(e),n=LN(e);if(t&&n)return{start:t,end:n}}function wo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ik(e.position):"start"in e||"end"in e?Ik(e):"line"in e||"column"in e?sg(e):""}function sg(e){return Ok(e&&e.line)+":"+Ok(e&&e.column)}function Ik(e){return sg(e&&e.start)+"-"+sg(e&&e.end)}function Ok(e){return e&&typeof e=="number"?e:1}class Ot extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=wo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ot.prototype.file="";Ot.prototype.name="";Ot.prototype.reason="";Ot.prototype.message="";Ot.prototype.stack="";Ot.prototype.column=void 0;Ot.prototype.line=void 0;Ot.prototype.ancestors=void 0;Ot.prototype.cause=void 0;Ot.prototype.fatal=void 0;Ot.prototype.place=void 0;Ot.prototype.ruleId=void 0;Ot.prototype.source=void 0;const Jm={}.hasOwnProperty,Fz=new Map,Bz=/[A-Z]/g,jz=new Set(["table","tbody","thead","tfoot","tr"]),Uz=new Set(["td","th"]),MN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $z(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Yz(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Kz(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?bd:ON,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=PN(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function PN(e,t,n){if(t.type==="element")return zz(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Hz(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Wz(e,t,n);if(t.type==="mdxjsEsm")return Gz(e,t);if(t.type==="root")return Vz(e,t,n);if(t.type==="text")return qz(e,t)}function zz(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=bd,e.schema=i),e.ancestors.push(t);const s=BN(e,t.tagName,!1),a=Xz(e,t);let o=tb(e,t);return jz.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Q$(l):!0})),FN(e,a,s,t),eb(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Hz(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Zo(e,t.position)}function Gz(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zo(e,t.position)}function Wz(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=bd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:BN(e,t.name,!0),a=Zz(e,t),o=tb(e,t);return FN(e,a,s,t),eb(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function Vz(e,t,n){const r={};return eb(r,tb(e,t)),e.create(t,e.Fragment,r,n)}function qz(e,t){return t.value}function FN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function eb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Kz(e,t,n){return r;function r(i,s,a,o){const c=Array.isArray(a.children)?n:t;return o?c(s,a,o):c(s,a)}}function Yz(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=Qm(r);return t(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Xz(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Jm.call(t.properties,i)){const s=Qz(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Uz.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Zz(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Zo(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else Zo(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function tb(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Fz;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const o=PN(e,s,a);o!==void 0&&n.push(o)}return n}function Qz(e,t,n){const r=IN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?q$(n):oz(n)),r.property==="style"){let i=typeof n=="object"?n:Jz(e,String(n));return e.stylePropertyNameCase==="css"&&(i=e4(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?nz[r.property]||r.property:r.attribute,n]}}function Jz(e,t){try{return Mz(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ot("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=MN+"#cannot-parse-style-attribute",i}}function BN(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const o=Sk(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=Sk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Jm.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zo(e)}function Zo(e,t){const n=new Ot("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=MN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function e4(e){const t={};let n;for(n in e)Jm.call(e,n)&&(t[t4(n)]=e[n]);return t}function t4(e){let t=e.replace(Bz,n4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function n4(e){return"-"+e.toLowerCase()}const zh={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"]},r4={};function nb(e,t){const n=r4,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return jN(e,r,i)}function jN(e,t,n){if(i4(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 Lk(e.children,t,n)}return Array.isArray(e)?Lk(e,t,n):""}function Lk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=jN(e[i],t,n);return r.join("")}function i4(e){return!!(e&&typeof e=="object")}const Dk=document.createElement("i");function Qo(e){const t="&"+e+";";Dk.innerHTML=t;const n=Dk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ln(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function _n(e,t){return e.length>0?(ln(e,e.length,0,t),e):t}const Mk={}.hasOwnProperty;function UN(e){const t={};let n=-1;for(;++n<e.length;)s4(t,e[n]);return t}function s4(e,t){let n;for(n in t){const i=(Mk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Mk.call(i,a)||(i[a]=[]);const o=s[a];a4(i[a],Array.isArray(o)?o:o?[o]:[])}}}function a4(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ln(e,0,0,r)}function $N(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Mn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=yi(/[A-Za-z]/),At=yi(/[\dA-Za-z]/),o4=yi(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const ag=yi(/\d/),l4=yi(/[\dA-Fa-f]/),c4=yi(/[!-/:-@[-`{-~]/);function ie(e){return e!==null&&e<-2}function Re(e){return e!==null&&(e<0||e===32)}function ve(e){return e===-2||e===-1||e===32}const _d=yi(new RegExp("\\p{P}|\\p{S}","u")),Ji=yi(/\s/);function yi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xa(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&At(e.charCodeAt(n+1))&&At(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ke(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return ve(l)?(e.enter(n),o(l)):t(l)}function o(l){return ve(l)&&s++<i?(e.consume(l),o):(e.exit(n),t(l))}}const u4={tokenize:d4};function d4(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ke(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),s(o)}function s(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ie(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const h4={tokenize:p4},Pk={tokenize:f4};function p4(e){const t=this,n=[];let r=0,i,s,a;return o;function o(S){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const w=t.events.length;let k=w,x;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){x=t.events[k][1].end;break}y(r);let E=w;for(;E<t.events.length;)t.events[E][1].end={...x},E++;return ln(t.events,k+1,0,t.events.slice(w)),t.events.length=E,c(S)}return o(S)}function c(S){if(r===n.length){if(!i)return p(S);if(i.currentConstruct&&i.currentConstruct.concrete)return g(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pk,d,u)(S)}function d(S){return i&&_(),y(r),p(S)}function u(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(S)}function p(S){return t.containerState={},e.attempt(Pk,f,g)(S)}function f(S){return r++,n.push([t.currentConstruct,t.containerState]),p(S)}function g(S){if(S===null){i&&_(),y(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(S)}function m(S){if(S===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(S);return}return ie(S)?(e.consume(S),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(S),m)}function v(S,w){const k=t.sliceStream(S);if(w&&k.push(null),S.previous=s,s&&(s.next=S),s=S,i.defineSkip(S.start),i.write(k),t.parser.lazy[S.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<a&&(!i.events[x][1].end||i.events[x][1].end.offset>a))return;const E=t.events.length;let T=E,D,R;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(D){R=t.events[T][1].end;break}D=!0}for(y(r),x=E;x<t.events.length;)t.events[x][1].end={...R},x++;ln(t.events,T+1,0,t.events.slice(E)),t.events.length=x}}function y(S){let w=n.length;for(;w-- >S;){const k=n[w];t.containerState=k[1],k[0].exit.call(t,e)}n.length=S}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function f4(e,t,n){return ke(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ca(e){if(e===null||Re(e)||Ji(e))return 1;if(_d(e))return 2}function vd(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const og={name:"attention",resolveAll:g4,tokenize:m4};function g4(e,t){let n=-1,r,i,s,a,o,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},p={...e[n][1].start};Fk(u,-l),Fk(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=_n(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=_n(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),c=_n(c,vd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=_n(c,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=_n(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ln(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function m4(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ca(r);let s;return a;function a(l){return s=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===s)return e.consume(l),o;const c=e.exit("attentionSequence"),d=ca(l),u=!d||d===2&&i||n.includes(l),p=!i||i===2&&d||n.includes(r);return c._open=!!(s===42?u:u&&(i||!p)),c._close=!!(s===42?p:p&&(d||!u)),t(l)}}function Fk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const b4={name:"autolink",tokenize:y4};function y4(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Ft(f)?(e.consume(f),a):f===64?n(f):c(f)}function a(f){return f===43||f===45||f===46||At(f)?(r=1,o(f)):c(f)}function o(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||At(f))&&r++<32?(e.consume(f),o):(r=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||wu(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),d):o4(f)?(e.consume(f),c):n(f)}function d(f){return At(f)?u(f):n(f)}function u(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||At(f))&&r++<63){const g=f===45?p:u;return e.consume(f),g}return n(f)}}const _l={partial:!0,tokenize:_4};function _4(e,t,n){return r;function r(s){return ve(s)?ke(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||ie(s)?t(s):n(s)}}const zN={continuation:{tokenize:S4},exit:w4,name:"blockQuote",tokenize:v4};function v4(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return ve(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function S4(e,t,n){const r=this;return i;function i(a){return ve(a)?ke(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(zN,t,n)(a)}}function w4(e){e.exit("blockQuote")}const HN={name:"characterEscape",tokenize:x4};function x4(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return c4(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const GN={name:"characterReference",tokenize:E4};function E4(e,t,n){const r=this;let i=0,s,a;return o;function o(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),l}function l(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,a=At,d(u))}function c(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=l4,d):(e.enter("characterReferenceValue"),s=7,a=ag,d(u))}function d(u){if(u===59&&i){const p=e.exit("characterReferenceValue");return a===At&&!Qo(r.sliceSerialize(p))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(u)&&i++<s?(e.consume(u),d):n(u)}}const Bk={partial:!0,tokenize:C4},jk={concrete:!0,name:"codeFenced",tokenize:k4};function k4(e,t,n){const r=this,i={partial:!0,tokenize:k};let s=0,a=0,o;return l;function l(x){return c(x)}function c(x){const E=r.events[r.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,o=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(x)}function d(x){return x===o?(a++,e.consume(x),d):a<3?n(x):(e.exit("codeFencedFenceSequence"),ve(x)?ke(e,u,"whitespace")(x):u(x))}function u(x){return x===null||ie(x)?(e.exit("codeFencedFence"),r.interrupt?t(x):e.check(Bk,m,w)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||ie(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(x)):ve(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ke(e,f,"whitespace")(x)):x===96&&x===o?n(x):(e.consume(x),p)}function f(x){return x===null||ie(x)?u(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||ie(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(x)):x===96&&x===o?n(x):(e.consume(x),g)}function m(x){return e.attempt(i,w,v)(x)}function v(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y}function y(x){return s>0&&ve(x)?ke(e,_,"linePrefix",s+1)(x):_(x)}function _(x){return x===null||ie(x)?e.check(Bk,m,w)(x):(e.enter("codeFlowValue"),S(x))}function S(x){return x===null||ie(x)?(e.exit("codeFlowValue"),_(x)):(e.consume(x),S)}function w(x){return e.exit("codeFenced"),t(x)}function k(x,E,T){let D=0;return R;function R(F){return x.enter("lineEnding"),x.consume(F),x.exit("lineEnding"),I}function I(F){return x.enter("codeFencedFence"),ve(F)?ke(x,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):O(F)}function O(F){return F===o?(x.enter("codeFencedFenceSequence"),N(F)):T(F)}function N(F){return F===o?(D++,x.consume(F),N):D>=a?(x.exit("codeFencedFenceSequence"),ve(F)?ke(x,P,"whitespace")(F):P(F)):T(F)}function P(F){return F===null||ie(F)?(x.exit("codeFencedFence"),E(F)):T(F)}}}function C4(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Hh={name:"codeIndented",tokenize:A4},T4={partial:!0,tokenize:N4};function A4(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ke(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):ie(c)?e.attempt(T4,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||ie(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function N4(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):ie(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ke(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):ie(a)?i(a):n(a)}}const R4={name:"codeText",previous:O4,resolve:I4,tokenize:L4};function I4(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 O4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function L4(e,t,n){let r=0,i,s;return a;function a(u){return e.enter("codeText"),e.enter("codeTextSequence"),o(u)}function o(u){return u===96?(e.consume(u),r++,o):(e.exit("codeTextSequence"),l(u))}function l(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),l):u===96?(s=e.enter("codeTextSequence"),i=0,d(u)):ie(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(u))}function c(u){return u===null||u===32||u===96||ie(u)?(e.exit("codeTextData"),l(u)):(e.consume(u),c)}function d(u){return u===96?(e.consume(u),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class D4{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Za(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Za(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Za(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Za(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Za(this.left,n.reverse())}}}function Za(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 WN(e){const t={};let n=-1,r,i,s,a,o,l,c;const d=new D4(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,M4(d,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return ln(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function M4(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let d,u,p=-1,f=n,g=0,m=0;const v=[m];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),u&&a.defineSkip(f.start),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,v.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(a.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),p=v.length;p--;){const y=o.slice(v[p],v[p+1]),_=s.pop();l.push([_,_+y.length-1]),e.splice(_,2,y)}for(l.reverse(),p=-1;++p<l.length;)c[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return c}const P4={resolve:B4,tokenize:j4},F4={partial:!0,tokenize:U4};function B4(e){return WN(e),e}function j4(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):ie(o)?e.check(F4,a,s)(o):(e.consume(o),i)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function U4(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ke(e,s,"linePrefix")}function s(a){if(a===null||ie(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function VN(e,t,n,r,i,s,a,o,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return u;function u(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),p):y===null||y===32||y===41||wu(y)?n(y):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(y))}function p(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(o),p(y)):y===null||y===60||ie(y)?n(y):(e.consume(y),y===92?g:f)}function g(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function m(y){return!d&&(y===null||y===41||Re(y))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(y)):d<c&&y===40?(e.consume(y),d++,m):y===41?(e.consume(y),d--,m):y===null||y===32||y===40||wu(y)?n(y):(e.consume(y),y===92?v:m)}function v(y){return y===40||y===41||y===92?(e.consume(y),m):m(y)}}function qN(e,t,n,r,i,s){const a=this;let o=0,l;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),d}function d(f){return o>999||f===null||f===91||f===93&&!l||f===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):ie(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||ie(f)||o++>999?(e.exit("chunkString"),d(f)):(e.consume(f),l||(l=!ve(f)),f===92?p:u)}function p(f){return f===91||f===92||f===93?(e.consume(f),o++,u):u(f)}}function KN(e,t,n,r,i,s){let a;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),c(p))}function c(p){return p===a?(e.exit(s),l(a)):p===null?n(p):ie(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ke(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===a||p===null||ie(p)?(e.exit("chunkString"),c(p)):(e.consume(p),p===92?u:d)}function u(p){return p===a||p===92?(e.consume(p),d):d(p)}}function xo(e,t){let n;return r;function r(i){return ie(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ve(i)?ke(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const $4={name:"definition",tokenize:H4},z4={partial:!0,tokenize:G4};function H4(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),a(f)}function a(f){return qN.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=Mn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return Re(f)?xo(e,c)(f):c(f)}function c(f){return VN(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(z4,u,u)(f)}function u(f){return ve(f)?ke(e,p,"whitespace")(f):p(f)}function p(f){return f===null||ie(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function G4(e,t,n){return r;function r(o){return Re(o)?xo(e,i)(o):n(o)}function i(o){return KN(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return ve(o)?ke(e,a,"whitespace")(o):a(o)}function a(o){return o===null||ie(o)?t(o):n(o)}}const W4={name:"hardBreakEscape",tokenize:V4};function V4(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return ie(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const q4={name:"headingAtx",resolve:K4,tokenize:Y4};function K4(e,t){let n=e.length-2,r=3,i,s;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},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ln(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Y4(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Re(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ie(d)?(e.exit("atxHeading"),t(d)):ve(d)?ke(e,o,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||Re(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),c)}}const X4=["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"],Uk=["pre","script","style","textarea"],Z4={concrete:!0,name:"htmlFlow",resolveTo:e5,tokenize:t5},Q4={partial:!0,tokenize:r5},J4={partial:!0,tokenize:n5};function e5(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 t5(e,t,n){const r=this;let i,s,a,o,l;return c;function c(L){return d(L)}function d(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),u}function u(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),s=!0,m):L===63?(e.consume(L),i=3,r.interrupt?t:C):Ft(L)?(e.consume(L),a=String.fromCharCode(L),v):n(L)}function p(L){return L===45?(e.consume(L),i=2,f):L===91?(e.consume(L),i=5,o=0,g):Ft(L)?(e.consume(L),i=4,r.interrupt?t:C):n(L)}function f(L){return L===45?(e.consume(L),r.interrupt?t:C):n(L)}function g(L){const se="CDATA[";return L===se.charCodeAt(o++)?(e.consume(L),o===se.length?r.interrupt?t:O:g):n(L)}function m(L){return Ft(L)?(e.consume(L),a=String.fromCharCode(L),v):n(L)}function v(L){if(L===null||L===47||L===62||Re(L)){const se=L===47,_e=a.toLowerCase();return!se&&!s&&Uk.includes(_e)?(i=1,r.interrupt?t(L):O(L)):X4.includes(a.toLowerCase())?(i=6,se?(e.consume(L),y):r.interrupt?t(L):O(L)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):s?_(L):S(L))}return L===45||At(L)?(e.consume(L),a+=String.fromCharCode(L),v):n(L)}function y(L){return L===62?(e.consume(L),r.interrupt?t:O):n(L)}function _(L){return ve(L)?(e.consume(L),_):R(L)}function S(L){return L===47?(e.consume(L),R):L===58||L===95||Ft(L)?(e.consume(L),w):ve(L)?(e.consume(L),S):R(L)}function w(L){return L===45||L===46||L===58||L===95||At(L)?(e.consume(L),w):k(L)}function k(L){return L===61?(e.consume(L),x):ve(L)?(e.consume(L),k):S(L)}function x(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),l=L,E):ve(L)?(e.consume(L),x):T(L)}function E(L){return L===l?(e.consume(L),l=null,D):L===null||ie(L)?n(L):(e.consume(L),E)}function T(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Re(L)?k(L):(e.consume(L),T)}function D(L){return L===47||L===62||ve(L)?S(L):n(L)}function R(L){return L===62?(e.consume(L),I):n(L)}function I(L){return L===null||ie(L)?O(L):ve(L)?(e.consume(L),I):n(L)}function O(L){return L===45&&i===2?(e.consume(L),B):L===60&&i===1?(e.consume(L),j):L===62&&i===4?(e.consume(L),H):L===63&&i===3?(e.consume(L),C):L===93&&i===5?(e.consume(L),U):ie(L)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Q4,Z,N)(L)):L===null||ie(L)?(e.exit("htmlFlowData"),N(L)):(e.consume(L),O)}function N(L){return e.check(J4,P,Z)(L)}function P(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),F}function F(L){return L===null||ie(L)?N(L):(e.enter("htmlFlowData"),O(L))}function B(L){return L===45?(e.consume(L),C):O(L)}function j(L){return L===47?(e.consume(L),a="",M):O(L)}function M(L){if(L===62){const se=a.toLowerCase();return Uk.includes(se)?(e.consume(L),H):O(L)}return Ft(L)&&a.length<8?(e.consume(L),a+=String.fromCharCode(L),M):O(L)}function U(L){return L===93?(e.consume(L),C):O(L)}function C(L){return L===62?(e.consume(L),H):L===45&&i===2?(e.consume(L),C):O(L)}function H(L){return L===null||ie(L)?(e.exit("htmlFlowData"),Z(L)):(e.consume(L),H)}function Z(L){return e.exit("htmlFlow"),t(L)}}function n5(e,t,n){const r=this;return i;function i(a){return ie(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function r5(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(_l,t,n)}}const i5={name:"htmlText",tokenize:s5};function s5(e,t,n){const r=this;let i,s,a;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),c):C===47?(e.consume(C),k):C===63?(e.consume(C),S):Ft(C)?(e.consume(C),T):n(C)}function c(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),s=0,g):Ft(C)?(e.consume(C),_):n(C)}function d(C){return C===45?(e.consume(C),f):n(C)}function u(C){return C===null?n(C):C===45?(e.consume(C),p):ie(C)?(a=u,j(C)):(e.consume(C),u)}function p(C){return C===45?(e.consume(C),f):u(C)}function f(C){return C===62?B(C):C===45?p(C):u(C)}function g(C){const H="CDATA[";return C===H.charCodeAt(s++)?(e.consume(C),s===H.length?m:g):n(C)}function m(C){return C===null?n(C):C===93?(e.consume(C),v):ie(C)?(a=m,j(C)):(e.consume(C),m)}function v(C){return C===93?(e.consume(C),y):m(C)}function y(C){return C===62?B(C):C===93?(e.consume(C),y):m(C)}function _(C){return C===null||C===62?B(C):ie(C)?(a=_,j(C)):(e.consume(C),_)}function S(C){return C===null?n(C):C===63?(e.consume(C),w):ie(C)?(a=S,j(C)):(e.consume(C),S)}function w(C){return C===62?B(C):S(C)}function k(C){return Ft(C)?(e.consume(C),x):n(C)}function x(C){return C===45||At(C)?(e.consume(C),x):E(C)}function E(C){return ie(C)?(a=E,j(C)):ve(C)?(e.consume(C),E):B(C)}function T(C){return C===45||At(C)?(e.consume(C),T):C===47||C===62||Re(C)?D(C):n(C)}function D(C){return C===47?(e.consume(C),B):C===58||C===95||Ft(C)?(e.consume(C),R):ie(C)?(a=D,j(C)):ve(C)?(e.consume(C),D):B(C)}function R(C){return C===45||C===46||C===58||C===95||At(C)?(e.consume(C),R):I(C)}function I(C){return C===61?(e.consume(C),O):ie(C)?(a=I,j(C)):ve(C)?(e.consume(C),I):D(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,N):ie(C)?(a=O,j(C)):ve(C)?(e.consume(C),O):(e.consume(C),P)}function N(C){return C===i?(e.consume(C),i=void 0,F):C===null?n(C):ie(C)?(a=N,j(C)):(e.consume(C),N)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Re(C)?D(C):(e.consume(C),P)}function F(C){return C===47||C===62||Re(C)?D(C):n(C)}function B(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function j(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),M}function M(C){return ve(C)?ke(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):U(C)}function U(C){return e.enter("htmlTextData"),a(C)}}const rb={name:"labelEnd",resolveAll:c5,resolveTo:u5,tokenize:d5},a5={tokenize:h5},o5={tokenize:p5},l5={tokenize:f5};function c5(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ln(e,0,e.length,n),e}function u5(e,t){let n=e.length,r=0,i,s,a,o;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=_n(o,e.slice(s+1,s+r+3)),o=_n(o,[["enter",d,t]]),o=_n(o,vd(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=_n(o,[["exit",d,t],e[a-2],e[a-1],["exit",c,t]]),o=_n(o,e.slice(a+1)),o=_n(o,[["exit",l,t]]),ln(e,s,e.length,o),e}function d5(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(p){return s?s._inactive?u(p):(a=r.parser.defined.includes(Mn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(a5,d,a?d:u)(p):p===91?e.attempt(o5,d,a?c:u)(p):a?d(p):u(p)}function c(p){return e.attempt(l5,d,u)(p)}function d(p){return t(p)}function u(p){return s._balanced=!0,n(p)}}function h5(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Re(u)?xo(e,s)(u):s(u)}function s(u){return u===41?d(u):VN(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function a(u){return Re(u)?xo(e,l)(u):d(u)}function o(u){return n(u)}function l(u){return u===34||u===39||u===40?KN(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):d(u)}function c(u){return Re(u)?xo(e,d)(u):d(u)}function d(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function p5(e,t,n){const r=this;return i;function i(o){return qN.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(Mn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function f5(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const g5={name:"labelStartImage",resolveAll:rb.resolveAll,tokenize:m5};function m5(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const b5={name:"labelStartLink",resolveAll:rb.resolveAll,tokenize:y5};function y5(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Gh={name:"lineEnding",tokenize:_5};function _5(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ke(e,t,"linePrefix")}}const Lc={name:"thematicBreak",tokenize:v5};function v5(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ie(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),ve(c)?ke(e,o,"whitespace")(c):o(c))}}const Wt={continuation:{tokenize:E5},exit:C5,name:"list",tokenize:x5},S5={partial:!0,tokenize:T5},w5={partial:!0,tokenize:k5};function x5(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:ag(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Lc,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return ag(f)&&++a<10?(e.consume(f),l):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(_l,r.interrupt?n:d,e.attempt(S5,p,u))}function d(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function u(f){return ve(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function E5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_l,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ke(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!ve(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(w5,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ke(e,e.attempt(Wt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function k5(e,t,n){const r=this;return ke(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function C5(e){e.exit(this.containerState.type)}function T5(e,t,n){const r=this;return ke(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!ve(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const $k={name:"setextUnderline",resolveTo:A5,tokenize:N5};function A5(e,t){let n=e.length,r,i,s;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),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function N5(e,t,n){const r=this;let i;return s;function s(c){let d=r.events.length,u;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){u=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),ve(c)?ke(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ie(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const R5={tokenize:I5};function I5(e){const t=this,n=e.attempt(_l,r,e.attempt(this.parser.constructs.flowInitial,i,ke(e,e.attempt(this.parser.constructs.flow,i,e.attempt(P4,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const O5={resolveAll:XN()},L5=YN("string"),D5=YN("text");function YN(e){return{resolveAll:XN(e==="text"?M5:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(d){return c(d)?s(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const u=i[d];let p=-1;if(u)for(;++p<u.length;){const f=u[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function XN(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function M5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const P5={42:Wt,43:Wt,45:Wt,48:Wt,49:Wt,50:Wt,51:Wt,52:Wt,53:Wt,54:Wt,55:Wt,56:Wt,57:Wt,62:zN},F5={91:$4},B5={[-2]:Hh,[-1]:Hh,32:Hh},j5={35:q4,42:Lc,45:[$k,Lc],60:Z4,61:$k,95:Lc,96:jk,126:jk},U5={38:GN,92:HN},$5={[-5]:Gh,[-4]:Gh,[-3]:Gh,33:g5,38:GN,42:og,60:[b4,i5],91:b5,92:[W4,HN],93:rb,95:og,96:R4},z5={null:[og,O5]},H5={null:[42,95]},G5={null:[]},W5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:H5,contentInitial:F5,disable:G5,document:P5,flow:j5,flowInitial:B5,insideSpan:z5,string:U5,text:$5},Symbol.toStringTag,{value:"Module"}));function V5(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:E(k),check:E(x),consume:_,enter:S,exit:w,interrupt:E(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:u};let d=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function u(I){return a=_n(a,I),v(),a[a.length-1]!==null?[]:(T(t,0),c.events=vd(s,c.events,c),c.events)}function p(I,O){return K5(f(I),O)}function f(I){return q5(a,I)}function g(){const{_bufferIndex:I,_index:O,line:N,column:P,offset:F}=r;return{_bufferIndex:I,_index:O,line:N,column:P,offset:F}}function m(I){i[I.line]=I.column,R()}function v(){let I;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<O.length;)y(O.charCodeAt(r._bufferIndex));else y(O)}}function y(I){d=d(I)}function _(I){ie(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,R()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function S(I,O){const N=O||{};return N.type=I,N.start=g(),c.events.push(["enter",N,c]),o.push(N),N}function w(I){const O=o.pop();return O.end=g(),c.events.push(["exit",O,c]),O}function k(I,O){T(I,O.from)}function x(I,O){O.restore()}function E(I,O){return N;function N(P,F,B){let j,M,U,C;return Array.isArray(P)?Z(P):"tokenize"in P?Z([P]):H(P);function H($){return W;function W(re){const ce=re!==null&&$[re],ue=re!==null&&$.null,he=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return Z(he)(re)}}function Z($){return j=$,M=0,$.length===0?B:L($[M])}function L($){return W;function W(re){return C=D(),U=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?_e():$.tokenize.call(O?Object.assign(Object.create(c),O):c,l,se,_e)(re)}}function se($){return I(U,C),F}function _e($){return C.restore(),++M<j.length?L(j[M]):B}}}function T(I,O){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&ln(c.events,O,c.events.length-O,I.resolve(c.events.slice(O),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function D(){const I=g(),O=c.previous,N=c.currentConstruct,P=c.events.length,F=Array.from(o);return{from:P,restore:B};function B(){r=I,c.previous=O,c.currentConstruct=N,c.events.length=P,o=F,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function q5(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function K5(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
|
|
481
481
|
`;break}case-3:{a=`\r
|
|
482
482
|
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function Y5(e){const r={constructs:UN([W5,...(e||{}).extensions||[]]),content:i(u4),defined:[],document:i(h4),flow:i(R5),lazy:{},string:i(L5),text:i(D5)};return r;function i(s){return a;function a(o){return V5(r,s,o)}}}function X5(e){for(;!WN(e););return e}const zk=/[\0\t\n\r]/g;function Z5(){let e=1,t="",n=!0,r;return i;function i(s,a,o){const l=[];let c,d,u,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),u=0,t="",n&&(s.charCodeAt(0)===65279&&u++,n=void 0);u<s.length;){if(zk.lastIndex=u,c=zk.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){t=s.slice(u);break}if(f===10&&u===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),u<p&&(l.push(s.slice(u,p)),e+=p-u),f){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}u=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Q5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function J5(e){return e.replace(Q5,eH)}function eH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return $N(n.slice(s?2:1),s?16:10)}return Qo(n)||e}const ZN={}.hasOwnProperty;function tH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),nH(n)(X5(Y5(n).document().write(Z5()(e,t,!0))))}function nH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(wi),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(Rr),blockQuote:s(ue),characterEscape:D,characterReference:D,codeFenced:s(he),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(he,a),codeText:s(me,a),codeTextData:D,data:D,codeFlowValue:D,definition:s(le),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(xt),hardBreakEscape:s(Ir),hardBreakTrailing:s(Ir),htmlFlow:s(Or,a),htmlFlowData:D,htmlText:s(Or,a),htmlTextData:D,image:s(Wd),label:a,link:s(wi),listItem:s(tL),listItemValue:p,listOrdered:s(Ow,u),listUnordered:s(Ow),paragraph:s(nL),reference:L,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Rr),strong:s(rL),thematicBreak:s(sL)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:ce,autolinkProtocol:re,blockQuote:l(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:$,characterReference:W,codeFenced:l(v),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:R,codeIndented:l(y),codeText:l(F),codeTextData:R,data:R,definition:l(),definitionDestinationString:w,definitionLabelString:_,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(N),htmlFlowData:R,htmlText:l(P),htmlTextData:R,image:l(j),label:U,labelText:M,lineEnding:I,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:C,resourceTitleString:H,resource:Z,setextHeading:l(T),setextHeadingLineSequence:E,setextHeadingText:x,strong:l(),thematicBreak:l()}};QN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(z){let Y={type:"root",children:[]};const de={stack:[Y],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:d,data:n},Ee=[];let Ne=-1;for(;++Ne<z.length;)if(z[Ne][1].type==="listOrdered"||z[Ne][1].type==="listUnordered")if(z[Ne][0]==="enter")Ee.push(Ne);else{const Cn=Ee.pop();Ne=i(z,Cn,Ne)}for(Ne=-1;++Ne<z.length;){const Cn=t[z[Ne][0]];ZN.call(Cn,z[Ne][1].type)&&Cn[z[Ne][1].type].call(Object.assign({sliceSerialize:z[Ne][2].sliceSerialize},de),z[Ne][1])}if(de.tokenStack.length>0){const Cn=de.tokenStack[de.tokenStack.length-1];(Cn[1]||Hk).call(de,void 0,Cn[0])}for(Y.position={start:jr(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:jr(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)Y=t.transforms[Ne](Y)||Y;return Y}function i(z,Y,de){let Ee=Y-1,Ne=-1,Cn=!1,xi,sr,La,Da;for(;++Ee<=de;){const Jt=z[Ee];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?Ne++:Ne--,Da=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(xi&&!Da&&!Ne&&!La&&(La=Ee),Da=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Da=void 0}if(!Ne&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||Ne===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(xi){let bs=Ee;for(sr=void 0;bs--;){const ar=z[bs];if(ar[1].type==="lineEnding"||ar[1].type==="lineEndingBlank"){if(ar[0]==="exit")continue;sr&&(z[sr][1].type="lineEndingBlank",Cn=!0),ar[1].type="lineEnding",sr=bs}else if(!(ar[1].type==="linePrefix"||ar[1].type==="blockQuotePrefix"||ar[1].type==="blockQuotePrefixWhitespace"||ar[1].type==="blockQuoteMarker"||ar[1].type==="listItemIndent"))break}La&&(!sr||La<sr)&&(xi._spread=!0),xi.end=Object.assign({},sr?z[sr][1].start:Jt[1].end),z.splice(sr||Ee,0,["exit",xi,Jt[2]]),Ee++,de++}if(Jt[1].type==="listItemPrefix"){const bs={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};xi=bs,z.splice(Ee,0,["enter",bs,Jt[2]]),Ee++,de++,La=void 0,Da=!0}}}return z[Y][1]._spread=Cn,de}function s(z,Y){return de;function de(Ee){o.call(this,z(Ee),Ee),Y&&Y.call(this,Ee)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(z,Y,de){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([Y,de||void 0]),z.position={start:jr(Y.start),end:void 0}}function l(z){return Y;function Y(de){z&&z.call(this,de),c.call(this,de)}}function c(z,Y){const de=this.stack.pop(),Ee=this.tokenStack.pop();if(Ee)Ee[0].type!==z.type&&(Y?Y.call(this,z,Ee[0]):(Ee[1]||Hk).call(this,z,Ee[0]));else throw new Error("Cannot close `"+z.type+"` ("+wo({start:z.start,end:z.end})+"): it’s not open");de.position.end=jr(z.end)}function d(){return nb(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function p(z){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function f(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=z}function g(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=z}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z.replace(/(\r?\n|\r)$/g,"")}function _(z){const Y=this.resume(),de=this.stack[this.stack.length-1];de.label=Y,de.identifier=Mn(this.sliceSerialize(z)).toLowerCase()}function S(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.title=z}function w(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.url=z}function k(z){const Y=this.stack[this.stack.length-1];if(!Y.depth){const de=this.sliceSerialize(z).length;Y.depth=de}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function E(z){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function D(z){const de=this.stack[this.stack.length-1].children;let Ee=de[de.length-1];(!Ee||Ee.type!=="text")&&(Ee=iL(),Ee.position={start:jr(z.start),end:void 0},de.push(Ee)),this.stack.push(Ee)}function R(z){const Y=this.stack.pop();Y.value+=this.sliceSerialize(z),Y.position.end=jr(z.end)}function I(z){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const de=Y.children[Y.children.length-1];de.position.end=jr(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(D.call(this,z),R.call(this,z))}function O(){this.data.atHardBreak=!0}function N(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function P(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function F(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function B(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Y,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function j(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Y,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function M(z){const Y=this.sliceSerialize(z),de=this.stack[this.stack.length-2];de.label=J5(Y),de.identifier=Mn(Y).toLowerCase()}function U(){const z=this.stack[this.stack.length-1],Y=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){const Ee=z.children;de.children=Ee}else de.alt=Y}function C(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.url=z}function H(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.title=z}function Z(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function se(z){const Y=this.resume(),de=this.stack[this.stack.length-1];de.label=Y,de.identifier=Mn(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function _e(z){this.data.characterReferenceType=z.type}function $(z){const Y=this.sliceSerialize(z),de=this.data.characterReferenceType;let Ee;de?(Ee=$N(Y,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ee=Qo(Y);const Ne=this.stack[this.stack.length-1];Ne.value+=Ee}function W(z){const Y=this.stack.pop();Y.position.end=jr(z.end)}function re(z){R.call(this,z);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(z)}function ce(z){R.call(this,z);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(z)}function ue(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xt(){return{type:"emphasis",children:[]}}function Rr(){return{type:"heading",depth:0,children:[]}}function Ir(){return{type:"break"}}function Or(){return{type:"html",value:""}}function Wd(){return{type:"image",title:null,url:"",alt:null}}function wi(){return{type:"link",title:null,url:"",children:[]}}function Ow(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function tL(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function nL(){return{type:"paragraph",children:[]}}function rL(){return{type:"strong",children:[]}}function iL(){return{type:"text",value:""}}function sL(){return{type:"thematicBreak"}}}function jr(e){return{line:e.line,column:e.column,offset:e.offset}}function QN(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?QN(e,r):rH(e,r)}}function rH(e,t){let n;for(n in t)if(ZN.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Hk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wo({start:t.start,end:t.end})+") is still open")}function iH(e){const t=this;t.parser=n;function n(r){return tH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function sH(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -528,7 +528,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
528
528
|
`,l+1)):l===0?s&&(e.result+=" "):e.result+=Bt.repeat(`
|
|
529
529
|
`,l):e.result+=Bt.repeat(`
|
|
530
530
|
`,s?1+l:l),s=!0,a=!0,l=0,n=e.position;!Jn(u)&&u!==0;)u=e.input.charCodeAt(++e.position);ai(e,n,e.position,!1)}return!0}function O0(e,t){var n,r=e.tag,i=e.anchor,s=[],a,o=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ne(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!Kt(a))));){if(o=!0,e.position++,tt(e,!0,-1)&&e.lineIndent<=t){s.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,ua(e,t,YR,!1,!0),s.push(e.result),tt(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)ne(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function hV(e,t,n){var r,i,s,a,o,l,c=e.tag,d=e.anchor,u={},p=Object.create(null),f=null,g=null,m=null,v=!1,y=!1,_;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),_=e.input.charCodeAt(e.position);_!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ne(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(_===63||_===58)&&Kt(r))_===63?(v&&(Hs(e,u,p,f,g,null,a,o,l),f=g=m=null),y=!0,v=!0,i=!0):v?(v=!1,i=!0):ne(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,_=r;else{if(a=e.line,o=e.lineStart,l=e.position,!ua(e,n,KR,!1,!0))break;if(e.line===s){for(_=e.input.charCodeAt(e.position);zi(_);)_=e.input.charCodeAt(++e.position);if(_===58)_=e.input.charCodeAt(++e.position),Kt(_)||ne(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(Hs(e,u,p,f,g,null,a,o,l),f=g=m=null),y=!0,v=!1,i=!1,f=e.tag,g=e.result;else if(y)ne(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=d,!0}else if(y)ne(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=d,!0}if((e.line===s||e.lineIndent>t)&&(v&&(a=e.line,o=e.lineStart,l=e.position),ua(e,t,Tu,!0,i)&&(v?g=e.result:m=e.result),v||(Hs(e,u,p,f,g,m,a,o,l),f=g=m=null),tt(e,!0,-1),_=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&_!==0)ne(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&Hs(e,u,p,f,g,null,a,o,l),y&&(e.tag=c,e.anchor=d,e.kind="mapping",e.result=u),y}function pV(e){var t,n=!1,r=!1,i,s,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&ne(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(n=!0,a=e.input.charCodeAt(++e.position)):a===33?(r=!0,i="!!",a=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(s=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):ne(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Kt(a);)a===33&&(r?ne(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),XR.test(i)||ne(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),tV.test(s)&&ne(e,"tag suffix cannot contain flow indicator characters")}s&&!ZR.test(s)&&ne(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ne(e,"tag name is malformed: "+s)}return n?e.tag=s:ui.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:ne(e,'undeclared tag handle "'+i+'"'),!0}function fV(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&ne(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Kt(n)&&!zs(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&ne(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function gV(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Kt(r)&&!zs(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ne(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),ui.call(e.anchorMap,n)||ne(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],tt(e,!0,-1),!0}function ua(e,t,n,r,i){var s,a,o,l=1,c=!1,d=!1,u,p,f,g,m,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=a=o=Tu===n||YR===n,r&&tt(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;pV(e)||fV(e);)tt(e,!0,-1)?(c=!0,o=s,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):o=!1;if(o&&(o=c||i),(l===1||Tu===n)&&(Cu===n||KR===n?m=t:m=t+1,v=e.position-e.lineStart,l===1?o&&(O0(e,v)||hV(e,v,m))||uV(e,m)?d=!0:(a&&dV(e,m)||lV(e,m)||cV(e,m)?d=!0:gV(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&ne(e,"alias node should not have any properties")):oV(e,m,Cu===n)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(d=o&&O0(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ne(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(g=e.implicitTypes[u],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(ui.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,f=e.typeMap.multi[e.kind||"fallback"],u=0,p=f.length;u<p;u+=1)if(e.tag.slice(0,f[u].tag.length)===f[u].tag){g=f[u];break}g||ne(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&ne(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ne(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function mV(e){var t=e.position,n,r,i,s=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(tt(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(s=!0,a=e.input.charCodeAt(++e.position),n=e.position;a!==0&&!Kt(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&ne(e,"directive name must not be less than one character in length");a!==0;){for(;zi(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!Jn(a));break}if(Jn(a))break;for(n=e.position;a!==0&&!Kt(a);)a=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}a!==0&&gw(e),ui.call(R0,r)?R0[r](e,r,i):Au(e,'unknown document directive "'+r+'"')}if(tt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,tt(e,!0,-1)):s&&ne(e,"directives end mark is expected"),ua(e,e.lineIndent-1,Tu,!1,!0),tt(e,!0,-1),e.checkLineBreaks&&eV.test(e.input.slice(t,e.position))&&Au(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ld(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,tt(e,!0,-1));return}if(e.position<e.length-1)ne(e,"end of the stream or a document separator is expected");else return}function bV(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
531
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new aV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ne(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)mV(n);return n.documents}function yV(e,t){var n=bV(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new hr("expected a single document in the stream, but found more")}}var _V=yV,vV={load:_V},SV=vV.load;function L0(e){var v;const t=e.pages||[],n=e.relations||[];if(t.length===0)return{nodes:[],edges:[]};const r=new Map,i=new Map;for(const y of t)r.set(y.id,[]),i.set(y.id,0);for(const y of n)(v=r.get(y.from))==null||v.push(y.to),i.set(y.to,(i.get(y.to)||0)+1);const s=new Map,a=[];for(const y of t)(i.get(y.id)||0)===0&&(a.push(y.id),s.set(y.id,0));let o=0;for(;a.length>0;){const y=a.shift(),_=s.get(y)||0;for(const S of r.get(y)||[]){const w=_+1;w>(s.get(S)||0)&&(s.set(S,w),w>o&&(o=w));const k=(i.get(S)||1)-1;i.set(S,k),k<=0&&a.push(S)}}for(const y of t)s.has(y.id)||s.set(y.id,o+1);const l=new Map;for(const y of t){const _=s.get(y.id)||0;l.has(_)||l.set(_,[]),l.get(_).push(y.id)}const c=160,d=50,u=60,p=80,f=[],g=new Map(t.map(y=>[y.id,y]));for(const[y,_]of l){const w=-(_.length*c+(_.length-1)*u)/2;_.forEach((k,x)=>{const E=g.get(k);f.push({id:k,title:(E==null?void 0:E.title)||k,x:w+x*(c+u)+c/2,y:y*(d+p),layer:y})})}const m=n.map(y=>({from:y.from,to:y.to,label:y.label}));return{nodes:f,edges:m}}const D0=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function wV({folderPath:e}){const[t,n]=b.useState(null),[r,i]=b.useState(!0),[s,a]=b.useState(null),[o,l]=b.useState(1),[c,d]=b.useState({x:0,y:0}),[u,p]=b.useState(!1),[f,g]=b.useState({x:0,y:0}),m=b.useRef(null),v=b.useRef(null),y=`${e}/.notebook/graph.yaml`,_=b.useCallback(async()=>{i(!0),a(null);try{const I=await HT(y);if(!I.content){a("graph.yaml is empty"),n(null);return}const O=SV(I.content);n(O),l(1),d({x:0,y:0})}catch{a("Cannot read .notebook/graph.yaml"),n(null)}finally{i(!1)}},[y]);b.useEffect(()=>{_()},[_]);const S=b.useCallback(I=>{I.preventDefault();const O=I.deltaY>0?-.1:.1;l(N=>Math.max(.2,Math.min(3,N+O)))},[]),w=b.useCallback(I=>{I.button===0&&(p(!0),g({x:I.clientX-c.x,y:I.clientY-c.y}))},[c]),k=b.useCallback(I=>{u&&d({x:I.clientX-f.x,y:I.clientY-f.y})},[u,f]),x=b.useCallback(()=>{p(!1)},[]),E=b.useCallback(()=>{if(!t||!v.current)return;const{nodes:I}=L0(t);if(I.length===0)return;const O=Math.min(...I.map(H=>H.x))-100,N=Math.max(...I.map(H=>H.x))+100,P=Math.min(...I.map(H=>H.y))-40,F=Math.max(...I.map(H=>H.y))+60,B=N-O,j=F-P,M=v.current.clientWidth,U=v.current.clientHeight,C=Math.min(M/B,U/j,1.5)*.9;l(C),d({x:M/2-(O+N)/2*C,y:U/2-(P+F)/2*C})},[t]),{nodes:T,edges:D}=b.useMemo(()=>t?L0(t):{nodes:[],edges:[]},[t]),R=b.useMemo(()=>new Map(T.map(I=>[I.id,I])),[T]);return b.useEffect(()=>{t&&!r&&setTimeout(E,50)},[t,r,E]),r?h.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:h.jsx(vo,{className:"h-5 w-5 animate-spin"})}):s||!t?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[h.jsx("p",{children:s||"No graph data"}),h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>void _(),children:[h.jsx(Ki,{className:"h-3 w-3 mr-1"})," Retry"]})]}):h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[h.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[T.length," pages, ",D.length," relations"]}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(I=>Math.min(3,I+.2)),children:h.jsx(XT,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(I=>Math.max(.2,I-.2)),children:h.jsx(ZT,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:E,children:h.jsx(yF,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>void _(),children:h.jsx(Ki,{className:"h-3 w-3"})})]}),h.jsx("div",{ref:v,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:S,onMouseDown:w,onMouseMove:k,onMouseUp:x,onMouseLeave:x,children:h.jsxs("svg",{ref:m,width:"100%",height:"100%",style:{userSelect:"none"},children:[h.jsx("defs",{children:h.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:h.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),h.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${o})`,children:[D.map((I,O)=>{const N=R.get(I.from),P=R.get(I.to);if(!N||!P)return null;const F=N.y+20,B=P.y-20,j=(F+B)/2;return h.jsxs("g",{children:[h.jsx("path",{d:`M ${N.x} ${F} C ${N.x} ${j}, ${P.x} ${j}, ${P.x} ${B}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),I.label&&h.jsx("text",{x:(N.x+P.x)/2,y:j-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:I.label})]},`edge-${O}`)}),T.map(I=>{const O=D0[I.layer%D0.length],N=140,P=36;return h.jsxs("g",{transform:`translate(${I.x-N/2}, ${I.y-P/2})`,children:[h.jsx("rect",{width:N,height:P,rx:8,fill:O,fillOpacity:.15,stroke:O,strokeWidth:1.5}),h.jsx("text",{x:N/2,y:P/2+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:I.title.length>14?I.title.slice(0,13)+"…":I.title})]},I.id)})]})]})})]})}async function bw(e){let t=Nm(e);const n=kr();n&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(n)}`);const r=await fetch(t);if(!r.ok)throw new Error(`Failed to fetch file: ${r.status}`);return r.arrayBuffer()}function xV({filePath:e,zoom:t}){const[n,r]=b.useState(""),[i,s]=b.useState(null),[a,o]=b.useState(!0);return b.useEffect(()=>{let l=!1;return o(!0),s(null),(async()=>{try{const c=await pb(()=>import("./index-
|
|
531
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new aV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ne(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)mV(n);return n.documents}function yV(e,t){var n=bV(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new hr("expected a single document in the stream, but found more")}}var _V=yV,vV={load:_V},SV=vV.load;function L0(e){var v;const t=e.pages||[],n=e.relations||[];if(t.length===0)return{nodes:[],edges:[]};const r=new Map,i=new Map;for(const y of t)r.set(y.id,[]),i.set(y.id,0);for(const y of n)(v=r.get(y.from))==null||v.push(y.to),i.set(y.to,(i.get(y.to)||0)+1);const s=new Map,a=[];for(const y of t)(i.get(y.id)||0)===0&&(a.push(y.id),s.set(y.id,0));let o=0;for(;a.length>0;){const y=a.shift(),_=s.get(y)||0;for(const S of r.get(y)||[]){const w=_+1;w>(s.get(S)||0)&&(s.set(S,w),w>o&&(o=w));const k=(i.get(S)||1)-1;i.set(S,k),k<=0&&a.push(S)}}for(const y of t)s.has(y.id)||s.set(y.id,o+1);const l=new Map;for(const y of t){const _=s.get(y.id)||0;l.has(_)||l.set(_,[]),l.get(_).push(y.id)}const c=160,d=50,u=60,p=80,f=[],g=new Map(t.map(y=>[y.id,y]));for(const[y,_]of l){const w=-(_.length*c+(_.length-1)*u)/2;_.forEach((k,x)=>{const E=g.get(k);f.push({id:k,title:(E==null?void 0:E.title)||k,x:w+x*(c+u)+c/2,y:y*(d+p),layer:y})})}const m=n.map(y=>({from:y.from,to:y.to,label:y.label}));return{nodes:f,edges:m}}const D0=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function wV({folderPath:e}){const[t,n]=b.useState(null),[r,i]=b.useState(!0),[s,a]=b.useState(null),[o,l]=b.useState(1),[c,d]=b.useState({x:0,y:0}),[u,p]=b.useState(!1),[f,g]=b.useState({x:0,y:0}),m=b.useRef(null),v=b.useRef(null),y=`${e}/.notebook/graph.yaml`,_=b.useCallback(async()=>{i(!0),a(null);try{const I=await HT(y);if(!I.content){a("graph.yaml is empty"),n(null);return}const O=SV(I.content);n(O),l(1),d({x:0,y:0})}catch{a("Cannot read .notebook/graph.yaml"),n(null)}finally{i(!1)}},[y]);b.useEffect(()=>{_()},[_]);const S=b.useCallback(I=>{I.preventDefault();const O=I.deltaY>0?-.1:.1;l(N=>Math.max(.2,Math.min(3,N+O)))},[]),w=b.useCallback(I=>{I.button===0&&(p(!0),g({x:I.clientX-c.x,y:I.clientY-c.y}))},[c]),k=b.useCallback(I=>{u&&d({x:I.clientX-f.x,y:I.clientY-f.y})},[u,f]),x=b.useCallback(()=>{p(!1)},[]),E=b.useCallback(()=>{if(!t||!v.current)return;const{nodes:I}=L0(t);if(I.length===0)return;const O=Math.min(...I.map(H=>H.x))-100,N=Math.max(...I.map(H=>H.x))+100,P=Math.min(...I.map(H=>H.y))-40,F=Math.max(...I.map(H=>H.y))+60,B=N-O,j=F-P,M=v.current.clientWidth,U=v.current.clientHeight,C=Math.min(M/B,U/j,1.5)*.9;l(C),d({x:M/2-(O+N)/2*C,y:U/2-(P+F)/2*C})},[t]),{nodes:T,edges:D}=b.useMemo(()=>t?L0(t):{nodes:[],edges:[]},[t]),R=b.useMemo(()=>new Map(T.map(I=>[I.id,I])),[T]);return b.useEffect(()=>{t&&!r&&setTimeout(E,50)},[t,r,E]),r?h.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:h.jsx(vo,{className:"h-5 w-5 animate-spin"})}):s||!t?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[h.jsx("p",{children:s||"No graph data"}),h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>void _(),children:[h.jsx(Ki,{className:"h-3 w-3 mr-1"})," Retry"]})]}):h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[h.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[T.length," pages, ",D.length," relations"]}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(I=>Math.min(3,I+.2)),children:h.jsx(XT,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(I=>Math.max(.2,I-.2)),children:h.jsx(ZT,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:E,children:h.jsx(yF,{className:"h-3 w-3"})}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>void _(),children:h.jsx(Ki,{className:"h-3 w-3"})})]}),h.jsx("div",{ref:v,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:S,onMouseDown:w,onMouseMove:k,onMouseUp:x,onMouseLeave:x,children:h.jsxs("svg",{ref:m,width:"100%",height:"100%",style:{userSelect:"none"},children:[h.jsx("defs",{children:h.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:h.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),h.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${o})`,children:[D.map((I,O)=>{const N=R.get(I.from),P=R.get(I.to);if(!N||!P)return null;const F=N.y+20,B=P.y-20,j=(F+B)/2;return h.jsxs("g",{children:[h.jsx("path",{d:`M ${N.x} ${F} C ${N.x} ${j}, ${P.x} ${j}, ${P.x} ${B}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),I.label&&h.jsx("text",{x:(N.x+P.x)/2,y:j-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:I.label})]},`edge-${O}`)}),T.map(I=>{const O=D0[I.layer%D0.length],N=140,P=36;return h.jsxs("g",{transform:`translate(${I.x-N/2}, ${I.y-P/2})`,children:[h.jsx("rect",{width:N,height:P,rx:8,fill:O,fillOpacity:.15,stroke:O,strokeWidth:1.5}),h.jsx("text",{x:N/2,y:P/2+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:I.title.length>14?I.title.slice(0,13)+"…":I.title})]},I.id)})]})]})})]})}async function bw(e){let t=Nm(e);const n=kr();n&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(n)}`);const r=await fetch(t);if(!r.ok)throw new Error(`Failed to fetch file: ${r.status}`);return r.arrayBuffer()}function xV({filePath:e,zoom:t}){const[n,r]=b.useState(""),[i,s]=b.useState(null),[a,o]=b.useState(!0);return b.useEffect(()=>{let l=!1;return o(!0),s(null),(async()=>{try{const c=await pb(()=>import("./index-8diGU2NE.js").then(p=>p.i),__vite__mapDeps([0,1])),d=await bw(e),u=await c.convertToHtml({arrayBuffer:d});l||r(u.value)}catch(c){l||s(c instanceof Error?c.message:"Failed to render docx")}finally{l||o(!1)}})(),()=>{l=!0}},[e]),a?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):h.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:`${12*t/100}px`},dangerouslySetInnerHTML:{__html:n}})}function EV({filePath:e,zoom:t}){var d;const[n,r]=b.useState([]),[i,s]=b.useState(0),[a,o]=b.useState(null),[l,c]=b.useState(!0);return b.useEffect(()=>{let u=!1;return c(!0),o(null),(async()=>{try{const p=await pb(()=>import("./xlsx-D_0l8YDs.js"),[]),f=await bw(e),g=p.read(f,{type:"array"}),m=g.SheetNames.map(v=>({name:v,html:p.utils.sheet_to_html(g.Sheets[v],{editable:!1})}));u||(r(m),s(0))}catch(p){u||o(p instanceof Error?p.message:"Failed to render xlsx")}finally{u||c(!1)}})(),()=>{u=!0}},[e]),l?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):a?h.jsx("p",{className:"text-sm text-destructive p-4",children:a}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsxs("div",{className:"flex flex-col h-full",children:[n.length>1&&h.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:n.map((u,p)=>h.jsx("button",{onClick:()=>s(p),className:`px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap ${p===i?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"}`,children:u.name},p))}),h.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:`${12*t/100}px`},dangerouslySetInnerHTML:{__html:((d=n[i])==null?void 0:d.html)??""}}),h.jsx("style",{children:`
|
|
532
532
|
.xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }
|
|
533
533
|
.xlsx-preview td, .xlsx-preview th {
|
|
534
534
|
border: 1px solid hsl(var(--border));
|
|
@@ -539,8 +539,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
539
539
|
}
|
|
540
540
|
.xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }
|
|
541
541
|
.xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }
|
|
542
|
-
`})]})}async function kV(e){const{default:t}=await pb(async()=>{const{default:s}=await import("./jszip.min-CwNvmrBU.js").then(a=>a.j);return{default:s}},[]),n=await t.loadAsync(e),r=[],i=Object.keys(n.files).filter(s=>/^ppt\/slides\/slide\d+\.xml$/i.test(s)).sort((s,a)=>{var c,d;const o=parseInt(((c=s.match(/slide(\d+)/))==null?void 0:c[1])??"0"),l=parseInt(((d=a.match(/slide(\d+)/))==null?void 0:d[1])??"0");return o-l});for(let s=0;s<i.length;s++){const a=await n.file(i[s]).async("text"),o=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let c;for(;(c=l.exec(a))!==null;){const d=c[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();d&&o.push(d)}r.push({index:s+1,texts:o})}return r}function CV({filePath:e,zoom:t}){const[n,r]=b.useState([]),[i,s]=b.useState(null),[a,o]=b.useState(!0);return b.useEffect(()=>{let l=!1;return o(!0),s(null),(async()=>{try{const c=await bw(e),d=await kV(c);l||r(d)}catch(c){l||s(c instanceof Error?c.message:"Failed to render pptx")}finally{l||o(!1)}})(),()=>{l=!0}},[e]),a?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsx("div",{className:"p-4 space-y-4",style:{fontSize:`${12*t/100}px`},children:n.map(l=>h.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[h.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",l.index]}),l.texts.length>0?h.jsx("div",{className:"space-y-1.5",children:l.texts.map((c,d)=>h.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:c},d))}):h.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},l.index))})}const TV=new Set(["docx","xlsx","xls","pptx"]);function AV({filePath:e,ext:t,zoom:n}){return t==="docx"?h.jsx(xV,{filePath:e,zoom:n}):t==="xlsx"||t==="xls"?h.jsx(EV,{filePath:e,zoom:n}):t==="pptx"?h.jsx(CV,{filePath:e,zoom:n}):null}const nI={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function NV(e){const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"dockerfile";if(n==="makefile")return"makefile";const r=t.lastIndexOf(".");return r>=0?t.slice(r+1).toLowerCase():""}const RV=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function IV(e){return e==="md"||e==="html"||e==="htm"||e in nI}function M0(e){return e==="md"?"Markdown":e==="html"||e==="htm"?"HTML":"高亮"}const Ts=[50,75,100,125,150,200,250,300],nl=100,vg="cc_file_zoom";function OV(e){try{const n=JSON.parse(localStorage.getItem(vg)||"{}")[e];return Ts.includes(n)?n:nl}catch{return nl}}function LV(e,t){try{const n=JSON.parse(localStorage.getItem(vg)||"{}");t===nl?delete n[e]:n[e]=t,localStorage.setItem(vg,JSON.stringify(n))}catch{}}function DV({filePath:e,onClose:t}){const n=e.endsWith("/.notebook/graph.yaml"),r=n?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[i,s]=b.useState(null),[a,o]=b.useState(null),[l,c]=b.useState(()=>n?"graph":"rendered"),[d,u]=b.useState(!1),[p,f]=b.useState(nl),[g,m]=b.useState(""),[v,y]=b.useState(!1),[_,S]=b.useState(!1),w=b.useRef(null),{resolved:k}=jm(),x=e.split("/").pop()??e,E=b.useMemo(()=>NV(e),[e]),T=RV.has(E),D=TV.has(E),R=IV(E),I=nI[E]||E,O=b.useMemo(()=>{if(!T)return"";const $=Nm(e),W=kr();return W?`${$}&token=${encodeURIComponent(W)}`:$},[e,T]);b.useEffect(()=>{if(s(null),o(null),f(OV(e)),S(!1),T||D){s({path:e,binary:!1,tooLarge:!1,size:0,content:null}),c("rendered");return}c(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),HT(e).then($=>{s($),m($.content??"")}).catch($=>o($ instanceof Error?$.message:"Failed to load file"))},[e,T,D]);const N=$=>{if($.target===$.currentTarget){if(_&&!confirm("有未保存的修改,确定关闭?"))return;t()}};b.useEffect(()=>{const $=W=>{if(W.key==="Escape"){if(_&&!confirm("有未保存的修改,确定关闭?"))return;t()}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,_]);const P=b.useCallback(async()=>{y(!0);try{await GP(e,g),s($=>$&&{...$,content:g,size:new Blob([g]).size}),S(!1)}catch($){alert($ instanceof Error?$.message:"保存失败")}finally{y(!1)}},[e,g]);b.useEffect(()=>{const $=W=>{(W.metaKey||W.ctrlKey)&&W.key==="s"&&l==="edit"&&(W.preventDefault(),P())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[l,P]);const F=()=>{m((i==null?void 0:i.content)??""),S(!1),c("edit"),setTimeout(()=>{var $;return($=w.current)==null?void 0:$.focus()},0)},B=()=>{_&&!confirm("有未保存的修改,确定退出编辑?")||(c(n?"graph":R?"rendered":"plain"),S(!1))},j=$=>{f($),LV(e,$)},M=()=>{const $=Ts.find(W=>W>p);$&&j($)},U=()=>{const $=[...Ts].reverse().find(W=>W<p);$&&j($)},C=()=>j(nl),H=(i==null?void 0:i.content)??"",Z=k==="dark"?O8:L8,L=12*(p/100),se=i&&!i.binary&&!i.tooLarge,_e=b.useMemo(()=>{var ce,ue;if(E!=="md")return null;const $=l==="edit"?g:H;if(!$)return 0;const W=((ce=$.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))==null?void 0:ce.length)??0,re=((ue=$.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))==null?void 0:ue.length)??0;return W+re},[E,H,g,l]);return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:N,children:h.jsxs("div",{className:X("relative flex flex-col bg-background border border-border shadow-2xl transition-all duration-200",d?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-lg"),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[h.jsx(Ec,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[x,_&&h.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),_e!==null&&h.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs",children:[_e.toLocaleString()," 字"]})]}),se&&!T&&!D&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[R&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{onClick:()=>l==="edit"?B():c("plain"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="plain"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[h.jsx(dF,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():c("rendered"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="rendered"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:M0(E),children:[h.jsx(qT,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:M0(E)})]})]}),n&&h.jsxs("button",{onClick:()=>l==="edit"?B():c("graph"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="graph"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[h.jsx(xF,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():F(),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[h.jsx(ad,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),l==="edit"&&h.jsxs("button",{onClick:()=>void P(),disabled:v||!_,className:X("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",_?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[h.jsx(KT,{className:"h-3 w-3"}),v?"保存中...":"保存"]}),(se||T)&&l!=="edit"&&l!=="graph"&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[h.jsx("button",{onClick:U,disabled:p<=Ts[0],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:h.jsx(ZT,{className:"h-3 w-3"})}),h.jsxs("button",{onClick:C,className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[p,"%"]}),h.jsx("button",{onClick:M,disabled:p>=Ts[Ts.length-1],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:h.jsx(XT,{className:"h-3 w-3"})})]}),h.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>u($=>!$),title:d?"退出全屏":"全屏",children:d?h.jsx(Om,{className:"h-3.5 w-3.5"}):h.jsx(Im,{className:"h-3.5 w-3.5"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{_&&!confirm("有未保存的修改,确定关闭?")||t()},children:h.jsx(os,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:X("flex-1 min-h-0",l==="graph"?"overflow-hidden":"overflow-auto"),children:[l==="graph"&&h.jsx(wV,{folderPath:r}),l!=="graph"&&!i&&!a&&h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),l!=="graph"&&a&&h.jsx("p",{className:"text-sm text-red-400 p-4",children:a}),l!=="graph"&&T&&i&&h.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:h.jsx("img",{src:O,alt:x,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${p/100})`,transformOrigin:"center center"},draggable:!1})}),l!=="graph"&&D&&i&&h.jsx(AV,{filePath:e,ext:E,zoom:p}),l!=="graph"&&!T&&!D&&i&&i.binary&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Ec,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024).toFixed(1)," KB"]})]}),l!=="graph"&&!D&&i&&i.tooLarge&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Ec,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"File too large to preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024/1024).toFixed(2)," MB (limit 1 MB)"]})]}),l!=="graph"&&se&&H!==null&&h.jsxs(h.Fragment,{children:[l==="edit"&&h.jsx("textarea",{ref:w,value:g,onChange:$=>{m($.target.value),S(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${L}px`,minHeight:"100%"},spellCheck:!1}),l!=="edit"&&h.jsxs("div",{className:"p-4",style:{fontSize:`${L}px`},children:[l==="plain"&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:H}),l==="rendered"&&E==="md"&&h.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:h.jsx(lR,{remarkPlugins:[OR],components:{code({className:$,children:W,...re}){const ce=/language-(\w+)/.exec($||"");return!ce&&!$?h.jsx("code",{className:$,...re,children:W}):h.jsx(yg,{style:Z,language:(ce==null?void 0:ce[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(W).replace(/\n$/,"")})}},children:H})}),l==="rendered"&&(E==="html"||E==="htm")&&h.jsx("iframe",{srcDoc:H,className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:x,style:{minHeight:"60vh",transform:`scale(${p/100})`,transformOrigin:"top left",width:`${1e4/p}%`,height:`${1e4/p}%`}}),l==="rendered"&&E!=="md"&&E!=="html"&&E!=="htm"&&I&&h.jsx(yg,{style:Z,language:I,showLineNumbers:!0,lineNumberStyle:{color:k==="dark"?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:H}),l==="rendered"&&!R&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:H})]})]})]})]})})}const MV=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function PV(e){const t=e.lastIndexOf(".");return t>=0&&MV.has(e.slice(t+1).toLowerCase())}function FV({projectPath:e}){const[t,n]=b.useState(new Map),[r,i]=b.useState(new Set([e])),[s,a]=b.useState(new Set),[o,l]=b.useState(null),[c,d]=b.useState(null),[u,p]=b.useState(!1),[f,g]=b.useState(!1),m=b.useRef(null),v=b.useRef(null);b.useEffect(()=>{if(!c)return;const I=()=>d(null);return window.addEventListener("click",I),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("click",I),window.removeEventListener("scroll",I,!0)}},[c]);const y=(I,O)=>{let N=Nm(I);const P=kr();P&&(N+=`${N.includes("?")?"&":"?"}token=${encodeURIComponent(P)}`);const F=document.createElement("a");F.href=N,F.download=O,F.click()},_=async I=>{if(I.length!==0){p(!0);try{await zP(e,I),w(e)}catch(O){console.error("[FileTree] Upload failed:",O)}finally{p(!1)}}},S=I=>{I.preventDefault(),g(!1);const O=Array.from(I.dataTransfer.files);O.length>0&&_(O)},w=b.useCallback(async I=>{a(O=>{if(O.has(I))return O;const N=new Set(O);return N.add(I),N});try{const O=await zT(I);n(N=>new Map(N).set(I,O.entries))}catch(O){console.error("[FileTree] Failed to load:",I,O),n(N=>new Map(N).set(I,[]))}finally{a(O=>{const N=new Set(O);return N.delete(I),N})}},[]);b.useEffect(()=>{n(new Map),i(new Set([e])),a(new Set),w(e)},[e,w]);const k=b.useCallback(I=>{i(O=>{const N=new Set(O);return N.has(I)?N.delete(I):(N.add(I),t.has(I)||w(I)),N})},[t,w]),x=b.useCallback(()=>{n(new Map),i(new Set([e])),a(new Set),w(e)},[e,w]),E=(I,O)=>I.map(N=>{const P=r.has(N.path),F=s.has(N.path),B=t.get(N.path),j=N.name.startsWith(".");return h.jsxs("div",{children:[h.jsxs("div",{className:X("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted",j&&"opacity-50"),style:{paddingLeft:`${O*14+6}px`,paddingRight:"6px"},onClick:()=>N.type==="dir"?k(N.path):l(N.path),onContextMenu:M=>{N.type==="file"&&(M.preventDefault(),d({x:M.clientX,y:M.clientY,filePath:N.path,fileName:N.name}))},children:[h.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:N.type==="dir"&&(F?h.jsx(Ki,{className:"h-2.5 w-2.5 animate-spin"}):P?h.jsx(pl,{className:"h-2.5 w-2.5"}):h.jsx(sd,{className:"h-2.5 w-2.5"}))}),N.type==="dir"?P?h.jsx(Vo,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):h.jsx(pf,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):PV(N.name)?h.jsx(mF,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):h.jsx(Ec,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:X("text-xs truncate leading-none",N.type==="dir"?"text-foreground":"text-muted-foreground"),title:N.path,children:N.name})]}),N.type==="dir"&&P&&h.jsxs("div",{children:[!B&&!F&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(O+1)*14+6+16}px`},children:"—"}),(B==null?void 0:B.length)===0&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(O+1)*14+6+16}px`},children:"empty"}),B&&B.length>0&&E(B,O+1)]})]},N.path)}),T=t.get(e),D=s.has(e),R=e.split("/").filter(Boolean).pop()??e;return h.jsxs(h.Fragment,{children:[o&&h.jsx(DV,{filePath:o,onClose:()=>l(null)}),c&&h.jsx("div",{ref:m,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:c.x,top:c.y},onClick:I=>I.stopPropagation(),children:h.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{y(c.filePath,c.fileName),d(null)},children:[h.jsx(pu,{className:"h-3.5 w-3.5"}),"下载"]})}),h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),h.jsxs("div",{className:"flex items-center gap-0.5",children:[h.jsx("input",{ref:v,type:"file",multiple:!0,className:"hidden",onChange:I=>{const O=Array.from(I.target.files??[]);O.length>0&&_(O),I.target.value=""}}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var I;return(I=v.current)==null?void 0:I.click()},disabled:u,title:"上传文件",children:h.jsx(gf,{className:X("h-3 w-3",u&&"animate-pulse")})}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:x,title:"Refresh file tree",children:h.jsx(Ki,{className:X("h-3 w-3",D&&"animate-spin")})})]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[h.jsx(Vo,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:R})]}),h.jsxs("div",{className:X("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",f&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:I=>{I.preventDefault(),g(!0)},onDragEnter:I=>{I.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:S,children:[u&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),f&&!u&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),D&&!T?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):!T||T.length===0?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"}):E(T,0)]})]})]})}function BV({open:e,onOpenChange:t,initialLabel:n,initialCommand:r,title:i,onSave:s}){const[a,o]=b.useState(n),[l,c]=b.useState(r);b.useEffect(()=>{e&&(o(n),c(r))},[e,n,r]);const d=()=>{const u=l.trim();u&&(s(a.trim()||u,u),t(!1))};return h.jsx(_a,{open:e,onOpenChange:t,children:h.jsxs(cs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[h.jsxs(us,{children:[h.jsx(hs,{children:i}),h.jsx(ps,{children:"Write the command that will be sent to Claude when this shortcut is triggered."})]}),h.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"shortcut-label",children:"Label"}),h.jsx(wn,{id:"shortcut-label",placeholder:"Give it a name (optional)",value:a,onChange:u=>o(u.target.value),className:"text-base",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[h.jsx(je,{htmlFor:"shortcut-command",children:"Command"}),h.jsx("textarea",{id:"shortcut-command",placeholder:"Enter the command to send to Claude...",value:l,onChange:u=>c(u.target.value),className:X("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),d())}})]})]}),h.jsxs(ds,{className:"flex items-center justify-between sm:justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),h.jsx(te,{onClick:d,disabled:!l.trim(),children:"Save"})]})]})]})})}function jV({open:e,onOpenChange:t,label:n,command:r}){const[i,s]=b.useState(""),[a,o]=b.useState(()=>localStorage.getItem("ccweb_skillhub_author")||""),[l,c]=b.useState(""),[d,u]=b.useState(!1),[p,f]=b.useState(!1);b.useEffect(()=>{if(e){s(""),c(""),f(!1);const m=localStorage.getItem("ccweb_skillhub_author");m&&o(m)}},[e]);const g=async()=>{if(!d){u(!0);try{localStorage.setItem("ccweb_skillhub_author",a),await BP({label:n,command:r,description:i.trim(),author:a.trim()||"anonymous",tags:l.split(",").map(m=>m.trim()).filter(Boolean)}),f(!0)}catch(m){alert(m instanceof Error?m.message:"Failed to submit")}finally{u(!1)}}};return h.jsx(_a,{open:e,onOpenChange:t,children:h.jsxs(cs,{className:"sm:max-w-md",children:[h.jsxs(us,{children:[h.jsx(hs,{children:"分享到 SkillHub"}),h.jsxs(ps,{children:["将「",n,"」分享给社区,审核通过后将出现在 SkillHub 中。"]})]}),p?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"提交成功!等待审核后将出现在 SkillHub 中。"}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-desc",children:"描述"}),h.jsx("textarea",{id:"share-desc",placeholder:"简要描述这个命令的用途...",value:i,onChange:m=>s(m.target.value),className:X("w-full rounded-md border border-input bg-background px-3 py-2","text-sm min-h-[80px] resize-none","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2")})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-author",children:"作者"}),h.jsx(wn,{id:"share-author",placeholder:"你的名字",value:a,onChange:m=>o(m.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-tags",children:"标签(逗号分隔)"}),h.jsx(wn,{id:"share-tags",placeholder:"代码审查, 中文, 测试",value:l,onChange:m=>c(m.target.value)})]})]}),h.jsx(ds,{children:p?h.jsx(te,{onClick:()=>t(!1),children:"关闭"}):h.jsxs(h.Fragment,{children:[h.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"取消"}),h.jsx(te,{onClick:g,disabled:d,children:d?"提交中...":"提交"})]})})]})})}function UV({projectId:e,onSend:t}){const[n,r]=b.useState([]),[i,s]=b.useState([]),[a,o]=b.useState(!1),[l,c]=b.useState(null),[d,u]=b.useState(!1),[p,f]=b.useState(""),[g,m]=b.useState("");b.useEffect(()=>{LP(e).then(r).catch(()=>r([]))},[e]),b.useEffect(()=>{$T().then(s).catch(()=>s([]))},[]);const v=b.useCallback(E=>{const T=[],D=new Set;let R=E;const I=[];for(;R&&!D.has(R.id);)D.add(R.id),I.unshift(R),R=R.parentId?i.find(O=>O.id===R.parentId):void 0;for(const O of I)T.push(O.command);return T},[i]),y=b.useCallback(E=>{v(E).forEach((D,R)=>{setTimeout(()=>t(D+"\r"),R*500)})},[v,t]),_=()=>{c(null),o(!0)},S=(E,T)=>{T.stopPropagation(),c(E),o(!0)},w=async(E,T)=>{try{if(l){const D=await MP(e,l.id,{label:E,command:T});r(R=>R.map(I=>I.id===D.id?D:I))}else{const D=await DP(e,{label:E,command:T});r(R=>[...R,D])}}catch(D){console.error("Failed to save shortcut:",D)}c(null)},k=(E,T,D)=>{D.stopPropagation(),f(E),m(T),u(!0)},x=async(E,T)=>{T.stopPropagation();try{await PP(e,E),r(D=>D.filter(R=>R.id!==E))}catch(D){console.error("Failed to delete shortcut:",D)}};return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Shortcuts"}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:_,title:"New shortcut",children:h.jsx(oa,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[i.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1 pb-0.5",children:[h.jsx(fu,{className:"h-3 w-3 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"全局"})]}),i.map(E=>{var D;const T=E.parentId?(D=i.find(R=>R.id===E.parentId))==null?void 0:D.label:void 0;return h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>y(E),title:T?`继承自「${T}」`:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-6 leading-snug",children:E.label}),T&&h.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[h.jsx(_o,{className:"h-2.5 w-2.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T]})]}),!T&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug",children:E.command}),h.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:R=>k(E.label,E.command,R),title:"分享到 SkillHub",children:h.jsx(lE,{className:"h-3 w-3"})})})]},E.id)}),n.length>0&&h.jsx("div",{className:"flex items-center gap-1.5 px-1 pt-2 pb-0.5",children:h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"项目"})})]}),n.length===0&&i.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(fu,{className:"h-5 w-5"}),h.jsxs("p",{className:"text-xs text-center leading-relaxed",children:["No shortcuts yet.",h.jsx("br",{}),"Click ",h.jsx("strong",{className:"text-muted-foreground",children:"+"})," to add one."]})]}),n.map(E=>h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>t(E.command+"\r"),title:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-10 leading-snug",children:E.label}),E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug pr-10",children:E.command}),h.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:T=>k(E.label,E.command,T),title:"分享到 SkillHub",children:h.jsx(lE,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-blue-400 transition-colors",onClick:T=>S(E,T),title:"Edit shortcut",children:h.jsx(ad,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-red-400 transition-colors",onClick:T=>x(E.id,T),title:"Delete shortcut",children:h.jsx(os,{className:"h-3 w-3"})})]})]},E.id))]}),h.jsx(BV,{open:a,onOpenChange:o,initialLabel:(l==null?void 0:l.label)??"",initialCommand:(l==null?void 0:l.command)??"",title:l?"Edit Shortcut":"New Shortcut",onSave:w}),h.jsx(jV,{open:d,onOpenChange:u,label:p,command:g})]})}function rI(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function iI(e){return`这是我们上一次的聊天记录,请你回忆:
|
|
542
|
+
`})]})}async function kV(e){const{default:t}=await pb(async()=>{const{default:s}=await import("./jszip.min-CtbQrs-f.js").then(a=>a.j);return{default:s}},[]),n=await t.loadAsync(e),r=[],i=Object.keys(n.files).filter(s=>/^ppt\/slides\/slide\d+\.xml$/i.test(s)).sort((s,a)=>{var c,d;const o=parseInt(((c=s.match(/slide(\d+)/))==null?void 0:c[1])??"0"),l=parseInt(((d=a.match(/slide(\d+)/))==null?void 0:d[1])??"0");return o-l});for(let s=0;s<i.length;s++){const a=await n.file(i[s]).async("text"),o=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let c;for(;(c=l.exec(a))!==null;){const d=c[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();d&&o.push(d)}r.push({index:s+1,texts:o})}return r}function CV({filePath:e,zoom:t}){const[n,r]=b.useState([]),[i,s]=b.useState(null),[a,o]=b.useState(!0);return b.useEffect(()=>{let l=!1;return o(!0),s(null),(async()=>{try{const c=await bw(e),d=await kV(c);l||r(d)}catch(c){l||s(c instanceof Error?c.message:"Failed to render pptx")}finally{l||o(!1)}})(),()=>{l=!0}},[e]),a?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsx("div",{className:"p-4 space-y-4",style:{fontSize:`${12*t/100}px`},children:n.map(l=>h.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[h.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",l.index]}),l.texts.length>0?h.jsx("div",{className:"space-y-1.5",children:l.texts.map((c,d)=>h.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:c},d))}):h.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},l.index))})}const TV=new Set(["docx","xlsx","xls","pptx"]);function AV({filePath:e,ext:t,zoom:n}){return t==="docx"?h.jsx(xV,{filePath:e,zoom:n}):t==="xlsx"||t==="xls"?h.jsx(EV,{filePath:e,zoom:n}):t==="pptx"?h.jsx(CV,{filePath:e,zoom:n}):null}const nI={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function NV(e){const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"dockerfile";if(n==="makefile")return"makefile";const r=t.lastIndexOf(".");return r>=0?t.slice(r+1).toLowerCase():""}const RV=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function IV(e){return e==="md"||e==="html"||e==="htm"||e in nI}function M0(e){return e==="md"?"Markdown":e==="html"||e==="htm"?"HTML":"高亮"}const Ts=[50,75,100,125,150,200,250,300],nl=100,vg="cc_file_zoom";function OV(e){try{const n=JSON.parse(localStorage.getItem(vg)||"{}")[e];return Ts.includes(n)?n:nl}catch{return nl}}function LV(e,t){try{const n=JSON.parse(localStorage.getItem(vg)||"{}");t===nl?delete n[e]:n[e]=t,localStorage.setItem(vg,JSON.stringify(n))}catch{}}function DV({filePath:e,onClose:t}){const n=e.endsWith("/.notebook/graph.yaml"),r=n?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[i,s]=b.useState(null),[a,o]=b.useState(null),[l,c]=b.useState(()=>n?"graph":"rendered"),[d,u]=b.useState(!1),[p,f]=b.useState(nl),[g,m]=b.useState(""),[v,y]=b.useState(!1),[_,S]=b.useState(!1),w=b.useRef(null),{resolved:k}=jm(),x=e.split("/").pop()??e,E=b.useMemo(()=>NV(e),[e]),T=RV.has(E),D=TV.has(E),R=IV(E),I=nI[E]||E,O=b.useMemo(()=>{if(!T)return"";const $=Nm(e),W=kr();return W?`${$}&token=${encodeURIComponent(W)}`:$},[e,T]);b.useEffect(()=>{if(s(null),o(null),f(OV(e)),S(!1),T||D){s({path:e,binary:!1,tooLarge:!1,size:0,content:null}),c("rendered");return}c(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),HT(e).then($=>{s($),m($.content??"")}).catch($=>o($ instanceof Error?$.message:"Failed to load file"))},[e,T,D]);const N=$=>{if($.target===$.currentTarget){if(_&&!confirm("有未保存的修改,确定关闭?"))return;t()}};b.useEffect(()=>{const $=W=>{if(W.key==="Escape"){if(_&&!confirm("有未保存的修改,确定关闭?"))return;t()}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,_]);const P=b.useCallback(async()=>{y(!0);try{await GP(e,g),s($=>$&&{...$,content:g,size:new Blob([g]).size}),S(!1)}catch($){alert($ instanceof Error?$.message:"保存失败")}finally{y(!1)}},[e,g]);b.useEffect(()=>{const $=W=>{(W.metaKey||W.ctrlKey)&&W.key==="s"&&l==="edit"&&(W.preventDefault(),P())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[l,P]);const F=()=>{m((i==null?void 0:i.content)??""),S(!1),c("edit"),setTimeout(()=>{var $;return($=w.current)==null?void 0:$.focus()},0)},B=()=>{_&&!confirm("有未保存的修改,确定退出编辑?")||(c(n?"graph":R?"rendered":"plain"),S(!1))},j=$=>{f($),LV(e,$)},M=()=>{const $=Ts.find(W=>W>p);$&&j($)},U=()=>{const $=[...Ts].reverse().find(W=>W<p);$&&j($)},C=()=>j(nl),H=(i==null?void 0:i.content)??"",Z=k==="dark"?O8:L8,L=12*(p/100),se=i&&!i.binary&&!i.tooLarge,_e=b.useMemo(()=>{var ce,ue;if(E!=="md")return null;const $=l==="edit"?g:H;if(!$)return 0;const W=((ce=$.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))==null?void 0:ce.length)??0,re=((ue=$.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))==null?void 0:ue.length)??0;return W+re},[E,H,g,l]);return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:N,children:h.jsxs("div",{className:X("relative flex flex-col bg-background border border-border shadow-2xl transition-all duration-200",d?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-lg"),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[h.jsx(Ec,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[x,_&&h.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),_e!==null&&h.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs",children:[_e.toLocaleString()," 字"]})]}),se&&!T&&!D&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[R&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{onClick:()=>l==="edit"?B():c("plain"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="plain"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[h.jsx(dF,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():c("rendered"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="rendered"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:M0(E),children:[h.jsx(qT,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:M0(E)})]})]}),n&&h.jsxs("button",{onClick:()=>l==="edit"?B():c("graph"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="graph"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[h.jsx(xF,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():F(),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[h.jsx(ad,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),l==="edit"&&h.jsxs("button",{onClick:()=>void P(),disabled:v||!_,className:X("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",_?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[h.jsx(KT,{className:"h-3 w-3"}),v?"保存中...":"保存"]}),(se||T)&&l!=="edit"&&l!=="graph"&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[h.jsx("button",{onClick:U,disabled:p<=Ts[0],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:h.jsx(ZT,{className:"h-3 w-3"})}),h.jsxs("button",{onClick:C,className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[p,"%"]}),h.jsx("button",{onClick:M,disabled:p>=Ts[Ts.length-1],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:h.jsx(XT,{className:"h-3 w-3"})})]}),h.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>u($=>!$),title:d?"退出全屏":"全屏",children:d?h.jsx(Om,{className:"h-3.5 w-3.5"}):h.jsx(Im,{className:"h-3.5 w-3.5"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{_&&!confirm("有未保存的修改,确定关闭?")||t()},children:h.jsx(os,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:X("flex-1 min-h-0",l==="graph"?"overflow-hidden":"overflow-auto"),children:[l==="graph"&&h.jsx(wV,{folderPath:r}),l!=="graph"&&!i&&!a&&h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),l!=="graph"&&a&&h.jsx("p",{className:"text-sm text-red-400 p-4",children:a}),l!=="graph"&&T&&i&&h.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:h.jsx("img",{src:O,alt:x,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${p/100})`,transformOrigin:"center center"},draggable:!1})}),l!=="graph"&&D&&i&&h.jsx(AV,{filePath:e,ext:E,zoom:p}),l!=="graph"&&!T&&!D&&i&&i.binary&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Ec,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024).toFixed(1)," KB"]})]}),l!=="graph"&&!D&&i&&i.tooLarge&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Ec,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"File too large to preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024/1024).toFixed(2)," MB (limit 1 MB)"]})]}),l!=="graph"&&se&&H!==null&&h.jsxs(h.Fragment,{children:[l==="edit"&&h.jsx("textarea",{ref:w,value:g,onChange:$=>{m($.target.value),S(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${L}px`,minHeight:"100%"},spellCheck:!1}),l!=="edit"&&h.jsxs("div",{className:"p-4",style:{fontSize:`${L}px`},children:[l==="plain"&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:H}),l==="rendered"&&E==="md"&&h.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:h.jsx(lR,{remarkPlugins:[OR],components:{code({className:$,children:W,...re}){const ce=/language-(\w+)/.exec($||"");return!ce&&!$?h.jsx("code",{className:$,...re,children:W}):h.jsx(yg,{style:Z,language:(ce==null?void 0:ce[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(W).replace(/\n$/,"")})}},children:H})}),l==="rendered"&&(E==="html"||E==="htm")&&h.jsx("iframe",{srcDoc:H,className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:x,style:{minHeight:"60vh",transform:`scale(${p/100})`,transformOrigin:"top left",width:`${1e4/p}%`,height:`${1e4/p}%`}}),l==="rendered"&&E!=="md"&&E!=="html"&&E!=="htm"&&I&&h.jsx(yg,{style:Z,language:I,showLineNumbers:!0,lineNumberStyle:{color:k==="dark"?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:H}),l==="rendered"&&!R&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:H})]})]})]})]})})}const MV=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function PV(e){const t=e.lastIndexOf(".");return t>=0&&MV.has(e.slice(t+1).toLowerCase())}function FV({projectPath:e}){const[t,n]=b.useState(new Map),[r,i]=b.useState(new Set([e])),[s,a]=b.useState(new Set),[o,l]=b.useState(null),[c,d]=b.useState(null),[u,p]=b.useState(!1),[f,g]=b.useState(!1),m=b.useRef(null),v=b.useRef(null);b.useEffect(()=>{if(!c)return;const I=()=>d(null);return window.addEventListener("click",I),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("click",I),window.removeEventListener("scroll",I,!0)}},[c]);const y=(I,O)=>{let N=Nm(I);const P=kr();P&&(N+=`${N.includes("?")?"&":"?"}token=${encodeURIComponent(P)}`);const F=document.createElement("a");F.href=N,F.download=O,F.click()},_=async I=>{if(I.length!==0){p(!0);try{await zP(e,I),w(e)}catch(O){console.error("[FileTree] Upload failed:",O)}finally{p(!1)}}},S=I=>{I.preventDefault(),g(!1);const O=Array.from(I.dataTransfer.files);O.length>0&&_(O)},w=b.useCallback(async I=>{a(O=>{if(O.has(I))return O;const N=new Set(O);return N.add(I),N});try{const O=await zT(I);n(N=>new Map(N).set(I,O.entries))}catch(O){console.error("[FileTree] Failed to load:",I,O),n(N=>new Map(N).set(I,[]))}finally{a(O=>{const N=new Set(O);return N.delete(I),N})}},[]);b.useEffect(()=>{n(new Map),i(new Set([e])),a(new Set),w(e)},[e,w]);const k=b.useCallback(I=>{i(O=>{const N=new Set(O);return N.has(I)?N.delete(I):(N.add(I),t.has(I)||w(I)),N})},[t,w]),x=b.useCallback(()=>{n(new Map),i(new Set([e])),a(new Set),w(e)},[e,w]),E=(I,O)=>I.map(N=>{const P=r.has(N.path),F=s.has(N.path),B=t.get(N.path),j=N.name.startsWith(".");return h.jsxs("div",{children:[h.jsxs("div",{className:X("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted",j&&"opacity-50"),style:{paddingLeft:`${O*14+6}px`,paddingRight:"6px"},onClick:()=>N.type==="dir"?k(N.path):l(N.path),onContextMenu:M=>{N.type==="file"&&(M.preventDefault(),d({x:M.clientX,y:M.clientY,filePath:N.path,fileName:N.name}))},children:[h.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:N.type==="dir"&&(F?h.jsx(Ki,{className:"h-2.5 w-2.5 animate-spin"}):P?h.jsx(pl,{className:"h-2.5 w-2.5"}):h.jsx(sd,{className:"h-2.5 w-2.5"}))}),N.type==="dir"?P?h.jsx(Vo,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):h.jsx(pf,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):PV(N.name)?h.jsx(mF,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):h.jsx(Ec,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:X("text-xs truncate leading-none",N.type==="dir"?"text-foreground":"text-muted-foreground"),title:N.path,children:N.name})]}),N.type==="dir"&&P&&h.jsxs("div",{children:[!B&&!F&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(O+1)*14+6+16}px`},children:"—"}),(B==null?void 0:B.length)===0&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(O+1)*14+6+16}px`},children:"empty"}),B&&B.length>0&&E(B,O+1)]})]},N.path)}),T=t.get(e),D=s.has(e),R=e.split("/").filter(Boolean).pop()??e;return h.jsxs(h.Fragment,{children:[o&&h.jsx(DV,{filePath:o,onClose:()=>l(null)}),c&&h.jsx("div",{ref:m,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:c.x,top:c.y},onClick:I=>I.stopPropagation(),children:h.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{y(c.filePath,c.fileName),d(null)},children:[h.jsx(pu,{className:"h-3.5 w-3.5"}),"下载"]})}),h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),h.jsxs("div",{className:"flex items-center gap-0.5",children:[h.jsx("input",{ref:v,type:"file",multiple:!0,className:"hidden",onChange:I=>{const O=Array.from(I.target.files??[]);O.length>0&&_(O),I.target.value=""}}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var I;return(I=v.current)==null?void 0:I.click()},disabled:u,title:"上传文件",children:h.jsx(gf,{className:X("h-3 w-3",u&&"animate-pulse")})}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:x,title:"Refresh file tree",children:h.jsx(Ki,{className:X("h-3 w-3",D&&"animate-spin")})})]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[h.jsx(Vo,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:R})]}),h.jsxs("div",{className:X("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",f&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:I=>{I.preventDefault(),g(!0)},onDragEnter:I=>{I.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:S,children:[u&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),f&&!u&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),D&&!T?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):!T||T.length===0?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"}):E(T,0)]})]})]})}function BV({open:e,onOpenChange:t,initialLabel:n,initialCommand:r,title:i,onSave:s}){const[a,o]=b.useState(n),[l,c]=b.useState(r);b.useEffect(()=>{e&&(o(n),c(r))},[e,n,r]);const d=()=>{const u=l.trim();u&&(s(a.trim()||u,u),t(!1))};return h.jsx(_a,{open:e,onOpenChange:t,children:h.jsxs(cs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[h.jsxs(us,{children:[h.jsx(hs,{children:i}),h.jsx(ps,{children:"Write the command that will be sent to Claude when this shortcut is triggered."})]}),h.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"shortcut-label",children:"Label"}),h.jsx(wn,{id:"shortcut-label",placeholder:"Give it a name (optional)",value:a,onChange:u=>o(u.target.value),className:"text-base",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[h.jsx(je,{htmlFor:"shortcut-command",children:"Command"}),h.jsx("textarea",{id:"shortcut-command",placeholder:"Enter the command to send to Claude...",value:l,onChange:u=>c(u.target.value),className:X("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),d())}})]})]}),h.jsxs(ds,{className:"flex items-center justify-between sm:justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),h.jsx(te,{onClick:d,disabled:!l.trim(),children:"Save"})]})]})]})})}function jV({open:e,onOpenChange:t,label:n,command:r}){const[i,s]=b.useState(""),[a,o]=b.useState(()=>localStorage.getItem("ccweb_skillhub_author")||""),[l,c]=b.useState(""),[d,u]=b.useState(!1),[p,f]=b.useState(!1);b.useEffect(()=>{if(e){s(""),c(""),f(!1);const m=localStorage.getItem("ccweb_skillhub_author");m&&o(m)}},[e]);const g=async()=>{if(!d){u(!0);try{localStorage.setItem("ccweb_skillhub_author",a),await BP({label:n,command:r,description:i.trim(),author:a.trim()||"anonymous",tags:l.split(",").map(m=>m.trim()).filter(Boolean)}),f(!0)}catch(m){alert(m instanceof Error?m.message:"Failed to submit")}finally{u(!1)}}};return h.jsx(_a,{open:e,onOpenChange:t,children:h.jsxs(cs,{className:"sm:max-w-md",children:[h.jsxs(us,{children:[h.jsx(hs,{children:"分享到 SkillHub"}),h.jsxs(ps,{children:["将「",n,"」分享给社区,审核通过后将出现在 SkillHub 中。"]})]}),p?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"提交成功!等待审核后将出现在 SkillHub 中。"}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-desc",children:"描述"}),h.jsx("textarea",{id:"share-desc",placeholder:"简要描述这个命令的用途...",value:i,onChange:m=>s(m.target.value),className:X("w-full rounded-md border border-input bg-background px-3 py-2","text-sm min-h-[80px] resize-none","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2")})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-author",children:"作者"}),h.jsx(wn,{id:"share-author",placeholder:"你的名字",value:a,onChange:m=>o(m.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{htmlFor:"share-tags",children:"标签(逗号分隔)"}),h.jsx(wn,{id:"share-tags",placeholder:"代码审查, 中文, 测试",value:l,onChange:m=>c(m.target.value)})]})]}),h.jsx(ds,{children:p?h.jsx(te,{onClick:()=>t(!1),children:"关闭"}):h.jsxs(h.Fragment,{children:[h.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"取消"}),h.jsx(te,{onClick:g,disabled:d,children:d?"提交中...":"提交"})]})})]})})}function UV({projectId:e,onSend:t}){const[n,r]=b.useState([]),[i,s]=b.useState([]),[a,o]=b.useState(!1),[l,c]=b.useState(null),[d,u]=b.useState(!1),[p,f]=b.useState(""),[g,m]=b.useState("");b.useEffect(()=>{LP(e).then(r).catch(()=>r([]))},[e]),b.useEffect(()=>{$T().then(s).catch(()=>s([]))},[]);const v=b.useCallback(E=>{const T=[],D=new Set;let R=E;const I=[];for(;R&&!D.has(R.id);)D.add(R.id),I.unshift(R),R=R.parentId?i.find(O=>O.id===R.parentId):void 0;for(const O of I)T.push(O.command);return T},[i]),y=b.useCallback(E=>{v(E).forEach((D,R)=>{setTimeout(()=>t(D+"\r"),R*500)})},[v,t]),_=()=>{c(null),o(!0)},S=(E,T)=>{T.stopPropagation(),c(E),o(!0)},w=async(E,T)=>{try{if(l){const D=await MP(e,l.id,{label:E,command:T});r(R=>R.map(I=>I.id===D.id?D:I))}else{const D=await DP(e,{label:E,command:T});r(R=>[...R,D])}}catch(D){console.error("Failed to save shortcut:",D)}c(null)},k=(E,T,D)=>{D.stopPropagation(),f(E),m(T),u(!0)},x=async(E,T)=>{T.stopPropagation();try{await PP(e,E),r(D=>D.filter(R=>R.id!==E))}catch(D){console.error("Failed to delete shortcut:",D)}};return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Shortcuts"}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:_,title:"New shortcut",children:h.jsx(oa,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[i.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1 pb-0.5",children:[h.jsx(fu,{className:"h-3 w-3 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"全局"})]}),i.map(E=>{var D;const T=E.parentId?(D=i.find(R=>R.id===E.parentId))==null?void 0:D.label:void 0;return h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>y(E),title:T?`继承自「${T}」`:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-6 leading-snug",children:E.label}),T&&h.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[h.jsx(_o,{className:"h-2.5 w-2.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T]})]}),!T&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug",children:E.command}),h.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:R=>k(E.label,E.command,R),title:"分享到 SkillHub",children:h.jsx(lE,{className:"h-3 w-3"})})})]},E.id)}),n.length>0&&h.jsx("div",{className:"flex items-center gap-1.5 px-1 pt-2 pb-0.5",children:h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"项目"})})]}),n.length===0&&i.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(fu,{className:"h-5 w-5"}),h.jsxs("p",{className:"text-xs text-center leading-relaxed",children:["No shortcuts yet.",h.jsx("br",{}),"Click ",h.jsx("strong",{className:"text-muted-foreground",children:"+"})," to add one."]})]}),n.map(E=>h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>t(E.command+"\r"),title:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-10 leading-snug",children:E.label}),E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug pr-10",children:E.command}),h.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:T=>k(E.label,E.command,T),title:"分享到 SkillHub",children:h.jsx(lE,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-blue-400 transition-colors",onClick:T=>S(E,T),title:"Edit shortcut",children:h.jsx(ad,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-red-400 transition-colors",onClick:T=>x(E.id,T),title:"Delete shortcut",children:h.jsx(os,{className:"h-3 w-3"})})]})]},E.id))]}),h.jsx(BV,{open:a,onOpenChange:o,initialLabel:(l==null?void 0:l.label)??"",initialCommand:(l==null?void 0:l.command)??"",title:l?"Edit Shortcut":"New Shortcut",onSave:w}),h.jsx(jV,{open:d,onOpenChange:u,label:p,command:g})]})}function rI(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function iI(e){return`这是我们上一次的聊天记录,请你回忆:
|
|
543
543
|
|
|
544
544
|
${e.messages.map(n=>`[${n.role==="user"?"User":"Assistant"}]: ${n.content}`).join(`
|
|
545
545
|
|
|
546
|
-
`)}`}function $V({session:e,onClose:t,onRecall:n}){return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),h.jsxs("div",{className:"relative z-10 w-[600px] max-w-[90vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-lg shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-sm font-medium text-foreground",children:rI(e.startedAt)}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white transition-colors",onClick:()=>{n(iI(e)),t()},children:[h.jsx(Rm,{className:"h-3 w-3"}),"回忆"]}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground transition-colors p-0.5",onClick:t,children:h.jsx(os,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:[e.messages.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),e.messages.map((r,i)=>h.jsxs("div",{className:X("flex gap-2.5",r.role==="user"?"flex-row-reverse":"flex-row"),children:[h.jsx("div",{className:X("flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",r.role==="user"?"bg-blue-600/20":"bg-muted"),children:r.role==="user"?h.jsx(YT,{className:"h-3 w-3 text-blue-400"}):h.jsx(GT,{className:"h-3 w-3 text-muted-foreground"})}),h.jsx("div",{className:X("max-w-[85%] text-xs rounded-lg px-3 py-2 whitespace-pre-wrap break-words",r.role==="user"?"bg-blue-600/20 text-blue-100 dark:text-blue-100 border border-blue-500/20":"bg-muted text-foreground border border-border"),children:r.content})]},i))]})]})]})}function zV({projectId:e,onSend:t}){var d;const[n,r]=b.useState([]),[i,s]=b.useState(null),a=n.filter(u=>u.messageCount>0),o=(d=a.find(u=>!u.isCurrent))==null?void 0:d.id;b.useEffect(()=>{let u=null;const p=()=>{document.hidden||nE(e).then(r).catch(()=>{})};nE(e).then(r).catch(()=>r([]));const f=()=>{u=setInterval(p,5e3)},g=()=>{u&&(clearInterval(u),u=null)},m=()=>{document.hidden?g():f()};return f(),document.addEventListener("visibilitychange",m),()=>{g(),document.removeEventListener("visibilitychange",m)}},[e]);const l=async u=>{try{s(await rE(e,u))}catch{}},c=u=>{t(u+"\r")};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[a.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(GT,{className:"h-5 w-5"}),h.jsx("p",{className:"text-xs text-center",children:"暂无历史记录"})]}),a.map(u=>{const p=u.isCurrent,f=!u.isCurrent&&u.id===o;return h.jsxs("div",{className:X("group rounded border bg-muted hover:border-muted-foreground/30 transition-colors",p?"border-blue-500/50":"border-border"),children:[h.jsxs("button",{className:"w-full text-left px-3 pt-2 pb-1",onClick:()=>void l(u.id),children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground",children:rI(u.startedAt)}),p&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-blue-500/20 text-blue-400 border border-blue-500/30 leading-none",children:"当前"}),f&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground border border-border leading-none",children:"最近"})]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[u.messageCount," 条消息"]})]}),h.jsx("div",{className:"px-3 pb-2 flex justify-end",children:h.jsxs("button",{className:"flex items-center gap-1 text-[10px] px-2 py-0.5 rounded bg-secondary hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:async g=>{g.stopPropagation();try{const m=await rE(e,u.id);c(iI(m))}catch{}},children:[h.jsx(Rm,{className:"h-2.5 w-2.5"}),"回忆"]})})]},u.id)})]}),i&&h.jsx($V,{session:i,onClose:()=>s(null),onRecall:c})]})}const HV={shortcuts:"快捷命令",history:"历史记录"};function GV({projectId:e,onSend:t}){const[n,r]=b.useState("shortcuts");return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[h.jsx("div",{className:"flex border-b border-border flex-shrink-0",children:["shortcuts","history"].map(i=>h.jsx("button",{onClick:()=>r(i),className:X("flex-1 text-xs py-2 font-medium transition-colors",n===i?"text-foreground border-b-2 border-blue-500 -mb-px bg-muted/50":"text-muted-foreground hover:text-foreground"),children:HV[i]},i))}),n==="shortcuts"&&h.jsx(UV,{projectId:e,onSend:t}),n==="history"&&h.jsx(zV,{projectId:e,onSend:t})]})}const WV=new Set(["preset:wind","preset:rain","preset:stream"]),VV=new Set(["preset:singing-bowl","preset:water-drops","preset:keyboard"]);function qV(e){return e.playMode!=="auto"?e.playMode:WV.has(e.source)?"loop":VV.has(e.source)?"interval":"loop"}function KV({projectId:e,config:t,isActive:n}){const r=b.useRef(null),i=b.useRef(null),s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null),c=b.useRef(!1),d=b.useCallback(()=>{if(o.current&&(clearTimeout(o.current),o.current=null),l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.pause(),r.current.src=""),a.current){try{a.current.disconnect()}catch{}a.current=null}if(s.current){try{s.current.disconnect()}catch{}s.current=null}if(i.current){try{i.current.close()}catch{}i.current=null}r.current=null,c.current=!1},[]),u=b.useCallback(g=>{if(!r.current||r.current.src!==g){if(a.current){try{a.current.disconnect()}catch{}a.current=null}r.current&&r.current.pause();const m=new Audio(g);m.crossOrigin="anonymous",r.current=m}if(i.current||(i.current=new AudioContext),!s.current){const m=i.current.createGain();m.gain.value=0,m.connect(i.current.destination),s.current=m}if(!a.current){const m=i.current.createMediaElementSource(r.current);m.connect(s.current),a.current=m}return{audio:r.current,ctx:i.current,gain:s.current}},[]),p=b.useCallback(g=>{const m=aE(g.source,e),v=Math.max(0,Math.min(1,g.volume)),y=qV(g),{audio:_,ctx:S,gain:w}=u(m);S.resume().then(()=>{if(o.current&&(clearTimeout(o.current),o.current=null),l.current&&(clearTimeout(l.current),l.current=null),y==="loop")_.loop=!0,_.currentTime=0,_.play().catch(()=>{}),c.current=!0,w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(v,S.currentTime+.5);else{_.loop=!1;const k=()=>{if(!c.current)return;_.currentTime=0,_.play().catch(()=>{}),w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(v,S.currentTime+.5);const x=()=>{if(!c.current)return;const[E,T]=g.intervalRange,D=(E+Math.random()*(T-E))*1e3;l.current=setTimeout(k,D)};_.onended=x};c.current=!0,k()}}).catch(()=>{})},[e,u]),f=b.useCallback(()=>{if(!r.current||!i.current||!s.current){c.current=!1;return}c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.onended=null);const g=i.current,m=s.current,v=r.current;m.gain.cancelScheduledValues(g.currentTime),m.gain.setValueAtTime(m.gain.value,g.currentTime),m.gain.linearRampToValueAtTime(0,g.currentTime+1),o.current=setTimeout(()=>{o.current=null,v&&v.pause()},1100)},[]);return b.useEffect(()=>{!t||!t.enabled||(n?p(t):f())},[n,t,p,f]),b.useEffect(()=>()=>{d()},[d]),b.useEffect(()=>{if(!t){d();return}if(r.current){const g=aE(t.source,e);if(r.current.src!==g){if(f(),a.current){try{a.current.disconnect()}catch{}a.current=null}r.current.pause(),r.current=null,n&&p(t)}}},[t==null?void 0:t.source,e]),null}function sI(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function aI(e){const[t,n]=b.useState(void 0);return It(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=e.offsetWidth,o=e.offsetHeight;n({width:a,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Dd="Switch",[YV]=bi(Dd),[XV,ZV]=YV(Dd),oI=b.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:a,disabled:o,value:l="on",onCheckedChange:c,form:d,...u}=e,[p,f]=b.useState(null),g=Le(t,S=>f(S)),m=b.useRef(!1),v=p?d||!!p.closest("form"):!0,[y,_]=Yi({prop:i,defaultProp:s??!1,onChange:c,caller:Dd});return h.jsxs(XV,{scope:n,checked:y,disabled:o,children:[h.jsx(we.button,{type:"button",role:"switch","aria-checked":y,"aria-required":a,"data-state":dI(y),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:g,onClick:ge(e.onClick,S=>{_(w=>!w),v&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),v&&h.jsx(uI,{control:p,bubbles:!m.current,name:r,value:l,checked:y,required:a,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});oI.displayName=Dd;var lI="SwitchThumb",cI=b.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=ZV(lI,n);return h.jsx(we.span,{"data-state":dI(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});cI.displayName=lI;var QV="SwitchBubbleInput",uI=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},s)=>{const a=b.useRef(null),o=Le(a,s),l=sI(n),c=aI(t);return b.useEffect(()=>{const d=a.current;if(!d)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&f){const g=new Event("click",{bubbles:r});f.call(d,n),d.dispatchEvent(g)}},[l,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});uI.displayName=QV;function dI(e){return e?"checked":"unchecked"}var hI=oI,JV=cI;const yw=b.forwardRef(({className:e,...t},n)=>h.jsx(hI,{className:X("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:h.jsx(JV,{className:X("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));yw.displayName=hI.displayName;function P0(e,[t,n]){return Math.min(n,Math.max(t,e))}function F0(e){const t=e7(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(n7);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function e7(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=i7(i),o=r7(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var t7=Symbol("radix.slottable");function n7(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===t7}function r7(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function i7(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pI(e){const t=e+"CollectionProvider",[n,r]=bi(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:v,children:y}=m,_=ft.useRef(null),S=ft.useRef(new Map).current;return h.jsx(i,{scope:v,itemMap:S,collectionRef:_,children:y})};a.displayName=t;const o=e+"CollectionSlot",l=F0(o),c=ft.forwardRef((m,v)=>{const{scope:y,children:_}=m,S=s(o,y),w=Le(v,S.collectionRef);return h.jsx(l,{ref:w,children:_})});c.displayName=o;const d=e+"CollectionItemSlot",u="data-radix-collection-item",p=F0(d),f=ft.forwardRef((m,v)=>{const{scope:y,children:_,...S}=m,w=ft.useRef(null),k=Le(v,w),x=s(d,y);return ft.useEffect(()=>(x.itemMap.set(w,{ref:w,...S}),()=>void x.itemMap.delete(w))),h.jsx(p,{[u]:"",ref:k,children:_})});f.displayName=d;function g(m){const v=s(e+"CollectionConsumer",m);return ft.useCallback(()=>{const _=v.collectionRef.current;if(!_)return[];const S=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((x,E)=>S.indexOf(x.ref.current)-S.indexOf(E.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:c,ItemSlot:f},g,r]}var s7=b.createContext(void 0);function _w(e){const t=b.useContext(s7);return e||t||"ltr"}const a7=["top","right","bottom","left"],di=Math.min,sn=Math.max,Nu=Math.round,uc=Math.floor,er=e=>({x:e,y:e}),o7={left:"right",right:"left",bottom:"top",top:"bottom"};function Sg(e,t,n){return sn(e,di(t,n))}function wr(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function Ra(e){return e.split("-")[1]}function vw(e){return e==="x"?"y":"x"}function Sw(e){return e==="y"?"height":"width"}function Yn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ww(e){return vw(Yn(e))}function l7(e,t,n){n===void 0&&(n=!1);const r=Ra(e),i=ww(e),s=Sw(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Ru(a)),[a,Ru(a)]}function c7(e){const t=Ru(e);return[wg(e),t,wg(t)]}function wg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const B0=["left","right"],j0=["right","left"],u7=["top","bottom"],d7=["bottom","top"];function h7(e,t,n){switch(e){case"top":case"bottom":return n?t?j0:B0:t?B0:j0;case"left":case"right":return t?u7:d7;default:return[]}}function p7(e,t,n,r){const i=Ra(e);let s=h7(xr(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(wg)))),s}function Ru(e){const t=xr(e);return o7[t]+e.slice(t.length)}function f7(e){return{top:0,right:0,bottom:0,left:0,...e}}function fI(e){return typeof e!="number"?f7(e):{top:e,right:e,bottom:e,left:e}}function Iu(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function U0(e,t,n){let{reference:r,floating:i}=e;const s=Yn(t),a=ww(t),o=Sw(a),l=xr(t),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,p=r[o]/2-i[o]/2;let f;switch(l){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-i.width,y:u};break;default:f={x:r.x,y:r.y}}switch(Ra(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1);break}return f}async function g7(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=wr(t,e),g=fI(f),v=o[p?u==="floating"?"reference":"floating":u],y=Iu(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:l})),_=u==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),w=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},k=Iu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:S,strategy:l}):_);return{top:(y.top-k.top+g.top)/w.y,bottom:(k.bottom-y.bottom+g.bottom)/w.y,left:(y.left-k.left+g.left)/w.x,right:(k.right-y.right+g.right)/w.x}}const m7=50,b7=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=a.detectOverflow?a:{...a,detectOverflow:g7},l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=U0(c,r,l),p=r,f=0;const g={};for(let m=0;m<s.length;m++){const v=s[m];if(!v)continue;const{name:y,fn:_}=v,{x:S,y:w,data:k,reset:x}=await _({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:g,rects:c,platform:o,elements:{reference:e,floating:t}});d=S??d,u=w??u,g[y]={...g[y],...k},x&&f<m7&&(f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:u}=U0(c,p,l)),m=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:g}},y7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=t,{element:c,padding:d=0}=wr(e,t)||{};if(c==null)return{};const u=fI(d),p={x:n,y:r},f=ww(i),g=Sw(f),m=await a.getDimensions(c),v=f==="y",y=v?"top":"left",_=v?"bottom":"right",S=v?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[f]-p[f]-s.floating[g],k=p[f]-s.reference[f],x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let E=x?x[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(x)))&&(E=o.floating[S]||s.floating[g]);const T=w/2-k/2,D=E/2-m[g]/2-1,R=di(u[y],D),I=di(u[_],D),O=R,N=E-m[g]-I,P=E/2-m[g]/2+T,F=Sg(O,P,N),B=!l.arrow&&Ra(i)!=null&&P!==F&&s.reference[g]/2-(P<O?R:I)-m[g]/2<0,j=B?P<O?P-O:P-N:0;return{[f]:p[f]+j,data:{[f]:F,centerOffset:P-F-j,...B&&{alignmentOffset:j}},reset:B}}}),_7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=wr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=xr(i),_=Yn(o),S=xr(o)===o,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(S||!m?[Ru(o)]:c7(o)),x=g!=="none";!p&&x&&k.push(...p7(o,m,g,w));const E=[o,...k],T=await l.detectOverflow(t,v),D=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(T[y]),u){const P=l7(i,a,w);D.push(T[P[0]],T[P[1]])}if(R=[...R,{placement:i,overflows:D}],!D.every(P=>P<=0)){var I,O;const P=(((I=s.flip)==null?void 0:I.index)||0)+1,F=E[P];if(F&&(!(u==="alignment"?_!==Yn(F):!1)||R.every(M=>Yn(M.placement)===_?M.overflows[0]>0:!0)))return{data:{index:P,overflows:R},reset:{placement:F}};let B=(O=R.filter(j=>j.overflows[0]<=0).sort((j,M)=>j.overflows[1]-M.overflows[1])[0])==null?void 0:O.placement;if(!B)switch(f){case"bestFit":{var N;const j=(N=R.filter(M=>{if(x){const U=Yn(M.placement);return U===_||U==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(U=>U>0).reduce((U,C)=>U+C,0)]).sort((M,U)=>M[1]-U[1])[0])==null?void 0:N[0];j&&(B=j);break}case"initialPlacement":B=o;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function $0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function z0(e){return a7.some(t=>e[t]>=0)}const v7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=wr(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),o=$0(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:z0(o)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),o=$0(a,n.floating);return{data:{escapedOffsets:o,escaped:z0(o)}}}default:return{}}}}},gI=new Set(["left","top"]);async function S7(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=xr(n),o=Ra(n),l=Yn(n)==="y",c=gI.has(a)?-1:1,d=s&&l?-1:1,u=wr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return o&&typeof g=="number"&&(f=o==="end"?g*-1:g),l?{x:f*d,y:p*c}:{x:p*c,y:f*d}}const w7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:o}=t,l=await S7(t,e);return a===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},x7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:_,y:S}=y;return{x:_,y:S}}},...c}=wr(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),p=Yn(xr(i)),f=vw(p);let g=d[f],m=d[p];if(a){const y=f==="y"?"top":"left",_=f==="y"?"bottom":"right",S=g+u[y],w=g-u[_];g=Sg(S,g,w)}if(o){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",S=m+u[y],w=m-u[_];m=Sg(S,m,w)}const v=l.fn({...t,[f]:g,[p]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:a,[p]:o}}}}}},E7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=wr(e,t),d={x:n,y:r},u=Yn(i),p=vw(u);let f=d[p],g=d[u];const m=wr(o,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const S=p==="y"?"height":"width",w=s.reference[p]-s.floating[S]+v.mainAxis,k=s.reference[p]+s.reference[S]-v.mainAxis;f<w?f=w:f>k&&(f=k)}if(c){var y,_;const S=p==="y"?"width":"height",w=gI.has(xr(i)),k=s.reference[u]-s.floating[S]+(w&&((y=a.offset)==null?void 0:y[u])||0)+(w?0:v.crossAxis),x=s.reference[u]+s.reference[S]+(w?0:((_=a.offset)==null?void 0:_[u])||0)-(w?v.crossAxis:0);g<k?g=k:g>x&&(g=x)}return{[p]:f,[u]:g}}}},k7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:a,elements:o}=t,{apply:l=()=>{},...c}=wr(e,t),d=await a.detectOverflow(t,c),u=xr(i),p=Ra(i),f=Yn(i)==="y",{width:g,height:m}=s.floating;let v,y;u==="top"||u==="bottom"?(v=u,y=p===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(y=u,v=p==="end"?"top":"bottom");const _=m-d.top-d.bottom,S=g-d.left-d.right,w=di(m-d[v],_),k=di(g-d[y],S),x=!t.middlewareData.shift;let E=w,T=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=_),x&&!p){const R=sn(d.left,0),I=sn(d.right,0),O=sn(d.top,0),N=sn(d.bottom,0);f?T=g-2*(R!==0||I!==0?R+I:sn(d.left,d.right)):E=m-2*(O!==0||N!==0?O+N:sn(d.top,d.bottom))}await l({...t,availableWidth:T,availableHeight:E});const D=await a.getDimensions(o.floating);return g!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function Md(){return typeof window<"u"}function Ia(e){return mI(e)?(e.nodeName||"").toLowerCase():"#document"}function cn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ir(e){var t;return(t=(mI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mI(e){return Md()?e instanceof Node||e instanceof cn(e).Node:!1}function Fn(e){return Md()?e instanceof Element||e instanceof cn(e).Element:!1}function Nr(e){return Md()?e instanceof HTMLElement||e instanceof cn(e).HTMLElement:!1}function H0(e){return!Md()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof cn(e).ShadowRoot}function Tl(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Bn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function C7(e){return/^(table|td|th)$/.test(Ia(e))}function Pd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const T7=/transform|translate|scale|rotate|perspective|filter/,A7=/paint|layout|strict|content/,Ci=e=>!!e&&e!=="none";let ap;function xw(e){const t=Fn(e)?Bn(e):e;return Ci(t.transform)||Ci(t.translate)||Ci(t.scale)||Ci(t.rotate)||Ci(t.perspective)||!Ew()&&(Ci(t.backdropFilter)||Ci(t.filter))||T7.test(t.willChange||"")||A7.test(t.contain||"")}function N7(e){let t=hi(e);for(;Nr(t)&&!da(t);){if(xw(t))return t;if(Pd(t))return null;t=hi(t)}return null}function Ew(){return ap==null&&(ap=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ap}function da(e){return/^(html|body|#document)$/.test(Ia(e))}function Bn(e){return cn(e).getComputedStyle(e)}function Fd(e){return Fn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hi(e){if(Ia(e)==="html")return e;const t=e.assignedSlot||e.parentNode||H0(e)&&e.host||ir(e);return H0(t)?t.host:t}function bI(e){const t=hi(e);return da(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nr(t)&&Tl(t)?t:bI(t)}function rl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=bI(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=cn(i);if(s){const o=xg(a);return t.concat(a,a.visualViewport||[],Tl(i)?i:[],o&&n?rl(o):[])}else return t.concat(i,rl(i,[],n))}function xg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yI(e){const t=Bn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Nr(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,o=Nu(n)!==s||Nu(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function kw(e){return Fn(e)?e:e.contextElement}function Js(e){const t=kw(e);if(!Nr(t))return er(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=yI(t);let a=(s?Nu(n.width):n.width)/r,o=(s?Nu(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const R7=er(0);function _I(e){const t=cn(e);return!Ew()||!t.visualViewport?R7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function I7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==cn(e)?!1:t}function es(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=kw(e);let a=er(1);t&&(r?Fn(r)&&(a=Js(r)):a=Js(e));const o=I7(s,n,r)?_I(s):er(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,d=i.width/a.x,u=i.height/a.y;if(s){const p=cn(s),f=r&&Fn(r)?cn(r):r;let g=p,m=xg(g);for(;m&&r&&f!==g;){const v=Js(m),y=m.getBoundingClientRect(),_=Bn(m),S=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*v.x,w=y.top+(m.clientTop+parseFloat(_.paddingTop))*v.y;l*=v.x,c*=v.y,d*=v.x,u*=v.y,l+=S,c+=w,g=cn(m),m=xg(g)}}return Iu({width:d,height:u,x:l,y:c})}function Bd(e,t){const n=Fd(e).scrollLeft;return t?t.left+n:es(ir(e)).left+n}function vI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bd(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function O7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=ir(r),o=t?Pd(t.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=er(1);const d=er(0),u=Nr(r);if((u||!u&&!s)&&((Ia(r)!=="body"||Tl(a))&&(l=Fd(r)),u)){const f=es(r);c=Js(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=a&&!u&&!s?vI(a,l):er(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function L7(e){return Array.from(e.getClientRects())}function D7(e){const t=ir(e),n=Fd(e),r=e.ownerDocument.body,i=sn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=sn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Bd(e);const o=-n.scrollTop;return Bn(r).direction==="rtl"&&(a+=sn(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}const G0=25;function M7(e,t){const n=cn(e),r=ir(e),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const d=Ew();(!d||d&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}const c=Bd(r);if(c<=0){const d=r.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-f);g<=G0&&(s-=g)}else c<=G0&&(s+=c);return{width:s,height:a,x:o,y:l}}function P7(e,t){const n=es(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Nr(e)?Js(e):er(1),a=e.clientWidth*s.x,o=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function W0(e,t,n){let r;if(t==="viewport")r=M7(e,n);else if(t==="document")r=D7(ir(e));else if(Fn(t))r=P7(t,n);else{const i=_I(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Iu(r)}function SI(e,t){const n=hi(e);return n===t||!Fn(n)||da(n)?!1:Bn(n).position==="fixed"||SI(n,t)}function F7(e,t){const n=t.get(e);if(n)return n;let r=rl(e,[],!1).filter(o=>Fn(o)&&Ia(o)!=="body"),i=null;const s=Bn(e).position==="fixed";let a=s?hi(e):e;for(;Fn(a)&&!da(a);){const o=Bn(a),l=xw(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Tl(a)&&!l&&SI(e,a))?r=r.filter(d=>d!==a):i=o,a=hi(a)}return t.set(e,r),r}function B7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?Pd(t)?[]:F7(t,this._c):[].concat(n),r],o=W0(t,a[0],i);let l=o.top,c=o.right,d=o.bottom,u=o.left;for(let p=1;p<a.length;p++){const f=W0(t,a[p],i);l=sn(f.top,l),c=di(f.right,c),d=di(f.bottom,d),u=sn(f.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function j7(e){const{width:t,height:n}=yI(e);return{width:t,height:n}}function U7(e,t,n){const r=Nr(t),i=ir(t),s=n==="fixed",a=es(e,!0,s,t);let o={scrollLeft:0,scrollTop:0};const l=er(0);function c(){l.x=Bd(i)}if(r||!r&&!s)if((Ia(t)!=="body"||Tl(i))&&(o=Fd(t)),r){const f=es(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?vI(i,o):er(0),u=a.left+o.scrollLeft-l.x-d.x,p=a.top+o.scrollTop-l.y-d.y;return{x:u,y:p,width:a.width,height:a.height}}function op(e){return Bn(e).position==="static"}function V0(e,t){if(!Nr(e)||Bn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ir(e)===n&&(n=n.ownerDocument.body),n}function wI(e,t){const n=cn(e);if(Pd(e))return n;if(!Nr(e)){let i=hi(e);for(;i&&!da(i);){if(Fn(i)&&!op(i))return i;i=hi(i)}return n}let r=V0(e,t);for(;r&&C7(r)&&op(r);)r=V0(r,t);return r&&da(r)&&op(r)&&!xw(r)?n:r||N7(e)||n}const $7=async function(e){const t=this.getOffsetParent||wI,n=this.getDimensions,r=await n(e.floating);return{reference:U7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function z7(e){return Bn(e).direction==="rtl"}const H7={convertOffsetParentRelativeRectToViewportRelativeRect:O7,getDocumentElement:ir,getClippingRect:B7,getOffsetParent:wI,getElementRects:$7,getClientRects:L7,getDimensions:j7,getScale:Js,isElement:Fn,isRTL:z7};function xI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function G7(e,t){let n=null,r;const i=ir(e);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=c;if(o||t(),!p||!f)return;const g=uc(u),m=uc(i.clientWidth-(d+p)),v=uc(i.clientHeight-(u+f)),y=uc(d),S={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:sn(0,di(1,l))||1};let w=!0;function k(x){const E=x[0].intersectionRatio;if(E!==l){if(!w)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!xI(c,e.getBoundingClientRect())&&a(),w=!1}try{n=new IntersectionObserver(k,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,S)}n.observe(e)}return a(!0),s}function W7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=kw(e),d=i||s?[...c?rl(c):[],...t?rl(t):[]]:[];d.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const u=c&&o?G7(c,n):null;let p=-1,f=null;a&&(f=new ResizeObserver(y=>{let[_]=y;_&&_.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=f)==null||S.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let g,m=l?es(e):null;l&&v();function v(){const y=es(e);m&&!xI(m,y)&&n(),m=y,g=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),u==null||u(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const V7=w7,q7=x7,K7=_7,Y7=k7,X7=v7,q0=y7,Z7=E7,Q7=(e,t,n)=>{const r=new Map,i={platform:H7,...n},s={...i.platform,_c:r};return b7(e,t,{...i,platform:s})};var J7=typeof document<"u",eq=function(){},Fc=J7?b.useLayoutEffect:eq;function Ou(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ou(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Ou(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function EI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function K0(e,t){const n=EI(e);return Math.round(t*n)/n}function lp(e){const t=b.useRef(e);return Fc(()=>{t.current=e}),t}function tq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=e,[d,u]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=b.useState(r);Ou(p,r)||f(r);const[g,m]=b.useState(null),[v,y]=b.useState(null),_=b.useCallback(M=>{M!==x.current&&(x.current=M,m(M))},[]),S=b.useCallback(M=>{M!==E.current&&(E.current=M,y(M))},[]),w=s||g,k=a||v,x=b.useRef(null),E=b.useRef(null),T=b.useRef(d),D=l!=null,R=lp(l),I=lp(i),O=lp(c),N=b.useCallback(()=>{if(!x.current||!E.current)return;const M={placement:t,strategy:n,middleware:p};I.current&&(M.platform=I.current),Q7(x.current,E.current,M).then(U=>{const C={...U,isPositioned:O.current!==!1};P.current&&!Ou(T.current,C)&&(T.current=C,ma.flushSync(()=>{u(C)}))})},[p,t,n,I,O]);Fc(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(M=>({...M,isPositioned:!1})))},[c]);const P=b.useRef(!1);Fc(()=>(P.current=!0,()=>{P.current=!1}),[]),Fc(()=>{if(w&&(x.current=w),k&&(E.current=k),w&&k){if(R.current)return R.current(w,k,N);N()}},[w,k,N,R,D]);const F=b.useMemo(()=>({reference:x,floating:E,setReference:_,setFloating:S}),[_,S]),B=b.useMemo(()=>({reference:w,floating:k}),[w,k]),j=b.useMemo(()=>{const M={position:n,left:0,top:0};if(!B.floating)return M;const U=K0(B.floating,d.x),C=K0(B.floating,d.y);return o?{...M,transform:"translate("+U+"px, "+C+"px)",...EI(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:C}},[n,o,B.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:N,refs:F,elements:B,floatingStyles:j}),[d,N,F,B,j])}const nq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?q0({element:r.current,padding:i}).fn(n):{}:r?q0({element:r,padding:i}).fn(n):{}}}},rq=(e,t)=>{const n=V7(e);return{name:n.name,fn:n.fn,options:[e,t]}},iq=(e,t)=>{const n=q7(e);return{name:n.name,fn:n.fn,options:[e,t]}},sq=(e,t)=>({fn:Z7(e).fn,options:[e,t]}),aq=(e,t)=>{const n=K7(e);return{name:n.name,fn:n.fn,options:[e,t]}},oq=(e,t)=>{const n=Y7(e);return{name:n.name,fn:n.fn,options:[e,t]}},lq=(e,t)=>{const n=X7(e);return{name:n.name,fn:n.fn,options:[e,t]}},cq=(e,t)=>{const n=nq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var uq="Arrow",kI=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(we.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});kI.displayName=uq;var dq=kI,Cw="Popper",[CI,jd]=bi(Cw),[hq,TI]=CI(Cw),AI=e=>{const{__scopePopper:t,children:n}=e,[r,i]=b.useState(null);return h.jsx(hq,{scope:t,anchor:r,onAnchorChange:i,children:n})};AI.displayName=Cw;var NI="PopperAnchor",RI=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=TI(NI,n),a=b.useRef(null),o=Le(t,a),l=b.useRef(null);return b.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(we.div,{...i,ref:o})});RI.displayName=NI;var Tw="PopperContent",[pq,fq]=CI(Tw),II=b.forwardRef((e,t)=>{var W,re,ce,ue,he,me;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,v=TI(Tw,n),[y,_]=b.useState(null),S=Le(t,le=>_(le)),[w,k]=b.useState(null),x=aI(w),E=(x==null?void 0:x.width)??0,T=(x==null?void 0:x.height)??0,D=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(c)?c:[c],O=I.length>0,N={padding:R,boundary:I.filter(mq),altBoundary:O},{refs:P,floatingStyles:F,placement:B,isPositioned:j,middlewareData:M}=tq({strategy:"fixed",placement:D,whileElementsMounted:(...le)=>W7(...le,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[rq({mainAxis:i+T,alignmentAxis:a}),l&&iq({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?sq():void 0,...N}),l&&aq({...N}),oq({...N,apply:({elements:le,rects:xt,availableWidth:Rr,availableHeight:Ir})=>{const{width:Or,height:Wd}=xt.reference,wi=le.floating.style;wi.setProperty("--radix-popper-available-width",`${Rr}px`),wi.setProperty("--radix-popper-available-height",`${Ir}px`),wi.setProperty("--radix-popper-anchor-width",`${Or}px`),wi.setProperty("--radix-popper-anchor-height",`${Wd}px`)}}),w&&cq({element:w,padding:o}),bq({arrowWidth:E,arrowHeight:T}),p&&lq({strategy:"referenceHidden",...N})]}),[U,C]=DI(B),H=ci(g);It(()=>{j&&(H==null||H())},[j,H]);const Z=(W=M.arrow)==null?void 0:W.x,L=(re=M.arrow)==null?void 0:re.y,se=((ce=M.arrow)==null?void 0:ce.centerOffset)!==0,[_e,$]=b.useState();return It(()=>{y&&$(window.getComputedStyle(y).zIndex)},[y]),h.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:j?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:_e,"--radix-popper-transform-origin":[(ue=M.transformOrigin)==null?void 0:ue.x,(he=M.transformOrigin)==null?void 0:he.y].join(" "),...((me=M.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(pq,{scope:n,placedSide:U,onArrowChange:k,arrowX:Z,arrowY:L,shouldHideArrow:se,children:h.jsx(we.div,{"data-side":U,"data-align":C,...m,ref:S,style:{...m.style,animation:j?void 0:"none"}})})})});II.displayName=Tw;var OI="PopperArrow",gq={top:"bottom",right:"left",bottom:"top",left:"right"},LI=b.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=fq(OI,r),a=gq[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(dq,{...i,ref:n,style:{...i.style,display:"block"}})})});LI.displayName=OI;function mq(e){return e!==null}var bq=e=>({name:"transformOrigin",options:e,fn(t){var v,y,_;const{placement:n,rects:r,middlewareData:i}=t,a=((v=i.arrow)==null?void 0:v.centerOffset)!==0,o=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[c,d]=DI(n),u={start:"0%",center:"50%",end:"100%"}[d],p=(((y=i.arrow)==null?void 0:y.x)??0)+o/2,f=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=a?u:`${p}px`,m=`${-l}px`):c==="top"?(g=a?u:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=a?u:`${f}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=a?u:`${f}px`),{data:{x:g,y:m}}}});function DI(e){const[t,n="center"]=e.split("-");return[t,n]}var MI=AI,Aw=RI,PI=II,FI=LI;function yq(e){const t=_q(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(Sq);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function _q(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=xq(i),o=wq(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vq=Symbol("radix.slottable");function Sq(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vq}function wq(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function xq(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var BI=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Eq="VisuallyHidden",kq=b.forwardRef((e,t)=>h.jsx(we.span,{...e,ref:t,style:{...BI,...e.style}}));kq.displayName=Eq;var Cq=[" ","Enter","ArrowUp","ArrowDown"],Tq=[" ","Enter"],ts="Select",[Ud,$d,Aq]=pI(ts),[Oa]=bi(ts,[Aq,jd]),zd=jd(),[Nq,_i]=Oa(ts),[Rq,Iq]=Oa(ts),jI=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:l,dir:c,name:d,autoComplete:u,disabled:p,required:f,form:g}=e,m=zd(t),[v,y]=b.useState(null),[_,S]=b.useState(null),[w,k]=b.useState(!1),x=_w(c),[E,T]=Yi({prop:r,defaultProp:i??!1,onChange:s,caller:ts}),[D,R]=Yi({prop:a,defaultProp:o,onChange:l,caller:ts}),I=b.useRef(null),O=v?g||!!v.closest("form"):!0,[N,P]=b.useState(new Set),F=Array.from(N).map(B=>B.props.value).join(";");return h.jsx(MI,{...m,children:h.jsxs(Nq,{required:f,scope:t,trigger:v,onTriggerChange:y,valueNode:_,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:k,contentId:br(),value:D,onValueChange:R,open:E,onOpenChange:T,dir:x,triggerPointerDownPosRef:I,disabled:p,children:[h.jsx(Ud.Provider,{scope:t,children:h.jsx(Rq,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(B=>{P(j=>new Set(j).add(B))},[]),onNativeOptionRemove:b.useCallback(B=>{P(j=>{const M=new Set(j);return M.delete(B),M})},[]),children:n})}),O?h.jsxs(uO,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:u,value:D,onChange:B=>R(B.target.value),disabled:p,form:g,children:[D===void 0?h.jsx("option",{value:""}):null,Array.from(N)]},F):null]})})};jI.displayName=ts;var UI="SelectTrigger",$I=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=zd(n),a=_i(UI,n),o=a.disabled||r,l=Le(t,a.onTriggerChange),c=$d(n),d=b.useRef("touch"),[u,p,f]=hO(m=>{const v=c().filter(S=>!S.disabled),y=v.find(S=>S.value===a.value),_=pO(v,m,y);_!==void 0&&a.onValueChange(_.value)}),g=m=>{o||(a.onOpenChange(!0),f()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(Aw,{asChild:!0,...s,children:h.jsx(we.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":dO(a.value)?"":void 0,...i,ref:l,onClick:ge(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:ge(i.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ge(i.onKeyDown,m=>{const v=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(v&&m.key===" ")&&Cq.includes(m.key)&&(g(),m.preventDefault())})})})});$I.displayName=UI;var zI="SelectValue",HI=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...o}=e,l=_i(zI,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,u=Le(t,l.onValueNodeChange);return It(()=>{c(d)},[c,d]),h.jsx(we.span,{...o,ref:u,style:{pointerEvents:"none"},children:dO(l.value)?h.jsx(h.Fragment,{children:a}):s})});HI.displayName=zI;var Oq="SelectIcon",GI=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return h.jsx(we.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});GI.displayName=Oq;var Lq="SelectPortal",WI=e=>h.jsx(cd,{asChild:!0,...e});WI.displayName=Lq;var ns="SelectContent",VI=b.forwardRef((e,t)=>{const n=_i(ns,e.__scopeSelect),[r,i]=b.useState();if(It(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ma.createPortal(h.jsx(qI,{scope:e.__scopeSelect,children:h.jsx(Ud.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),s):null}return h.jsx(KI,{...e,ref:t})});VI.displayName=ns;var Nn=10,[qI,vi]=Oa(ns),Dq="SelectContentImpl",Mq=yq("SelectContent.RemoveScroll"),KI=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:v,...y}=e,_=_i(ns,n),[S,w]=b.useState(null),[k,x]=b.useState(null),E=Le(t,W=>w(W)),[T,D]=b.useState(null),[R,I]=b.useState(null),O=$d(n),[N,P]=b.useState(!1),F=b.useRef(!1);b.useEffect(()=>{if(S)return Mm(S)},[S]),Dm();const B=b.useCallback(W=>{const[re,...ce]=O().map(me=>me.ref.current),[ue]=ce.slice(-1),he=document.activeElement;for(const me of W)if(me===he||(me==null||me.scrollIntoView({block:"nearest"}),me===re&&k&&(k.scrollTop=0),me===ue&&k&&(k.scrollTop=k.scrollHeight),me==null||me.focus(),document.activeElement!==he))return},[O,k]),j=b.useCallback(()=>B([T,S]),[B,T,S]);b.useEffect(()=>{N&&j()},[N,j]);const{onOpenChange:M,triggerPointerDownPosRef:U}=_;b.useEffect(()=>{if(S){let W={x:0,y:0};const re=ue=>{var he,me;W={x:Math.abs(Math.round(ue.pageX)-(((he=U.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((me=U.current)==null?void 0:me.y)??0))}},ce=ue=>{W.x<=10&&W.y<=10?ue.preventDefault():S.contains(ue.target)||M(!1),document.removeEventListener("pointermove",re),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",ce,{capture:!0})}}},[S,M,U]),b.useEffect(()=>{const W=()=>M(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[M]);const[C,H]=hO(W=>{const re=O().filter(he=>!he.disabled),ce=re.find(he=>he.ref.current===document.activeElement),ue=pO(re,W,ce);ue&&setTimeout(()=>ue.ref.current.focus())}),Z=b.useCallback((W,re,ce)=>{const ue=!F.current&&!ce;(_.value!==void 0&&_.value===re||ue)&&(D(W),ue&&(F.current=!0))},[_.value]),L=b.useCallback(()=>S==null?void 0:S.focus(),[S]),se=b.useCallback((W,re,ce)=>{const ue=!F.current&&!ce;(_.value!==void 0&&_.value===re||ue)&&I(W)},[_.value]),_e=r==="popper"?Eg:YI,$=_e===Eg?{side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return h.jsx(qI,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:Z,selectedItem:T,onItemLeave:L,itemTextRefCallback:se,focusSelectedItem:j,selectedItemText:R,position:r,isPositioned:N,searchRef:C,children:h.jsx(dd,{as:Mq,allowPinchZoom:!0,children:h.jsx(ld,{asChild:!0,trapped:_.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:ge(i,W=>{var re;(re=_.trigger)==null||re.focus({preventScroll:!0}),W.preventDefault()}),children:h.jsx(od,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:h.jsx(_e,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:W=>W.preventDefault(),...y,...$,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ge(y.onKeyDown,W=>{const re=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!re&&W.key.length===1&&H(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let ue=O().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(W.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const he=W.target,me=ue.indexOf(he);ue=ue.slice(me+1)}setTimeout(()=>B(ue)),W.preventDefault()}})})})})})})});KI.displayName=Dq;var Pq="SelectItemAlignedPosition",YI=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=_i(ns,n),a=vi(ns,n),[o,l]=b.useState(null),[c,d]=b.useState(null),u=Le(t,E=>d(E)),p=$d(n),f=b.useRef(!1),g=b.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:y,focusSelectedItem:_}=a,S=b.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&c&&m&&v&&y){const E=s.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),R=y.getBoundingClientRect();if(s.dir!=="rtl"){const he=R.left-T.left,me=D.left-he,le=E.left-me,xt=E.width+le,Rr=Math.max(xt,T.width),Ir=window.innerWidth-Nn,Or=P0(me,[Nn,Math.max(Nn,Ir-Rr)]);o.style.minWidth=xt+"px",o.style.left=Or+"px"}else{const he=T.right-R.right,me=window.innerWidth-D.right-he,le=window.innerWidth-E.right-me,xt=E.width+le,Rr=Math.max(xt,T.width),Ir=window.innerWidth-Nn,Or=P0(me,[Nn,Math.max(Nn,Ir-Rr)]);o.style.minWidth=xt+"px",o.style.right=Or+"px"}const I=p(),O=window.innerHeight-Nn*2,N=m.scrollHeight,P=window.getComputedStyle(c),F=parseInt(P.borderTopWidth,10),B=parseInt(P.paddingTop,10),j=parseInt(P.borderBottomWidth,10),M=parseInt(P.paddingBottom,10),U=F+B+N+M+j,C=Math.min(v.offsetHeight*5,U),H=window.getComputedStyle(m),Z=parseInt(H.paddingTop,10),L=parseInt(H.paddingBottom,10),se=E.top+E.height/2-Nn,_e=O-se,$=v.offsetHeight/2,W=v.offsetTop+$,re=F+B+W,ce=U-re;if(re<=se){const he=I.length>0&&v===I[I.length-1].ref.current;o.style.bottom="0px";const me=c.clientHeight-m.offsetTop-m.offsetHeight,le=Math.max(_e,$+(he?L:0)+me+j),xt=re+le;o.style.height=xt+"px"}else{const he=I.length>0&&v===I[0].ref.current;o.style.top="0px";const le=Math.max(se,F+m.offsetTop+(he?Z:0)+$)+ce;o.style.height=le+"px",m.scrollTop=re-se+m.offsetTop}o.style.margin=`${Nn}px 0`,o.style.minHeight=C+"px",o.style.maxHeight=O+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,o,c,m,v,y,s.dir,r]);It(()=>S(),[S]);const[w,k]=b.useState();It(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=b.useCallback(E=>{E&&g.current===!0&&(S(),_==null||_(),g.current=!1)},[S,_]);return h.jsx(Bq,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:f,onScrollButtonChange:x,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:h.jsx(we.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});YI.displayName=Pq;var Fq="SelectPopperPosition",Eg=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Nn,...s}=e,a=zd(n);return h.jsx(PI,{...a,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Eg.displayName=Fq;var[Bq,Nw]=Oa(ns,{}),kg="SelectViewport",XI=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=vi(kg,n),a=Nw(kg,n),o=Le(t,s.onViewportChange),l=b.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Ud.Slot,{scope:n,children:h.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ge(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:p}=a;if(p!=null&&p.current&&u){const f=Math.abs(l.current-d.scrollTop);if(f>0){const g=window.innerHeight-Nn*2,m=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),y=Math.max(m,v);if(y<g){const _=y+f,S=Math.min(g,_),w=_-S;u.style.height=S+"px",u.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,u.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});XI.displayName=kg;var ZI="SelectGroup",[jq,Uq]=Oa(ZI),QI=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=br();return h.jsx(jq,{scope:n,id:i,children:h.jsx(we.div,{role:"group","aria-labelledby":i,...r,ref:t})})});QI.displayName=ZI;var JI="SelectLabel",eO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Uq(JI,n);return h.jsx(we.div,{id:i.id,...r,ref:t})});eO.displayName=JI;var Lu="SelectItem",[$q,tO]=Oa(Lu),nO=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=e,o=_i(Lu,n),l=vi(Lu,n),c=o.value===r,[d,u]=b.useState(s??""),[p,f]=b.useState(!1),g=Le(t,_=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,_,r,i)}),m=br(),v=b.useRef("touch"),y=()=>{i||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx($q,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:b.useCallback(_=>{u(S=>S||((_==null?void 0:_.textContent)??"").trim())},[]),children:h.jsx(Ud.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:h.jsx(we.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:g,onFocus:ge(a.onFocus,()=>f(!0)),onBlur:ge(a.onBlur,()=>f(!1)),onClick:ge(a.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:ge(a.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:ge(a.onPointerDown,_=>{v.current=_.pointerType}),onPointerMove:ge(a.onPointerMove,_=>{var S;v.current=_.pointerType,i?(S=l.onItemLeave)==null||S.call(l):v.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(a.onPointerLeave,_=>{var S;_.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ge(a.onKeyDown,_=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&_.key===" "||(Tq.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});nO.displayName=Lu;var lo="SelectItemText",rO=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,a=_i(lo,n),o=vi(lo,n),l=tO(lo,n),c=Iq(lo,n),[d,u]=b.useState(null),p=Le(t,y=>u(y),l.onItemTextChange,y=>{var _;return(_=o.itemTextRefCallback)==null?void 0:_.call(o,y,l.value,l.disabled)}),f=d==null?void 0:d.textContent,g=b.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=c;return It(()=>(m(g),()=>v(g)),[m,v,g]),h.jsxs(h.Fragment,{children:[h.jsx(we.span,{id:l.textId,...s,ref:p}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ma.createPortal(s.children,a.valueNode):null]})});rO.displayName=lo;var iO="SelectItemIndicator",sO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return tO(iO,n).isSelected?h.jsx(we.span,{"aria-hidden":!0,...r,ref:t}):null});sO.displayName=iO;var Cg="SelectScrollUpButton",aO=b.forwardRef((e,t)=>{const n=vi(Cg,e.__scopeSelect),r=Nw(Cg,e.__scopeSelect),[i,s]=b.useState(!1),a=Le(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?h.jsx(lO,{...e,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});aO.displayName=Cg;var Tg="SelectScrollDownButton",oO=b.forwardRef((e,t)=>{const n=vi(Tg,e.__scopeSelect),r=Nw(Tg,e.__scopeSelect),[i,s]=b.useState(!1),a=Le(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?h.jsx(lO,{...e,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});oO.displayName=Tg;var lO=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=vi("SelectScrollButton",n),a=b.useRef(null),o=$d(n),l=b.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),It(()=>{var d;const c=o().find(u=>u.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),h.jsx(we.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ge(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:ge(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:ge(i.onPointerLeave,()=>{l()})})}),zq="SelectSeparator",cO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(we.div,{"aria-hidden":!0,...r,ref:t})});cO.displayName=zq;var Ag="SelectArrow",Hq=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=zd(n),s=_i(Ag,n),a=vi(Ag,n);return s.open&&a.position==="popper"?h.jsx(FI,{...i,...r,ref:t}):null});Hq.displayName=Ag;var Gq="SelectBubbleInput",uO=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=b.useRef(null),s=Le(r,i),a=sI(t);return b.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&d){const u=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(u)}},[a,t]),h.jsx(we.select,{...n,style:{...BI,...n.style},ref:s,defaultValue:t})});uO.displayName=Gq;function dO(e){return e===""||e===void 0}function hO(e){const t=ci(e),n=b.useRef(""),r=b.useRef(0),i=b.useCallback(a=>{const o=n.current+a;t(o),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(o)},[t]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function pO(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=Wq(e,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Wq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vq=jI,fO=$I,qq=HI,Kq=GI,Yq=WI,gO=VI,Xq=XI,Zq=QI,mO=eO,bO=nO,Qq=rO,Jq=sO,yO=aO,_O=oO,vO=cO;const Du=Vq,cp=Zq,Mu=qq,il=b.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(fO,{ref:r,className:X("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(Kq,{asChild:!0,children:h.jsx(pl,{className:"h-4 w-4 opacity-50"})})]}));il.displayName=fO.displayName;const SO=b.forwardRef(({className:e,...t},n)=>h.jsx(yO,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(VT,{className:"h-4 w-4"})}));SO.displayName=yO.displayName;const wO=b.forwardRef(({className:e,...t},n)=>h.jsx(_O,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(pl,{className:"h-4 w-4"})}));wO.displayName=_O.displayName;const sl=b.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Yq,{children:h.jsxs(gO,{ref:i,className:X("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(SO,{}),h.jsx(Xq,{className:X("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(wO,{})]})}));sl.displayName=gO.displayName;const Bc=b.forwardRef(({className:e,...t},n)=>h.jsx(mO,{ref:n,className:X("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Bc.displayName=mO.displayName;const mn=b.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(bO,{ref:r,className:X("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Jq,{children:h.jsx(WT,{className:"h-4 w-4"})})}),h.jsx(Qq,{children:t})]}));mn.displayName=bO.displayName;const eK=b.forwardRef(({className:e,...t},n)=>h.jsx(vO,{ref:n,className:X("-mx-1 my-1 h-px bg-muted",e),...t}));eK.displayName=vO.displayName;function tK(e){const t=nK(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(iK);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function nK(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=aK(i),o=sK(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rK=Symbol("radix.slottable");function iK(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rK}function sK(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function aK(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd="Popover",[xO]=bi(Hd,[jd]),Al=jd(),[oK,Si]=xO(Hd),EO=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,o=Al(t),l=b.useRef(null),[c,d]=b.useState(!1),[u,p]=Yi({prop:r,defaultProp:i??!1,onChange:s,caller:Hd});return h.jsx(MI,{...o,children:h.jsx(oK,{scope:t,contentId:br(),triggerRef:l,open:u,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:a,children:n})})};EO.displayName=Hd;var kO="PopoverAnchor",lK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(kO,n),s=Al(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=i;return b.useEffect(()=>(a(),()=>o()),[a,o]),h.jsx(Aw,{...s,...r,ref:t})});lK.displayName=kO;var CO="PopoverTrigger",TO=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(CO,n),s=Al(n),a=Le(t,i.triggerRef),o=h.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":OO(i.open),...r,ref:a,onClick:ge(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:h.jsx(Aw,{asChild:!0,...s,children:o})});TO.displayName=CO;var Rw="PopoverPortal",[cK,uK]=xO(Rw,{forceMount:void 0}),AO=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Si(Rw,t);return h.jsx(cK,{scope:t,forceMount:n,children:h.jsx(ls,{present:n||s.open,children:h.jsx(cd,{asChild:!0,container:i,children:r})})})};AO.displayName=Rw;var ha="PopoverContent",NO=b.forwardRef((e,t)=>{const n=uK(ha,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Si(ha,e.__scopePopover);return h.jsx(ls,{present:r||s.open,children:s.modal?h.jsx(hK,{...i,ref:t}):h.jsx(pK,{...i,ref:t})})});NO.displayName=ha;var dK=tK("PopoverContent.RemoveScroll"),hK=b.forwardRef((e,t)=>{const n=Si(ha,e.__scopePopover),r=b.useRef(null),i=Le(t,r),s=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return Mm(a)},[]),h.jsx(dd,{as:dK,allowPinchZoom:!0,children:h.jsx(RO,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),s.current||(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,c=o.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),pK=b.forwardRef((e,t)=>{const n=Si(ha,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return h.jsx(RO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),RO=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,p=Si(ha,n),f=Al(n);return Dm(),h.jsx(ld,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(od,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:h.jsx(PI,{"data-state":OO(p.open),role:"dialog",id:p.contentId,...f,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),IO="PopoverClose",fK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(IO,n);return h.jsx(we.button,{type:"button",...r,ref:t,onClick:ge(e.onClick,()=>i.onOpenChange(!1))})});fK.displayName=IO;var gK="PopoverArrow",mK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Al(n);return h.jsx(FI,{...i,...r,ref:t})});mK.displayName=gK;function OO(e){return e?"open":"closed"}var bK=EO,yK=TO,_K=AO,LO=NO;const vK=bK,SK=yK,DO=b.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(_K,{children:h.jsx(LO,{ref:i,align:t,sideOffset:n,className:X("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));DO.displayName=LO.displayName;function wK({projectId:e,config:t,onChange:n}){var k;const[r,i]=b.useState([]),[s,a]=b.useState([]),[o,l]=b.useState(null),[c,d]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{JP().then(i).catch(console.error),vh(e).then(a).catch(console.error)},[e]);const p=x=>{n({...t,...x})},f=async x=>{if(x.startsWith("preset:")){const E=x.replace("preset:",""),T=r.find(D=>D.id===E);if(T&&!T.downloaded){l(E);try{await eF(E),i(R=>R.map(I=>I.id===E?{...I,downloaded:!0}:I));const D=await vh(e);a(D)}catch(D){console.error("Failed to download preset:",D),l(null);return}l(null)}}p({source:x})},g=async x=>{const E=u.current;E&&(E.dataset.scope=x,E.click())},m=async x=>{var D;const E=(D=x.target.files)==null?void 0:D[0];if(!E)return;const T=x.target.dataset.scope||"global";d(!0);try{const{name:R}=await tF(E,T,e),I=await vh(e);a(I),p({source:`${T==="project"?"project":"global"}:${R}`})}catch(R){console.error("Upload failed:",R)}finally{d(!1),x.target.value=""}},v=s.filter(x=>x.source.startsWith("preset:")),y=s.filter(x=>x.source.startsWith("global:")),_=s.filter(x=>x.source.startsWith("project:")),S=r.filter(x=>!x.downloaded&&!v.some(E=>E.source===`preset:${x.id}`)),w=t.playMode==="interval"||t.playMode==="auto"&&((k=r.find(x=>`preset:${x.id}`===t.source))==null?void 0:k.type)==="strike";return h.jsxs(vK,{children:[h.jsx(SK,{asChild:!0,children:h.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",children:h.jsx(wF,{className:`h-4 w-4 ${t.enabled?"text-primary":""}`})})}),h.jsx(DO,{className:"w-[300px]",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(je,{className:"text-sm font-medium",children:"背景音效"}),h.jsx(yw,{checked:t.enabled,onCheckedChange:x=>p({enabled:x})})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"音源"}),h.jsxs(Du,{value:t.source,onValueChange:f,children:[h.jsx(il,{className:"h-8 text-xs",children:h.jsx(Mu,{placeholder:"选择音源"})}),h.jsxs(sl,{children:[(v.length>0||S.length>0)&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"预设音效"}),v.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source)),S.map(x=>h.jsx(mn,{value:`preset:${x.id}`,className:"text-xs",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[x.name,o===x.id?h.jsx(vo,{className:"h-3 w-3 animate-spin"}):h.jsx(pu,{className:"h-3 w-3 text-muted-foreground"})]})},`preset:${x.id}`))]}),y.length>0&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"全局自定义"}),y.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source))]}),_.length>0&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"项目自定义"}),_.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source))]})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"播放模式"}),h.jsxs(Du,{value:t.playMode,onValueChange:x=>p({playMode:x}),children:[h.jsx(il,{className:"h-8 text-xs",children:h.jsx(Mu,{})}),h.jsxs(sl,{children:[h.jsx(mn,{value:"auto",className:"text-xs",children:"自动"}),h.jsx(mn,{value:"loop",className:"text-xs",children:"循环"}),h.jsx(mn,{value:"interval",className:"text-xs",children:"随机间隔"})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs(je,{className:"text-xs text-muted-foreground",children:["音量: ",Math.round(t.volume*100),"%"]}),h.jsx("input",{type:"range",min:0,max:100,value:Math.round(t.volume*100),onChange:x=>p({volume:Number(x.target.value)/100}),className:"w-full h-1.5 accent-primary cursor-pointer"})]}),w&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"间隔范围(秒)"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"number",min:1,value:t.intervalRange[0],onChange:x=>p({intervalRange:[Number(x.target.value),t.intervalRange[1]]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"~"}),h.jsx("input",{type:"number",min:1,value:t.intervalRange[1],onChange:x=>p({intervalRange:[t.intervalRange[0],Number(x.target.value)]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"})]})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(te,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("global"),children:[c?h.jsx(vo,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(gf,{className:"h-3 w-3 mr-1"}),"上传全局"]}),h.jsxs(te,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("project"),children:[c?h.jsx(vo,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(gf,{className:"h-3 w-3 mr-1"}),"上传项目"]})]}),h.jsx("input",{ref:u,type:"file",accept:"audio/*",className:"hidden",onChange:m})]})})]})}const xK=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,EK=5,kK=3e3;function CK(e,t){const n=b.useRef(null),r=b.useRef(0),i=b.useRef(!0),s=b.useRef(t);s.current=t;const a=b.useRef(!1),o=b.useCallback(f=>{var g;((g=n.current)==null?void 0:g.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(f))},[]),l=b.useCallback((f,g)=>{var m;((m=n.current)==null?void 0:m.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:f,rows:g})),a.current=!1):a.current=!0},[]),c=b.useCallback(f=>{o({type:"terminal_input",data:f})},[o]),d=b.useCallback((f,g)=>{o({type:"terminal_resize",cols:f,rows:g})},[o]),u=b.useCallback(()=>{o({type:"chat_subscribe"})},[o]),p=b.useCallback(()=>{if(!i.current)return;const f=kr();if(!f){window.location.href="/login";return}const g=new WebSocket(`${xK}/ws/projects/${e}`);n.current=g,g.onopen=()=>{r.current=0,g.send(JSON.stringify({type:"auth",token:f}))},g.onmessage=m=>{var y,_,S,w,k,x,E,T;let v;try{v=JSON.parse(m.data)}catch{return}switch(v.type){case"connected":a.current=!1,(_=(y=s.current).onConnected)==null||_.call(y);break;case"terminal_data":(w=(S=s.current).onTerminalData)==null||w.call(S,v.data);break;case"status":(x=(k=s.current).onStatus)==null||x.call(k,v.status);break;case"chat_message":{const D=v;(T=(E=s.current).onChatMessage)==null||T.call(E,D);break}case"error":console.error("[WS] Server error:",v.message);break}},g.onclose=()=>{n.current=null,i.current&&r.current<EK&&(r.current++,setTimeout(p,kK))},g.onerror=m=>{console.error("[WS] WebSocket error:",m)}},[e]);return b.useEffect(()=>(i.current=!0,p(),()=>{var f;i.current=!1,(f=n.current)==null||f.close(),n.current=null}),[p]),{subscribeTerminal:l,sendTerminalInput:c,sendTerminalResize:d,subscribeChatMessages:u}}function up({icon:e,label:t,content:n}){const[r,i]=b.useState(!1);return h.jsxs("div",{className:"border border-border rounded mt-1.5",children:[h.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(s=>!s),children:[h.jsx(sd,{className:X("h-3 w-3 transition-transform",r&&"rotate-90")}),h.jsx(e,{className:"h-3 w-3"}),h.jsx("span",{className:"truncate",children:t})]}),r&&h.jsx("pre",{className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})]})}function TK({blocks:e}){return h.jsx(h.Fragment,{children:e.map((t,n)=>t.type==="text"?h.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:h.jsx(lR,{remarkPlugins:[OR],children:t.content})},n):t.type==="thinking"?h.jsx(up,{icon:Rm,label:"Thinking...",content:t.content},n):t.type==="tool_use"?h.jsx(up,{icon:PF,label:t.content.split("(")[0],content:t.content},n):t.type==="tool_result"?h.jsx(up,{icon:hF,label:"Result",content:t.content},n):null)})}function AK({messages:e,onSend:t,readOnly:n}){const[r,i]=b.useState(""),s=b.useRef(null),a=b.useRef(null);b.useEffect(()=>{var d;(d=s.current)==null||d.scrollIntoView({behavior:"smooth"})},[e.length]);const o=()=>{const d=r.trim();d&&(t(d+"\r"),i(""),a.current&&(a.current.style.height="auto"))},l=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())},c=d=>{d.style.height="auto",d.style.height=Math.min(d.scrollHeight,120)+"px"};return h.jsxs("div",{className:"flex flex-col h-full bg-background",children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[e.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"等待对话..."}),e.map((d,u)=>h.jsx("div",{className:X("flex",d.role==="user"?"justify-end":"justify-start"),children:h.jsxs("div",{className:X("max-w-[85%] rounded-lg px-3 py-2 text-sm",d.role==="user"?"bg-blue-600 text-white dark:bg-blue-500":"bg-muted"),children:[h.jsx(TK,{blocks:d.blocks}),h.jsx("div",{className:"text-[10px] opacity-50 mt-1",children:new Date(d.timestamp).toLocaleTimeString()})]})},u)),h.jsx("div",{ref:s})]}),!n&&h.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end flex-shrink-0",children:[h.jsx("textarea",{ref:a,value:r,onChange:d=>{i(d.target.value),c(d.target)},onKeyDown:l,placeholder:"输入消息...",rows:1,className:"flex-1 resize-none bg-muted rounded-md px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring",style:{maxHeight:"120px"}}),h.jsx("button",{onClick:o,disabled:!r.trim(),className:"p-2 rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex-shrink-0",children:h.jsx(AF,{className:"h-4 w-4"})})]})]})}function NK({status:e}){const t={running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"};return h.jsxs("span",{className:X("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",t[e]),children:[h.jsx("span",{className:X("w-1.5 h-1.5 rounded-full",{"bg-green-500":e==="running","bg-muted-foreground":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function RK(){const{id:e}=lM(),t=ss(),[n,r]=b.useState(null),[i,s]=b.useState(!0),[a,o]=b.useState(!1),[l,c]=b.useState(!1),[d,u]=b.useState({enabled:!1,source:"preset:rain",playMode:"auto",volume:.5,intervalRange:[3,8]}),[p,f]=b.useState(!1),g=b.useRef(null),[m,v]=b.useState("terminal"),[y,_]=b.useState([]),S=async()=>{if(e){c(!0);try{await KP(e)}catch($){alert($ instanceof Error?$.message:"备份失败")}finally{c(!1)}}},[w,k]=b.useState(()=>{try{return localStorage.getItem("cc_panel_filetree")!=="false"}catch{return!0}}),[x,E]=b.useState(()=>{try{return localStorage.getItem("cc_panel_shortcuts")!=="false"}catch{return!0}}),T=()=>k($=>(localStorage.setItem("cc_panel_filetree",String(!$)),!$)),D=()=>E($=>(localStorage.setItem("cc_panel_shortcuts",String(!$)),!$)),[R,I]=b.useState(!1);b.useEffect(()=>{const $=()=>I(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$),()=>document.removeEventListener("fullscreenchange",$)},[]);const O=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},N=b.useRef(null),P=b.useRef(null),F=b.useRef(null),B=b.useRef(null),j=b.useCallback($=>{var W;(W=N.current)==null||W.write($),f(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>f(!1),3e3)},[]),M=b.useCallback(()=>{var W;const $=P.current;$&&F.current&&F.current($.cols,$.rows),(W=B.current)==null||W.call(B)},[]),{subscribeTerminal:U,sendTerminalInput:C,sendTerminalResize:H,subscribeChatMessages:Z}=CK(e??"",{onTerminalData:j,onStatus:$=>r(W=>W&&{...W,status:$}),onConnected:M,onChatMessage:$=>{_(W=>[...W,$])}});b.useEffect(()=>{F.current=U},[U]),b.useEffect(()=>{B.current=Z},[Z]);const L=b.useCallback(($,W)=>{P.current={cols:$,rows:W},M()},[M]);b.useEffect(()=>{if(!e)return;(async()=>{try{const re=(await UT()).find(ce=>ce.id===e)??null;r(re),re!=null&&re.sound&&u(re.sound)}catch(W){console.error("Failed to load project:",W)}finally{s(!1)}})()},[e]);const se=async()=>{if(n){o(!0);try{r(await kP(n.id))}catch($){console.error($)}finally{o(!1)}}},_e=async()=>{if(n){o(!0);try{r(await CP(n.id))}catch($){console.error($)}finally{o(!1)}}};return i?h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})}):!n||!e?h.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background",children:[h.jsx("p",{className:"text-muted-foreground",children:"Project not found."}),h.jsxs(te,{variant:"outline",onClick:()=>t("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Back to Dashboard"]})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[h.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:h.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[h.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>t("/"),children:h.jsx(Wo,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",w?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:T,title:"Toggle file tree",children:h.jsx(EF,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",x?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:D,title:"Toggle right panel",children:h.jsx(kF,{className:"h-4 w-4"})}),h.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-1",children:[h.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:n.name}),h.jsx(NK,{status:n.status}),h.jsx(dr,{variant:"outline",className:"text-xs",children:n.permissionMode==="unlimited"?"Unlimited":"Limited"}),h.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:n.folderPath})]}),h.jsx(RA,{className:"mr-2"}),h.jsx(OA,{}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:O,title:R?"退出全屏":"全屏",children:R?h.jsx(Om,{className:"h-3.5 w-3.5"}):h.jsx(Im,{className:"h-3.5 w-3.5"})}),e&&h.jsx(wK,{projectId:e,config:d,onChange:$=>{u($),nF(e,$)}}),h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void S(),disabled:l,title:"备份到云盘",children:[l?h.jsx(vo,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):h.jsx(MF,{className:"h-3.5 w-3.5 mr-1.5"}),"备份"]}),n.status==="running"||n.status==="restarting"?h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void se(),disabled:a,children:[h.jsx(OF,{className:"h-3.5 w-3.5 mr-1.5"}),"Stop"]}):h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void _e(),disabled:a,children:[h.jsx(CF,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})}),h.jsxs("div",{className:"flex-1 overflow-hidden flex min-h-0",children:[w&&h.jsx("div",{className:"w-56 flex-shrink-0 border-r border-border overflow-hidden",children:h.jsx(FV,{projectPath:n.folderPath})}),h.jsxs("div",{className:"flex-1 overflow-hidden min-w-0 flex flex-col",children:[h.jsxs("div",{className:"flex items-center border-b border-border bg-muted/30 px-2 h-8 flex-shrink-0",children:[h.jsxs("button",{onClick:()=>v("terminal"),className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="terminal"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(ff,{className:"h-3 w-3"}),"终端"]}),h.jsxs("button",{onClick:()=>v("chat"),className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="chat"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(_F,{className:"h-3 w-3"}),"对话"]})]}),h.jsx("div",{className:X("flex-1 min-h-0",m!=="terminal"&&"hidden"),children:h.jsx(xN,{ref:N,onInput:C,onResize:($,W)=>{P.current={cols:$,rows:W},H($,W)},onReady:L})}),m==="chat"&&h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(AK,{messages:y,onSend:C,readOnly:(n==null?void 0:n._sharedPermission)==="view"})})]}),x&&h.jsx("div",{className:"w-52 flex-shrink-0 border-l border-border overflow-hidden",children:h.jsx(GV,{projectId:e,onSend:C})})]}),e&&h.jsx(KV,{projectId:e,config:d,isActive:p})]})}var dp="rovingFocusGroup.onEntryFocus",IK={bubbles:!1,cancelable:!0},Nl="RovingFocusGroup",[Ng,MO,OK]=pI(Nl),[LK,PO]=bi(Nl,[OK]),[DK,MK]=LK(Nl),FO=b.forwardRef((e,t)=>h.jsx(Ng.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Ng.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(PK,{...e,ref:t})})}));FO.displayName=Nl;var PK=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,p=b.useRef(null),f=Le(t,p),g=_w(s),[m,v]=Yi({prop:a,defaultProp:o??null,onChange:l,caller:Nl}),[y,_]=b.useState(!1),S=ci(c),w=MO(n),k=b.useRef(!1),[x,E]=b.useState(0);return b.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(dp,S),()=>T.removeEventListener(dp,S)},[S]),h.jsx(DK,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:b.useCallback(T=>v(T),[v]),onItemShiftTab:b.useCallback(()=>_(!0),[]),onFocusableItemAdd:b.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:b.useCallback(()=>E(T=>T-1),[]),children:h.jsx(we.div,{tabIndex:y||x===0?-1:0,"data-orientation":r,...u,ref:f,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{k.current=!0}),onFocus:ge(e.onFocus,T=>{const D=!k.current;if(T.target===T.currentTarget&&D&&!y){const R=new CustomEvent(dp,IK);if(T.currentTarget.dispatchEvent(R),!R.defaultPrevented){const I=w().filter(B=>B.focusable),O=I.find(B=>B.active),N=I.find(B=>B.id===m),F=[O,N,...I].filter(Boolean).map(B=>B.ref.current);UO(F,d)}}k.current=!1}),onBlur:ge(e.onBlur,()=>_(!1))})})}),BO="RovingFocusGroupItem",jO=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:a,...o}=e,l=br(),c=s||l,d=MK(BO,n),u=d.currentTabStopId===c,p=MO(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=d;return b.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),h.jsx(Ng.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(we.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...o,ref:t,onMouseDown:ge(e.onMouseDown,v=>{r?d.onItemFocus(c):v.preventDefault()}),onFocus:ge(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:ge(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=jK(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=p().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")S.reverse();else if(y==="prev"||y==="next"){y==="prev"&&S.reverse();const w=S.indexOf(v.currentTarget);S=d.loop?UK(S,w+1):S.slice(w+1)}setTimeout(()=>UO(S))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})});jO.displayName=BO;var FK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BK(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jK(e,t,n){const r=BK(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return FK[r]}function UO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function UK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $K=FO,zK=jO,Gd="Tabs",[HK]=bi(Gd,[PO]),$O=PO(),[GK,Iw]=HK(Gd),zO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:o,activationMode:l="automatic",...c}=e,d=_w(o),[u,p]=Yi({prop:r,onChange:i,defaultProp:s??"",caller:Gd});return h.jsx(GK,{scope:n,baseId:br(),value:u,onValueChange:p,orientation:a,dir:d,activationMode:l,children:h.jsx(we.div,{dir:d,"data-orientation":a,...c,ref:t})})});zO.displayName=Gd;var HO="TabsList",GO=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,s=Iw(HO,n),a=$O(n);return h.jsx($K,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:h.jsx(we.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});GO.displayName=HO;var WO="TabsTrigger",VO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=e,a=Iw(WO,n),o=$O(n),l=YO(a.baseId,r),c=XO(a.baseId,r),d=r===a.value;return h.jsx(zK,{asChild:!0,...o,focusable:!i,active:d,children:h.jsx(we.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:t,onMouseDown:ge(e.onMouseDown,u=>{!i&&u.button===0&&u.ctrlKey===!1?a.onValueChange(r):u.preventDefault()}),onKeyDown:ge(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&a.onValueChange(r)}),onFocus:ge(e.onFocus,()=>{const u=a.activationMode!=="manual";!d&&!i&&u&&a.onValueChange(r)})})})});VO.displayName=WO;var qO="TabsContent",KO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...a}=e,o=Iw(qO,n),l=YO(o.baseId,r),c=XO(o.baseId,r),d=r===o.value,u=b.useRef(d);return b.useEffect(()=>{const p=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(ls,{present:i||d,children:({present:p})=>h.jsx(we.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:p&&s})})});KO.displayName=qO;function YO(e,t){return`${e}-trigger-${t}`}function XO(e,t){return`${e}-content-${t}`}var WK=zO,ZO=GO,QO=VO,JO=KO;const VK=WK,eL=b.forwardRef(({className:e,...t},n)=>h.jsx(ZO,{ref:n,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));eL.displayName=ZO.displayName;const jc=b.forwardRef(({className:e,...t},n)=>h.jsx(QO,{ref:n,className:X("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));jc.displayName=QO.displayName;const Uc=b.forwardRef(({className:e,...t},n)=>h.jsx(JO,{ref:n,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Uc.displayName=JO.displayName;const Y0={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function qK({open:e,onOpenChange:t,onAdded:n}){const[r,i]=b.useState([]),[s,a]=b.useState(!1),[o,l]=b.useState(null),[c,d]=b.useState(""),[u,p]=b.useState(""),[f,g]=b.useState(""),[m,v]=b.useState(""),[y,_]=b.useState(!1),[S,w]=b.useState(null);b.useEffect(()=>{e&&WP().then(D=>i(D.available)).catch(()=>i([]))},[e]);const k=()=>{a(!1),l(null),d(""),p(""),g(""),v(""),_(!1),w(null)},x=async D=>{l(D),w(null);try{const{id:R}=await iE({type:D,label:Y0[D]||D}),{url:I}=await df(R);window.open(I,"_blank"),k(),t(!1),n()}catch(R){w(R instanceof Error?R.message:"添加失败"),l(null)}},E=async()=>{if(!c||!u||!f||!m){w("请填写所有字段");return}_(!0),w(null);try{const{id:D}=await iE({type:c,label:u,clientId:f,clientSecret:m}),{url:R}=await df(D);window.open(R,"_blank"),k(),t(!1),n()}catch(D){w(D instanceof Error?D.message:"添加失败")}finally{_(!1)}},T=r.length>0;return h.jsx(_a,{open:e,onOpenChange:D=>{t(D),D||k()},children:h.jsxs(cs,{className:"sm:max-w-md",children:[h.jsxs(us,{children:[h.jsxs(hs,{className:"flex items-center gap-2",children:[h.jsx(hf,{className:"h-5 w-5"}),"添加云盘账号"]}),h.jsx(ps,{children:s?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"云盘类型"}),h.jsxs(Du,{value:c,onValueChange:d,children:[h.jsx(il,{children:h.jsx(Mu,{placeholder:"选择云盘类型"})}),h.jsxs(sl,{children:[h.jsx(mn,{value:"google-drive",children:"Google Drive"}),h.jsx(mn,{value:"onedrive",children:"OneDrive"}),h.jsx(mn,{value:"dropbox",children:"Dropbox"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"显示名称"}),h.jsx(wn,{placeholder:"例如:我的 Google Drive",value:u,onChange:D=>p(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"Client ID"}),h.jsx(wn,{placeholder:"OAuth Client ID",value:f,onChange:D=>g(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"Client Secret"}),h.jsx(wn,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:D=>v(D.target.value)})]}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S})]}),h.jsxs(ds,{children:[h.jsx(te,{variant:"outline",onClick:()=>{a(!1),w(null)},children:"返回"}),h.jsx(te,{onClick:E,disabled:y,children:y?"添加中...":"添加并授权"})]})]}):h.jsxs("div",{className:"space-y-3 py-2",children:[T?h.jsx(h.Fragment,{children:r.map(D=>h.jsx(te,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void x(D),disabled:o!==null,children:o===D?"连接中...":`连接 ${Y0[D]||D}`},D))}):h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S}),h.jsx("div",{className:"pt-2 border-t border-border",children:h.jsxs("button",{onClick:()=>{a(!0),w(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(NF,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const KK={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function YK({type:e}){switch(e){case"google-drive":return h.jsx(oE,{className:"h-5 w-5 text-blue-500"});case"onedrive":return h.jsx(hf,{className:"h-5 w-5 text-sky-500"});case"dropbox":return h.jsx(oE,{className:"h-5 w-5 text-indigo-500"});default:return h.jsx(hf,{className:"h-5 w-5"})}}function XK({provider:e,onDelete:t,onReauth:n}){var a;const[r,i]=b.useState(!1),s=()=>{r?(t(e.id),i(!1)):(i(!0),setTimeout(()=>i(!1),3e3))};return h.jsxs(td,{children:[h.jsx(nd,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(YK,{type:e.type}),h.jsxs("div",{children:[h.jsx(rd,{className:"text-base",children:e.label}),h.jsx("p",{className:"text-sm text-muted-foreground",children:KK[e.type]||e.type})]})]}),h.jsx(dr,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),h.jsxs(id,{children:[e.authorized&&((a=e.tokens)==null?void 0:a.expiry)&&h.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(te,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[h.jsx(Ki,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),h.jsxs(te,{variant:r?"destructive":"outline",size:"sm",onClick:s,children:[h.jsx(Lm,{className:"h-3.5 w-3.5 mr-1"}),r?"确认删除?":"删除"]})]})]})]})}const ZK={success:{label:"成功",icon:cF,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:FF,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:aF,className:"bg-yellow-600 hover:bg-yellow-700"}};function QK(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;const i=Math.floor(r/60),s=r%60;return`${i}分${s}秒`}function JK(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function eY({history:e}){const t=e.slice(0,20);return t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[h.jsx(uF,{className:"h-10 w-10 mb-3 opacity-50"}),h.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b",children:[h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),h.jsx("tbody",{children:t.map(n=>{const r=ZK[n.status],i=r.icon;return h.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:JK(n.startTime)}),h.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),h.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),h.jsxs("td",{className:"py-2.5 px-2",children:[h.jsxs(dr,{className:r.className,children:[h.jsx(i,{className:"h-3 w-3 mr-1"}),r.label]}),n.error&&h.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),h.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:QK(n.startTime,n.endTime)})]},n.id)})})]})})}const X0=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],tY=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function nY(){const e=ss(),[t,n]=b.useState([]),[r,i]=b.useState(!0),[s,a]=b.useState(!1),[o,l]=b.useState({enabled:!1,intervalMinutes:60}),[c,d]=b.useState(!0),[u,p]=b.useState([]),[f,g]=b.useState(!0),[m,v]=b.useState(""),[y,_]=b.useState(!1),[S,w]=b.useState(!1),[k,x]=b.useState([]),[E,T]=b.useState(!0),D=async()=>{try{const C=await VP();n(C)}catch{}finally{i(!1)}},R=async()=>{try{const C=await YP();l(C)}catch{}finally{d(!1)}},I=async()=>{try{const C=await XP();p(C.length>0?C:X0)}catch{p(X0)}finally{g(!1)}},O=async()=>{try{const C=await QP();x(C)}catch{}finally{T(!1)}};b.useEffect(()=>{D(),R(),I(),O()},[]);const N=async C=>{try{await qP(C),n(H=>H.filter(Z=>Z.id!==C))}catch{}},P=async C=>{try{const{url:H}=await df(C);window.open(H,"_blank")}catch{}},F=async C=>{const H={...o,enabled:C};l(H);try{await sE({enabled:C})}catch{l(o)}},B=async C=>{const H=parseInt(C,10),Z={...o,intervalMinutes:H};l(Z);try{await sE({intervalMinutes:H})}catch{l(o)}},j=()=>{const C=m.trim();!C||u.includes(C)||(p(H=>[...H,C]),v(""),_(!0))},M=C=>{p(H=>H.filter(Z=>Z!==C)),_(!0)},U=async()=>{w(!0);try{await ZP(u),_(!1)}catch{}finally{w(!1)}};return h.jsx("div",{className:"min-h-screen bg-background",children:h.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),h.jsxs(VK,{defaultValue:"providers",children:[h.jsxs(eL,{className:"mb-4",children:[h.jsx(jc,{value:"providers",children:"云盘账号"}),h.jsx(jc,{value:"strategy",children:"备份策略"}),h.jsx(jc,{value:"history",children:"备份记录"})]}),h.jsxs(Uc,{value:"providers",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(te,{onClick:()=>a(!0),children:[h.jsx(oa,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),r?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):h.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>h.jsx(XK,{provider:C,onDelete:N,onReauth:P},C.id))})]}),h.jsx(qK,{open:s,onOpenChange:a,onAdded:()=>void D()})]}),h.jsx(Uc,{value:"strategy",children:h.jsxs("div",{className:"space-y-8",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),f?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(C=>h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,h.jsx("button",{onClick:()=>M(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:h.jsx(os,{className:"h-3 w-3"})})]},C))}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(wn,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&j()},className:"max-w-xs"}),h.jsx(te,{variant:"outline",size:"sm",onClick:j,children:"添加"})]}),y&&h.jsxs(te,{onClick:U,disabled:S,children:[h.jsx(KT,{className:"h-4 w-4 mr-1"}),S?"保存中...":"保存"]})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),c?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(yw,{checked:o.enabled,onCheckedChange:F}),h.jsx(je,{children:o.enabled?"已开启":"已关闭"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"备份间隔"}),h.jsxs(Du,{value:String(o.intervalMinutes),onValueChange:B,children:[h.jsx(il,{className:"w-48",children:h.jsx(Mu,{})}),h.jsx(sl,{children:tY.map(C=>h.jsx(mn,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),h.jsx(Uc,{value:"history",children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{T(!0),O()},children:[h.jsx(Ki,{className:"h-4 w-4 mr-1"}),"刷新"]})}),E?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):h.jsx(eY,{history:k})]})})]})]})})}function rY(){const e=ss(),[t,n]=b.useState([]),[r,i]=b.useState(!0),[s,a]=b.useState(null),[o,l]=b.useState(""),[c,d]=b.useState(null),[u,p]=b.useState(null),[f,g]=b.useState(null),[m,v]=b.useState(new Set);b.useEffect(()=>{FP().then(n).catch(k=>a(k instanceof Error?k.message:"Failed to load SkillHub")).finally(()=>i(!1))},[]);const y=b.useMemo(()=>{const k=new Set;return t.forEach(x=>{var E;return(E=x.tags)==null?void 0:E.forEach(T=>k.add(T))}),Array.from(k).sort()},[t]),_=b.useMemo(()=>t.some(k=>!k.tags||k.tags.length===0),[t]),S=b.useMemo(()=>{let k=t;if(c==="__untagged__"?k=k.filter(x=>!x.tags||x.tags.length===0):c&&(k=k.filter(x=>{var E;return(E=x.tags)==null?void 0:E.includes(c)})),o.trim()){const x=o.toLowerCase();k=k.filter(E=>{var T;return E.label.toLowerCase().includes(x)||E.description.toLowerCase().includes(x)||E.command.toLowerCase().includes(x)||E.author.toLowerCase().includes(x)||((T=E.tags)==null?void 0:T.some(D=>D.toLowerCase().includes(x)))})}return k},[t,o,c]),w=async(k,x)=>{if(x.stopPropagation(),!(f||m.has(k.id))){g(k.id);try{await jP(k.id),v(E=>new Set(E).add(k.id)),n(E=>E.map(T=>T.id===k.id?{...T,downloads:(T.downloads||0)+1}:T))}catch(E){alert(E instanceof Error?E.message:"Download failed")}finally{g(null)}}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"relative w-64",children:[h.jsx(TF,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(wn,{placeholder:"搜索命令...",value:o,onChange:k=>l(k.target.value),className:"pl-8 h-9"})]})]})}),h.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[y.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(null),children:"全部"}),y.map(k=>h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===k?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(c===k?null:k),children:k},k)),_&&h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(c==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),s&&h.jsx("div",{className:"text-center text-destructive py-20",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[h.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),h.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!r&&!s&&t.length>0&&S.length===0&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),h.jsx("div",{className:"space-y-3",children:S.map(k=>{var R;const x=u===k.id,E=m.has(k.id),T=f===k.id,D=k.parentId?t.find(I=>I.id===k.parentId):void 0;return h.jsxs("div",{className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>p(x?null:k.id),children:[h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-medium text-sm truncate",children:k.label}),(R=k.tags)==null?void 0:R.map(I=>h.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[h.jsx(DF,{className:"h-2.5 w-2.5"}),I]},I))]}),D&&h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(_o,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",D.label]})]}),k.description&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:k.description}),h.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(YT,{className:"h-3 w-3"}),k.author]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(pu,{className:"h-3 w-3"}),k.downloads||0]}),h.jsx("span",{children:k.createdAt})]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsxs(te,{size:"sm",variant:E?"outline":"default",disabled:T||E,onClick:I=>w(k,I),title:D?`将同时下载继承的「${D.label}」`:void 0,children:[h.jsx(pu,{className:"h-3.5 w-3.5 mr-1"}),E?"已下载":T?"下载中...":"下载"]}),x?h.jsx(VT,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(pl,{className:"h-4 w-4 text-muted-foreground"})]})]}),x&&h.jsx("div",{className:"mt-3 pt-3 border-t",children:h.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:k.command})})]},k.id)})})]})]})}function dc({children:e}){const[t,n]=b.useState(!1),[r,i]=b.useState(!1);return b.useEffect(()=>{if(kr()){i(!0),n(!0);return}uf()?jT().then(a=>{cf(a),i(!0)}).catch(()=>{i(!1)}).finally(()=>n(!0)):n(!0)},[]),t?r?h.jsx(h.Fragment,{children:e}):h.jsx(ET,{to:"/login",replace:!0}):null}function iY(){return h.jsx(L3,{children:h.jsx(TM,{children:h.jsxs(EM,{children:[h.jsx(Ni,{path:"/login",element:h.jsx(rF,{})}),h.jsx(Ni,{path:"/",element:h.jsx(dc,{children:h.jsx(D3,{})})}),h.jsx(Ni,{path:"/projects/:id",element:h.jsx(dc,{children:h.jsx(RK,{})})}),h.jsx(Ni,{path:"/settings",element:h.jsx(dc,{children:h.jsx(nY,{})})}),h.jsx(Ni,{path:"/skillhub",element:h.jsx(dc,{children:h.jsx(rY,{})})}),h.jsx(Ni,{path:"*",element:h.jsx(ET,{to:"/",replace:!0})})]})})})}hp.createRoot(document.getElementById("root")).render(h.jsx(ft.StrictMode,{children:h.jsx(iY,{})}));export{Pu as a,$c as c,sY as g};
|
|
546
|
+
`)}`}function $V({session:e,onClose:t,onRecall:n}){return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),h.jsxs("div",{className:"relative z-10 w-[600px] max-w-[90vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-lg shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-sm font-medium text-foreground",children:rI(e.startedAt)}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white transition-colors",onClick:()=>{n(iI(e)),t()},children:[h.jsx(Rm,{className:"h-3 w-3"}),"回忆"]}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground transition-colors p-0.5",onClick:t,children:h.jsx(os,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:[e.messages.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),e.messages.map((r,i)=>h.jsxs("div",{className:X("flex gap-2.5",r.role==="user"?"flex-row-reverse":"flex-row"),children:[h.jsx("div",{className:X("flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",r.role==="user"?"bg-blue-600/20":"bg-muted"),children:r.role==="user"?h.jsx(YT,{className:"h-3 w-3 text-blue-400"}):h.jsx(GT,{className:"h-3 w-3 text-muted-foreground"})}),h.jsx("div",{className:X("max-w-[85%] text-xs rounded-lg px-3 py-2 whitespace-pre-wrap break-words",r.role==="user"?"bg-blue-600/20 text-blue-100 dark:text-blue-100 border border-blue-500/20":"bg-muted text-foreground border border-border"),children:r.content})]},i))]})]})]})}function zV({projectId:e,onSend:t}){var d;const[n,r]=b.useState([]),[i,s]=b.useState(null),a=n.filter(u=>u.messageCount>0),o=(d=a.find(u=>!u.isCurrent))==null?void 0:d.id;b.useEffect(()=>{let u=null;const p=()=>{document.hidden||nE(e).then(r).catch(()=>{})};nE(e).then(r).catch(()=>r([]));const f=()=>{u=setInterval(p,5e3)},g=()=>{u&&(clearInterval(u),u=null)},m=()=>{document.hidden?g():f()};return f(),document.addEventListener("visibilitychange",m),()=>{g(),document.removeEventListener("visibilitychange",m)}},[e]);const l=async u=>{try{s(await rE(e,u))}catch{}},c=u=>{t(u+"\r")};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[a.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(GT,{className:"h-5 w-5"}),h.jsx("p",{className:"text-xs text-center",children:"暂无历史记录"})]}),a.map(u=>{const p=u.isCurrent,f=!u.isCurrent&&u.id===o;return h.jsxs("div",{className:X("group rounded border bg-muted hover:border-muted-foreground/30 transition-colors",p?"border-blue-500/50":"border-border"),children:[h.jsxs("button",{className:"w-full text-left px-3 pt-2 pb-1",onClick:()=>void l(u.id),children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground",children:rI(u.startedAt)}),p&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-blue-500/20 text-blue-400 border border-blue-500/30 leading-none",children:"当前"}),f&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground border border-border leading-none",children:"最近"})]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[u.messageCount," 条消息"]})]}),h.jsx("div",{className:"px-3 pb-2 flex justify-end",children:h.jsxs("button",{className:"flex items-center gap-1 text-[10px] px-2 py-0.5 rounded bg-secondary hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:async g=>{g.stopPropagation();try{const m=await rE(e,u.id);c(iI(m))}catch{}},children:[h.jsx(Rm,{className:"h-2.5 w-2.5"}),"回忆"]})})]},u.id)})]}),i&&h.jsx($V,{session:i,onClose:()=>s(null),onRecall:c})]})}const HV={shortcuts:"快捷命令",history:"历史记录"};function GV({projectId:e,onSend:t}){const[n,r]=b.useState("shortcuts");return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[h.jsx("div",{className:"flex border-b border-border flex-shrink-0",children:["shortcuts","history"].map(i=>h.jsx("button",{onClick:()=>r(i),className:X("flex-1 text-xs py-2 font-medium transition-colors",n===i?"text-foreground border-b-2 border-blue-500 -mb-px bg-muted/50":"text-muted-foreground hover:text-foreground"),children:HV[i]},i))}),n==="shortcuts"&&h.jsx(UV,{projectId:e,onSend:t}),n==="history"&&h.jsx(zV,{projectId:e,onSend:t})]})}const WV=new Set(["preset:wind","preset:rain","preset:stream"]),VV=new Set(["preset:singing-bowl","preset:water-drops","preset:keyboard"]);function qV(e){return e.playMode!=="auto"?e.playMode:WV.has(e.source)?"loop":VV.has(e.source)?"interval":"loop"}function KV({projectId:e,config:t,isActive:n}){const r=b.useRef(null),i=b.useRef(null),s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null),c=b.useRef(!1),d=b.useCallback(()=>{if(o.current&&(clearTimeout(o.current),o.current=null),l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.pause(),r.current.src=""),a.current){try{a.current.disconnect()}catch{}a.current=null}if(s.current){try{s.current.disconnect()}catch{}s.current=null}if(i.current){try{i.current.close()}catch{}i.current=null}r.current=null,c.current=!1},[]),u=b.useCallback(g=>{if(!r.current||r.current.src!==g){if(a.current){try{a.current.disconnect()}catch{}a.current=null}r.current&&r.current.pause();const m=new Audio(g);m.crossOrigin="anonymous",r.current=m}if(i.current||(i.current=new AudioContext),!s.current){const m=i.current.createGain();m.gain.value=0,m.connect(i.current.destination),s.current=m}if(!a.current){const m=i.current.createMediaElementSource(r.current);m.connect(s.current),a.current=m}return{audio:r.current,ctx:i.current,gain:s.current}},[]),p=b.useCallback(g=>{const m=aE(g.source,e),v=Math.max(0,Math.min(1,g.volume)),y=qV(g),{audio:_,ctx:S,gain:w}=u(m);S.resume().then(()=>{if(o.current&&(clearTimeout(o.current),o.current=null),l.current&&(clearTimeout(l.current),l.current=null),y==="loop")_.loop=!0,_.currentTime=0,_.play().catch(()=>{}),c.current=!0,w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(v,S.currentTime+.5);else{_.loop=!1;const k=()=>{if(!c.current)return;_.currentTime=0,_.play().catch(()=>{}),w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(v,S.currentTime+.5);const x=()=>{if(!c.current)return;const[E,T]=g.intervalRange,D=(E+Math.random()*(T-E))*1e3;l.current=setTimeout(k,D)};_.onended=x};c.current=!0,k()}}).catch(()=>{})},[e,u]),f=b.useCallback(()=>{if(!r.current||!i.current||!s.current){c.current=!1;return}c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.onended=null);const g=i.current,m=s.current,v=r.current;m.gain.cancelScheduledValues(g.currentTime),m.gain.setValueAtTime(m.gain.value,g.currentTime),m.gain.linearRampToValueAtTime(0,g.currentTime+1),o.current=setTimeout(()=>{o.current=null,v&&v.pause()},1100)},[]);return b.useEffect(()=>{!t||!t.enabled||(n?p(t):f())},[n,t,p,f]),b.useEffect(()=>()=>{d()},[d]),b.useEffect(()=>{if(!t){d();return}if(r.current){const g=aE(t.source,e);if(r.current.src!==g){if(f(),a.current){try{a.current.disconnect()}catch{}a.current=null}r.current.pause(),r.current=null,n&&p(t)}}},[t==null?void 0:t.source,e]),null}function sI(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function aI(e){const[t,n]=b.useState(void 0);return It(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=e.offsetWidth,o=e.offsetHeight;n({width:a,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Dd="Switch",[YV]=bi(Dd),[XV,ZV]=YV(Dd),oI=b.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:a,disabled:o,value:l="on",onCheckedChange:c,form:d,...u}=e,[p,f]=b.useState(null),g=Le(t,S=>f(S)),m=b.useRef(!1),v=p?d||!!p.closest("form"):!0,[y,_]=Yi({prop:i,defaultProp:s??!1,onChange:c,caller:Dd});return h.jsxs(XV,{scope:n,checked:y,disabled:o,children:[h.jsx(we.button,{type:"button",role:"switch","aria-checked":y,"aria-required":a,"data-state":dI(y),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:g,onClick:ge(e.onClick,S=>{_(w=>!w),v&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),v&&h.jsx(uI,{control:p,bubbles:!m.current,name:r,value:l,checked:y,required:a,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});oI.displayName=Dd;var lI="SwitchThumb",cI=b.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=ZV(lI,n);return h.jsx(we.span,{"data-state":dI(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});cI.displayName=lI;var QV="SwitchBubbleInput",uI=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},s)=>{const a=b.useRef(null),o=Le(a,s),l=sI(n),c=aI(t);return b.useEffect(()=>{const d=a.current;if(!d)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==n&&f){const g=new Event("click",{bubbles:r});f.call(d,n),d.dispatchEvent(g)}},[l,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});uI.displayName=QV;function dI(e){return e?"checked":"unchecked"}var hI=oI,JV=cI;const yw=b.forwardRef(({className:e,...t},n)=>h.jsx(hI,{className:X("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:h.jsx(JV,{className:X("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));yw.displayName=hI.displayName;function P0(e,[t,n]){return Math.min(n,Math.max(t,e))}function F0(e){const t=e7(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(n7);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function e7(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=i7(i),o=r7(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var t7=Symbol("radix.slottable");function n7(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===t7}function r7(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function i7(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pI(e){const t=e+"CollectionProvider",[n,r]=bi(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:v,children:y}=m,_=ft.useRef(null),S=ft.useRef(new Map).current;return h.jsx(i,{scope:v,itemMap:S,collectionRef:_,children:y})};a.displayName=t;const o=e+"CollectionSlot",l=F0(o),c=ft.forwardRef((m,v)=>{const{scope:y,children:_}=m,S=s(o,y),w=Le(v,S.collectionRef);return h.jsx(l,{ref:w,children:_})});c.displayName=o;const d=e+"CollectionItemSlot",u="data-radix-collection-item",p=F0(d),f=ft.forwardRef((m,v)=>{const{scope:y,children:_,...S}=m,w=ft.useRef(null),k=Le(v,w),x=s(d,y);return ft.useEffect(()=>(x.itemMap.set(w,{ref:w,...S}),()=>void x.itemMap.delete(w))),h.jsx(p,{[u]:"",ref:k,children:_})});f.displayName=d;function g(m){const v=s(e+"CollectionConsumer",m);return ft.useCallback(()=>{const _=v.collectionRef.current;if(!_)return[];const S=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((x,E)=>S.indexOf(x.ref.current)-S.indexOf(E.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:c,ItemSlot:f},g,r]}var s7=b.createContext(void 0);function _w(e){const t=b.useContext(s7);return e||t||"ltr"}const a7=["top","right","bottom","left"],di=Math.min,sn=Math.max,Nu=Math.round,uc=Math.floor,er=e=>({x:e,y:e}),o7={left:"right",right:"left",bottom:"top",top:"bottom"};function Sg(e,t,n){return sn(e,di(t,n))}function wr(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function Ra(e){return e.split("-")[1]}function vw(e){return e==="x"?"y":"x"}function Sw(e){return e==="y"?"height":"width"}function Yn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ww(e){return vw(Yn(e))}function l7(e,t,n){n===void 0&&(n=!1);const r=Ra(e),i=ww(e),s=Sw(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Ru(a)),[a,Ru(a)]}function c7(e){const t=Ru(e);return[wg(e),t,wg(t)]}function wg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const B0=["left","right"],j0=["right","left"],u7=["top","bottom"],d7=["bottom","top"];function h7(e,t,n){switch(e){case"top":case"bottom":return n?t?j0:B0:t?B0:j0;case"left":case"right":return t?u7:d7;default:return[]}}function p7(e,t,n,r){const i=Ra(e);let s=h7(xr(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(wg)))),s}function Ru(e){const t=xr(e);return o7[t]+e.slice(t.length)}function f7(e){return{top:0,right:0,bottom:0,left:0,...e}}function fI(e){return typeof e!="number"?f7(e):{top:e,right:e,bottom:e,left:e}}function Iu(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function U0(e,t,n){let{reference:r,floating:i}=e;const s=Yn(t),a=ww(t),o=Sw(a),l=xr(t),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,p=r[o]/2-i[o]/2;let f;switch(l){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-i.width,y:u};break;default:f={x:r.x,y:r.y}}switch(Ra(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1);break}return f}async function g7(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=wr(t,e),g=fI(f),v=o[p?u==="floating"?"reference":"floating":u],y=Iu(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:l})),_=u==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),w=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},k=Iu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:S,strategy:l}):_);return{top:(y.top-k.top+g.top)/w.y,bottom:(k.bottom-y.bottom+g.bottom)/w.y,left:(y.left-k.left+g.left)/w.x,right:(k.right-y.right+g.right)/w.x}}const m7=50,b7=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=a.detectOverflow?a:{...a,detectOverflow:g7},l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=U0(c,r,l),p=r,f=0;const g={};for(let m=0;m<s.length;m++){const v=s[m];if(!v)continue;const{name:y,fn:_}=v,{x:S,y:w,data:k,reset:x}=await _({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:g,rects:c,platform:o,elements:{reference:e,floating:t}});d=S??d,u=w??u,g[y]={...g[y],...k},x&&f<m7&&(f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:u}=U0(c,p,l)),m=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:g}},y7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=t,{element:c,padding:d=0}=wr(e,t)||{};if(c==null)return{};const u=fI(d),p={x:n,y:r},f=ww(i),g=Sw(f),m=await a.getDimensions(c),v=f==="y",y=v?"top":"left",_=v?"bottom":"right",S=v?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[f]-p[f]-s.floating[g],k=p[f]-s.reference[f],x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let E=x?x[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(x)))&&(E=o.floating[S]||s.floating[g]);const T=w/2-k/2,D=E/2-m[g]/2-1,R=di(u[y],D),I=di(u[_],D),O=R,N=E-m[g]-I,P=E/2-m[g]/2+T,F=Sg(O,P,N),B=!l.arrow&&Ra(i)!=null&&P!==F&&s.reference[g]/2-(P<O?R:I)-m[g]/2<0,j=B?P<O?P-O:P-N:0;return{[f]:p[f]+j,data:{[f]:F,centerOffset:P-F-j,...B&&{alignmentOffset:j}},reset:B}}}),_7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...v}=wr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=xr(i),_=Yn(o),S=xr(o)===o,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(S||!m?[Ru(o)]:c7(o)),x=g!=="none";!p&&x&&k.push(...p7(o,m,g,w));const E=[o,...k],T=await l.detectOverflow(t,v),D=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(T[y]),u){const P=l7(i,a,w);D.push(T[P[0]],T[P[1]])}if(R=[...R,{placement:i,overflows:D}],!D.every(P=>P<=0)){var I,O;const P=(((I=s.flip)==null?void 0:I.index)||0)+1,F=E[P];if(F&&(!(u==="alignment"?_!==Yn(F):!1)||R.every(M=>Yn(M.placement)===_?M.overflows[0]>0:!0)))return{data:{index:P,overflows:R},reset:{placement:F}};let B=(O=R.filter(j=>j.overflows[0]<=0).sort((j,M)=>j.overflows[1]-M.overflows[1])[0])==null?void 0:O.placement;if(!B)switch(f){case"bestFit":{var N;const j=(N=R.filter(M=>{if(x){const U=Yn(M.placement);return U===_||U==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(U=>U>0).reduce((U,C)=>U+C,0)]).sort((M,U)=>M[1]-U[1])[0])==null?void 0:N[0];j&&(B=j);break}case"initialPlacement":B=o;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function $0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function z0(e){return a7.some(t=>e[t]>=0)}const v7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=wr(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),o=$0(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:z0(o)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),o=$0(a,n.floating);return{data:{escapedOffsets:o,escaped:z0(o)}}}default:return{}}}}},gI=new Set(["left","top"]);async function S7(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=xr(n),o=Ra(n),l=Yn(n)==="y",c=gI.has(a)?-1:1,d=s&&l?-1:1,u=wr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return o&&typeof g=="number"&&(f=o==="end"?g*-1:g),l?{x:f*d,y:p*c}:{x:p*c,y:f*d}}const w7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:o}=t,l=await S7(t,e);return a===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},x7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:_,y:S}=y;return{x:_,y:S}}},...c}=wr(e,t),d={x:n,y:r},u=await s.detectOverflow(t,c),p=Yn(xr(i)),f=vw(p);let g=d[f],m=d[p];if(a){const y=f==="y"?"top":"left",_=f==="y"?"bottom":"right",S=g+u[y],w=g-u[_];g=Sg(S,g,w)}if(o){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",S=m+u[y],w=m-u[_];m=Sg(S,m,w)}const v=l.fn({...t,[f]:g,[p]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:a,[p]:o}}}}}},E7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=wr(e,t),d={x:n,y:r},u=Yn(i),p=vw(u);let f=d[p],g=d[u];const m=wr(o,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const S=p==="y"?"height":"width",w=s.reference[p]-s.floating[S]+v.mainAxis,k=s.reference[p]+s.reference[S]-v.mainAxis;f<w?f=w:f>k&&(f=k)}if(c){var y,_;const S=p==="y"?"width":"height",w=gI.has(xr(i)),k=s.reference[u]-s.floating[S]+(w&&((y=a.offset)==null?void 0:y[u])||0)+(w?0:v.crossAxis),x=s.reference[u]+s.reference[S]+(w?0:((_=a.offset)==null?void 0:_[u])||0)-(w?v.crossAxis:0);g<k?g=k:g>x&&(g=x)}return{[p]:f,[u]:g}}}},k7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:a,elements:o}=t,{apply:l=()=>{},...c}=wr(e,t),d=await a.detectOverflow(t,c),u=xr(i),p=Ra(i),f=Yn(i)==="y",{width:g,height:m}=s.floating;let v,y;u==="top"||u==="bottom"?(v=u,y=p===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(y=u,v=p==="end"?"top":"bottom");const _=m-d.top-d.bottom,S=g-d.left-d.right,w=di(m-d[v],_),k=di(g-d[y],S),x=!t.middlewareData.shift;let E=w,T=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=_),x&&!p){const R=sn(d.left,0),I=sn(d.right,0),O=sn(d.top,0),N=sn(d.bottom,0);f?T=g-2*(R!==0||I!==0?R+I:sn(d.left,d.right)):E=m-2*(O!==0||N!==0?O+N:sn(d.top,d.bottom))}await l({...t,availableWidth:T,availableHeight:E});const D=await a.getDimensions(o.floating);return g!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function Md(){return typeof window<"u"}function Ia(e){return mI(e)?(e.nodeName||"").toLowerCase():"#document"}function cn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ir(e){var t;return(t=(mI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mI(e){return Md()?e instanceof Node||e instanceof cn(e).Node:!1}function Fn(e){return Md()?e instanceof Element||e instanceof cn(e).Element:!1}function Nr(e){return Md()?e instanceof HTMLElement||e instanceof cn(e).HTMLElement:!1}function H0(e){return!Md()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof cn(e).ShadowRoot}function Tl(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Bn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function C7(e){return/^(table|td|th)$/.test(Ia(e))}function Pd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const T7=/transform|translate|scale|rotate|perspective|filter/,A7=/paint|layout|strict|content/,Ci=e=>!!e&&e!=="none";let ap;function xw(e){const t=Fn(e)?Bn(e):e;return Ci(t.transform)||Ci(t.translate)||Ci(t.scale)||Ci(t.rotate)||Ci(t.perspective)||!Ew()&&(Ci(t.backdropFilter)||Ci(t.filter))||T7.test(t.willChange||"")||A7.test(t.contain||"")}function N7(e){let t=hi(e);for(;Nr(t)&&!da(t);){if(xw(t))return t;if(Pd(t))return null;t=hi(t)}return null}function Ew(){return ap==null&&(ap=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ap}function da(e){return/^(html|body|#document)$/.test(Ia(e))}function Bn(e){return cn(e).getComputedStyle(e)}function Fd(e){return Fn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hi(e){if(Ia(e)==="html")return e;const t=e.assignedSlot||e.parentNode||H0(e)&&e.host||ir(e);return H0(t)?t.host:t}function bI(e){const t=hi(e);return da(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nr(t)&&Tl(t)?t:bI(t)}function rl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=bI(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=cn(i);if(s){const o=xg(a);return t.concat(a,a.visualViewport||[],Tl(i)?i:[],o&&n?rl(o):[])}else return t.concat(i,rl(i,[],n))}function xg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yI(e){const t=Bn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Nr(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,o=Nu(n)!==s||Nu(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function kw(e){return Fn(e)?e:e.contextElement}function Js(e){const t=kw(e);if(!Nr(t))return er(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=yI(t);let a=(s?Nu(n.width):n.width)/r,o=(s?Nu(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const R7=er(0);function _I(e){const t=cn(e);return!Ew()||!t.visualViewport?R7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function I7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==cn(e)?!1:t}function es(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=kw(e);let a=er(1);t&&(r?Fn(r)&&(a=Js(r)):a=Js(e));const o=I7(s,n,r)?_I(s):er(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,d=i.width/a.x,u=i.height/a.y;if(s){const p=cn(s),f=r&&Fn(r)?cn(r):r;let g=p,m=xg(g);for(;m&&r&&f!==g;){const v=Js(m),y=m.getBoundingClientRect(),_=Bn(m),S=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*v.x,w=y.top+(m.clientTop+parseFloat(_.paddingTop))*v.y;l*=v.x,c*=v.y,d*=v.x,u*=v.y,l+=S,c+=w,g=cn(m),m=xg(g)}}return Iu({width:d,height:u,x:l,y:c})}function Bd(e,t){const n=Fd(e).scrollLeft;return t?t.left+n:es(ir(e)).left+n}function vI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bd(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function O7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=ir(r),o=t?Pd(t.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=er(1);const d=er(0),u=Nr(r);if((u||!u&&!s)&&((Ia(r)!=="body"||Tl(a))&&(l=Fd(r)),u)){const f=es(r);c=Js(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=a&&!u&&!s?vI(a,l):er(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function L7(e){return Array.from(e.getClientRects())}function D7(e){const t=ir(e),n=Fd(e),r=e.ownerDocument.body,i=sn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=sn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Bd(e);const o=-n.scrollTop;return Bn(r).direction==="rtl"&&(a+=sn(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}const G0=25;function M7(e,t){const n=cn(e),r=ir(e),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const d=Ew();(!d||d&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}const c=Bd(r);if(c<=0){const d=r.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-f);g<=G0&&(s-=g)}else c<=G0&&(s+=c);return{width:s,height:a,x:o,y:l}}function P7(e,t){const n=es(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Nr(e)?Js(e):er(1),a=e.clientWidth*s.x,o=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function W0(e,t,n){let r;if(t==="viewport")r=M7(e,n);else if(t==="document")r=D7(ir(e));else if(Fn(t))r=P7(t,n);else{const i=_I(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Iu(r)}function SI(e,t){const n=hi(e);return n===t||!Fn(n)||da(n)?!1:Bn(n).position==="fixed"||SI(n,t)}function F7(e,t){const n=t.get(e);if(n)return n;let r=rl(e,[],!1).filter(o=>Fn(o)&&Ia(o)!=="body"),i=null;const s=Bn(e).position==="fixed";let a=s?hi(e):e;for(;Fn(a)&&!da(a);){const o=Bn(a),l=xw(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Tl(a)&&!l&&SI(e,a))?r=r.filter(d=>d!==a):i=o,a=hi(a)}return t.set(e,r),r}function B7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?Pd(t)?[]:F7(t,this._c):[].concat(n),r],o=W0(t,a[0],i);let l=o.top,c=o.right,d=o.bottom,u=o.left;for(let p=1;p<a.length;p++){const f=W0(t,a[p],i);l=sn(f.top,l),c=di(f.right,c),d=di(f.bottom,d),u=sn(f.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function j7(e){const{width:t,height:n}=yI(e);return{width:t,height:n}}function U7(e,t,n){const r=Nr(t),i=ir(t),s=n==="fixed",a=es(e,!0,s,t);let o={scrollLeft:0,scrollTop:0};const l=er(0);function c(){l.x=Bd(i)}if(r||!r&&!s)if((Ia(t)!=="body"||Tl(i))&&(o=Fd(t)),r){const f=es(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?vI(i,o):er(0),u=a.left+o.scrollLeft-l.x-d.x,p=a.top+o.scrollTop-l.y-d.y;return{x:u,y:p,width:a.width,height:a.height}}function op(e){return Bn(e).position==="static"}function V0(e,t){if(!Nr(e)||Bn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ir(e)===n&&(n=n.ownerDocument.body),n}function wI(e,t){const n=cn(e);if(Pd(e))return n;if(!Nr(e)){let i=hi(e);for(;i&&!da(i);){if(Fn(i)&&!op(i))return i;i=hi(i)}return n}let r=V0(e,t);for(;r&&C7(r)&&op(r);)r=V0(r,t);return r&&da(r)&&op(r)&&!xw(r)?n:r||N7(e)||n}const $7=async function(e){const t=this.getOffsetParent||wI,n=this.getDimensions,r=await n(e.floating);return{reference:U7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function z7(e){return Bn(e).direction==="rtl"}const H7={convertOffsetParentRelativeRectToViewportRelativeRect:O7,getDocumentElement:ir,getClippingRect:B7,getOffsetParent:wI,getElementRects:$7,getClientRects:L7,getDimensions:j7,getScale:Js,isElement:Fn,isRTL:z7};function xI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function G7(e,t){let n=null,r;const i=ir(e);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=c;if(o||t(),!p||!f)return;const g=uc(u),m=uc(i.clientWidth-(d+p)),v=uc(i.clientHeight-(u+f)),y=uc(d),S={rootMargin:-g+"px "+-m+"px "+-v+"px "+-y+"px",threshold:sn(0,di(1,l))||1};let w=!0;function k(x){const E=x[0].intersectionRatio;if(E!==l){if(!w)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!xI(c,e.getBoundingClientRect())&&a(),w=!1}try{n=new IntersectionObserver(k,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,S)}n.observe(e)}return a(!0),s}function W7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=kw(e),d=i||s?[...c?rl(c):[],...t?rl(t):[]]:[];d.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const u=c&&o?G7(c,n):null;let p=-1,f=null;a&&(f=new ResizeObserver(y=>{let[_]=y;_&&_.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=f)==null||S.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let g,m=l?es(e):null;l&&v();function v(){const y=es(e);m&&!xI(m,y)&&n(),m=y,g=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),u==null||u(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const V7=w7,q7=x7,K7=_7,Y7=k7,X7=v7,q0=y7,Z7=E7,Q7=(e,t,n)=>{const r=new Map,i={platform:H7,...n},s={...i.platform,_c:r};return b7(e,t,{...i,platform:s})};var J7=typeof document<"u",eq=function(){},Fc=J7?b.useLayoutEffect:eq;function Ou(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ou(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Ou(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function EI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function K0(e,t){const n=EI(e);return Math.round(t*n)/n}function lp(e){const t=b.useRef(e);return Fc(()=>{t.current=e}),t}function tq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=e,[d,u]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=b.useState(r);Ou(p,r)||f(r);const[g,m]=b.useState(null),[v,y]=b.useState(null),_=b.useCallback(M=>{M!==x.current&&(x.current=M,m(M))},[]),S=b.useCallback(M=>{M!==E.current&&(E.current=M,y(M))},[]),w=s||g,k=a||v,x=b.useRef(null),E=b.useRef(null),T=b.useRef(d),D=l!=null,R=lp(l),I=lp(i),O=lp(c),N=b.useCallback(()=>{if(!x.current||!E.current)return;const M={placement:t,strategy:n,middleware:p};I.current&&(M.platform=I.current),Q7(x.current,E.current,M).then(U=>{const C={...U,isPositioned:O.current!==!1};P.current&&!Ou(T.current,C)&&(T.current=C,ma.flushSync(()=>{u(C)}))})},[p,t,n,I,O]);Fc(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(M=>({...M,isPositioned:!1})))},[c]);const P=b.useRef(!1);Fc(()=>(P.current=!0,()=>{P.current=!1}),[]),Fc(()=>{if(w&&(x.current=w),k&&(E.current=k),w&&k){if(R.current)return R.current(w,k,N);N()}},[w,k,N,R,D]);const F=b.useMemo(()=>({reference:x,floating:E,setReference:_,setFloating:S}),[_,S]),B=b.useMemo(()=>({reference:w,floating:k}),[w,k]),j=b.useMemo(()=>{const M={position:n,left:0,top:0};if(!B.floating)return M;const U=K0(B.floating,d.x),C=K0(B.floating,d.y);return o?{...M,transform:"translate("+U+"px, "+C+"px)",...EI(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:C}},[n,o,B.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:N,refs:F,elements:B,floatingStyles:j}),[d,N,F,B,j])}const nq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?q0({element:r.current,padding:i}).fn(n):{}:r?q0({element:r,padding:i}).fn(n):{}}}},rq=(e,t)=>{const n=V7(e);return{name:n.name,fn:n.fn,options:[e,t]}},iq=(e,t)=>{const n=q7(e);return{name:n.name,fn:n.fn,options:[e,t]}},sq=(e,t)=>({fn:Z7(e).fn,options:[e,t]}),aq=(e,t)=>{const n=K7(e);return{name:n.name,fn:n.fn,options:[e,t]}},oq=(e,t)=>{const n=Y7(e);return{name:n.name,fn:n.fn,options:[e,t]}},lq=(e,t)=>{const n=X7(e);return{name:n.name,fn:n.fn,options:[e,t]}},cq=(e,t)=>{const n=nq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var uq="Arrow",kI=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(we.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});kI.displayName=uq;var dq=kI,Cw="Popper",[CI,jd]=bi(Cw),[hq,TI]=CI(Cw),AI=e=>{const{__scopePopper:t,children:n}=e,[r,i]=b.useState(null);return h.jsx(hq,{scope:t,anchor:r,onAnchorChange:i,children:n})};AI.displayName=Cw;var NI="PopperAnchor",RI=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=TI(NI,n),a=b.useRef(null),o=Le(t,a),l=b.useRef(null);return b.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(we.div,{...i,ref:o})});RI.displayName=NI;var Tw="PopperContent",[pq,fq]=CI(Tw),II=b.forwardRef((e,t)=>{var W,re,ce,ue,he,me;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,v=TI(Tw,n),[y,_]=b.useState(null),S=Le(t,le=>_(le)),[w,k]=b.useState(null),x=aI(w),E=(x==null?void 0:x.width)??0,T=(x==null?void 0:x.height)??0,D=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(c)?c:[c],O=I.length>0,N={padding:R,boundary:I.filter(mq),altBoundary:O},{refs:P,floatingStyles:F,placement:B,isPositioned:j,middlewareData:M}=tq({strategy:"fixed",placement:D,whileElementsMounted:(...le)=>W7(...le,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[rq({mainAxis:i+T,alignmentAxis:a}),l&&iq({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?sq():void 0,...N}),l&&aq({...N}),oq({...N,apply:({elements:le,rects:xt,availableWidth:Rr,availableHeight:Ir})=>{const{width:Or,height:Wd}=xt.reference,wi=le.floating.style;wi.setProperty("--radix-popper-available-width",`${Rr}px`),wi.setProperty("--radix-popper-available-height",`${Ir}px`),wi.setProperty("--radix-popper-anchor-width",`${Or}px`),wi.setProperty("--radix-popper-anchor-height",`${Wd}px`)}}),w&&cq({element:w,padding:o}),bq({arrowWidth:E,arrowHeight:T}),p&&lq({strategy:"referenceHidden",...N})]}),[U,C]=DI(B),H=ci(g);It(()=>{j&&(H==null||H())},[j,H]);const Z=(W=M.arrow)==null?void 0:W.x,L=(re=M.arrow)==null?void 0:re.y,se=((ce=M.arrow)==null?void 0:ce.centerOffset)!==0,[_e,$]=b.useState();return It(()=>{y&&$(window.getComputedStyle(y).zIndex)},[y]),h.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:j?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:_e,"--radix-popper-transform-origin":[(ue=M.transformOrigin)==null?void 0:ue.x,(he=M.transformOrigin)==null?void 0:he.y].join(" "),...((me=M.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(pq,{scope:n,placedSide:U,onArrowChange:k,arrowX:Z,arrowY:L,shouldHideArrow:se,children:h.jsx(we.div,{"data-side":U,"data-align":C,...m,ref:S,style:{...m.style,animation:j?void 0:"none"}})})})});II.displayName=Tw;var OI="PopperArrow",gq={top:"bottom",right:"left",bottom:"top",left:"right"},LI=b.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=fq(OI,r),a=gq[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(dq,{...i,ref:n,style:{...i.style,display:"block"}})})});LI.displayName=OI;function mq(e){return e!==null}var bq=e=>({name:"transformOrigin",options:e,fn(t){var v,y,_;const{placement:n,rects:r,middlewareData:i}=t,a=((v=i.arrow)==null?void 0:v.centerOffset)!==0,o=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[c,d]=DI(n),u={start:"0%",center:"50%",end:"100%"}[d],p=(((y=i.arrow)==null?void 0:y.x)??0)+o/2,f=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=a?u:`${p}px`,m=`${-l}px`):c==="top"?(g=a?u:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=a?u:`${f}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=a?u:`${f}px`),{data:{x:g,y:m}}}});function DI(e){const[t,n="center"]=e.split("-");return[t,n]}var MI=AI,Aw=RI,PI=II,FI=LI;function yq(e){const t=_q(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(Sq);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function _q(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=xq(i),o=wq(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vq=Symbol("radix.slottable");function Sq(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vq}function wq(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function xq(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var BI=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Eq="VisuallyHidden",kq=b.forwardRef((e,t)=>h.jsx(we.span,{...e,ref:t,style:{...BI,...e.style}}));kq.displayName=Eq;var Cq=[" ","Enter","ArrowUp","ArrowDown"],Tq=[" ","Enter"],ts="Select",[Ud,$d,Aq]=pI(ts),[Oa]=bi(ts,[Aq,jd]),zd=jd(),[Nq,_i]=Oa(ts),[Rq,Iq]=Oa(ts),jI=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:l,dir:c,name:d,autoComplete:u,disabled:p,required:f,form:g}=e,m=zd(t),[v,y]=b.useState(null),[_,S]=b.useState(null),[w,k]=b.useState(!1),x=_w(c),[E,T]=Yi({prop:r,defaultProp:i??!1,onChange:s,caller:ts}),[D,R]=Yi({prop:a,defaultProp:o,onChange:l,caller:ts}),I=b.useRef(null),O=v?g||!!v.closest("form"):!0,[N,P]=b.useState(new Set),F=Array.from(N).map(B=>B.props.value).join(";");return h.jsx(MI,{...m,children:h.jsxs(Nq,{required:f,scope:t,trigger:v,onTriggerChange:y,valueNode:_,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:k,contentId:br(),value:D,onValueChange:R,open:E,onOpenChange:T,dir:x,triggerPointerDownPosRef:I,disabled:p,children:[h.jsx(Ud.Provider,{scope:t,children:h.jsx(Rq,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(B=>{P(j=>new Set(j).add(B))},[]),onNativeOptionRemove:b.useCallback(B=>{P(j=>{const M=new Set(j);return M.delete(B),M})},[]),children:n})}),O?h.jsxs(uO,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:u,value:D,onChange:B=>R(B.target.value),disabled:p,form:g,children:[D===void 0?h.jsx("option",{value:""}):null,Array.from(N)]},F):null]})})};jI.displayName=ts;var UI="SelectTrigger",$I=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=zd(n),a=_i(UI,n),o=a.disabled||r,l=Le(t,a.onTriggerChange),c=$d(n),d=b.useRef("touch"),[u,p,f]=hO(m=>{const v=c().filter(S=>!S.disabled),y=v.find(S=>S.value===a.value),_=pO(v,m,y);_!==void 0&&a.onValueChange(_.value)}),g=m=>{o||(a.onOpenChange(!0),f()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(Aw,{asChild:!0,...s,children:h.jsx(we.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":dO(a.value)?"":void 0,...i,ref:l,onClick:ge(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:ge(i.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ge(i.onKeyDown,m=>{const v=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(v&&m.key===" ")&&Cq.includes(m.key)&&(g(),m.preventDefault())})})})});$I.displayName=UI;var zI="SelectValue",HI=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...o}=e,l=_i(zI,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,u=Le(t,l.onValueNodeChange);return It(()=>{c(d)},[c,d]),h.jsx(we.span,{...o,ref:u,style:{pointerEvents:"none"},children:dO(l.value)?h.jsx(h.Fragment,{children:a}):s})});HI.displayName=zI;var Oq="SelectIcon",GI=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return h.jsx(we.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});GI.displayName=Oq;var Lq="SelectPortal",WI=e=>h.jsx(cd,{asChild:!0,...e});WI.displayName=Lq;var ns="SelectContent",VI=b.forwardRef((e,t)=>{const n=_i(ns,e.__scopeSelect),[r,i]=b.useState();if(It(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ma.createPortal(h.jsx(qI,{scope:e.__scopeSelect,children:h.jsx(Ud.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),s):null}return h.jsx(KI,{...e,ref:t})});VI.displayName=ns;var Nn=10,[qI,vi]=Oa(ns),Dq="SelectContentImpl",Mq=yq("SelectContent.RemoveScroll"),KI=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:v,...y}=e,_=_i(ns,n),[S,w]=b.useState(null),[k,x]=b.useState(null),E=Le(t,W=>w(W)),[T,D]=b.useState(null),[R,I]=b.useState(null),O=$d(n),[N,P]=b.useState(!1),F=b.useRef(!1);b.useEffect(()=>{if(S)return Mm(S)},[S]),Dm();const B=b.useCallback(W=>{const[re,...ce]=O().map(me=>me.ref.current),[ue]=ce.slice(-1),he=document.activeElement;for(const me of W)if(me===he||(me==null||me.scrollIntoView({block:"nearest"}),me===re&&k&&(k.scrollTop=0),me===ue&&k&&(k.scrollTop=k.scrollHeight),me==null||me.focus(),document.activeElement!==he))return},[O,k]),j=b.useCallback(()=>B([T,S]),[B,T,S]);b.useEffect(()=>{N&&j()},[N,j]);const{onOpenChange:M,triggerPointerDownPosRef:U}=_;b.useEffect(()=>{if(S){let W={x:0,y:0};const re=ue=>{var he,me;W={x:Math.abs(Math.round(ue.pageX)-(((he=U.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((me=U.current)==null?void 0:me.y)??0))}},ce=ue=>{W.x<=10&&W.y<=10?ue.preventDefault():S.contains(ue.target)||M(!1),document.removeEventListener("pointermove",re),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",ce,{capture:!0})}}},[S,M,U]),b.useEffect(()=>{const W=()=>M(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[M]);const[C,H]=hO(W=>{const re=O().filter(he=>!he.disabled),ce=re.find(he=>he.ref.current===document.activeElement),ue=pO(re,W,ce);ue&&setTimeout(()=>ue.ref.current.focus())}),Z=b.useCallback((W,re,ce)=>{const ue=!F.current&&!ce;(_.value!==void 0&&_.value===re||ue)&&(D(W),ue&&(F.current=!0))},[_.value]),L=b.useCallback(()=>S==null?void 0:S.focus(),[S]),se=b.useCallback((W,re,ce)=>{const ue=!F.current&&!ce;(_.value!==void 0&&_.value===re||ue)&&I(W)},[_.value]),_e=r==="popper"?Eg:YI,$=_e===Eg?{side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return h.jsx(qI,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:Z,selectedItem:T,onItemLeave:L,itemTextRefCallback:se,focusSelectedItem:j,selectedItemText:R,position:r,isPositioned:N,searchRef:C,children:h.jsx(dd,{as:Mq,allowPinchZoom:!0,children:h.jsx(ld,{asChild:!0,trapped:_.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:ge(i,W=>{var re;(re=_.trigger)==null||re.focus({preventScroll:!0}),W.preventDefault()}),children:h.jsx(od,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:h.jsx(_e,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:W=>W.preventDefault(),...y,...$,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ge(y.onKeyDown,W=>{const re=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!re&&W.key.length===1&&H(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let ue=O().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(W.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const he=W.target,me=ue.indexOf(he);ue=ue.slice(me+1)}setTimeout(()=>B(ue)),W.preventDefault()}})})})})})})});KI.displayName=Dq;var Pq="SelectItemAlignedPosition",YI=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=_i(ns,n),a=vi(ns,n),[o,l]=b.useState(null),[c,d]=b.useState(null),u=Le(t,E=>d(E)),p=$d(n),f=b.useRef(!1),g=b.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:y,focusSelectedItem:_}=a,S=b.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&c&&m&&v&&y){const E=s.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),R=y.getBoundingClientRect();if(s.dir!=="rtl"){const he=R.left-T.left,me=D.left-he,le=E.left-me,xt=E.width+le,Rr=Math.max(xt,T.width),Ir=window.innerWidth-Nn,Or=P0(me,[Nn,Math.max(Nn,Ir-Rr)]);o.style.minWidth=xt+"px",o.style.left=Or+"px"}else{const he=T.right-R.right,me=window.innerWidth-D.right-he,le=window.innerWidth-E.right-me,xt=E.width+le,Rr=Math.max(xt,T.width),Ir=window.innerWidth-Nn,Or=P0(me,[Nn,Math.max(Nn,Ir-Rr)]);o.style.minWidth=xt+"px",o.style.right=Or+"px"}const I=p(),O=window.innerHeight-Nn*2,N=m.scrollHeight,P=window.getComputedStyle(c),F=parseInt(P.borderTopWidth,10),B=parseInt(P.paddingTop,10),j=parseInt(P.borderBottomWidth,10),M=parseInt(P.paddingBottom,10),U=F+B+N+M+j,C=Math.min(v.offsetHeight*5,U),H=window.getComputedStyle(m),Z=parseInt(H.paddingTop,10),L=parseInt(H.paddingBottom,10),se=E.top+E.height/2-Nn,_e=O-se,$=v.offsetHeight/2,W=v.offsetTop+$,re=F+B+W,ce=U-re;if(re<=se){const he=I.length>0&&v===I[I.length-1].ref.current;o.style.bottom="0px";const me=c.clientHeight-m.offsetTop-m.offsetHeight,le=Math.max(_e,$+(he?L:0)+me+j),xt=re+le;o.style.height=xt+"px"}else{const he=I.length>0&&v===I[0].ref.current;o.style.top="0px";const le=Math.max(se,F+m.offsetTop+(he?Z:0)+$)+ce;o.style.height=le+"px",m.scrollTop=re-se+m.offsetTop}o.style.margin=`${Nn}px 0`,o.style.minHeight=C+"px",o.style.maxHeight=O+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,o,c,m,v,y,s.dir,r]);It(()=>S(),[S]);const[w,k]=b.useState();It(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=b.useCallback(E=>{E&&g.current===!0&&(S(),_==null||_(),g.current=!1)},[S,_]);return h.jsx(Bq,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:f,onScrollButtonChange:x,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:h.jsx(we.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});YI.displayName=Pq;var Fq="SelectPopperPosition",Eg=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Nn,...s}=e,a=zd(n);return h.jsx(PI,{...a,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Eg.displayName=Fq;var[Bq,Nw]=Oa(ns,{}),kg="SelectViewport",XI=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=vi(kg,n),a=Nw(kg,n),o=Le(t,s.onViewportChange),l=b.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Ud.Slot,{scope:n,children:h.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ge(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:p}=a;if(p!=null&&p.current&&u){const f=Math.abs(l.current-d.scrollTop);if(f>0){const g=window.innerHeight-Nn*2,m=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),y=Math.max(m,v);if(y<g){const _=y+f,S=Math.min(g,_),w=_-S;u.style.height=S+"px",u.style.bottom==="0px"&&(d.scrollTop=w>0?w:0,u.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});XI.displayName=kg;var ZI="SelectGroup",[jq,Uq]=Oa(ZI),QI=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=br();return h.jsx(jq,{scope:n,id:i,children:h.jsx(we.div,{role:"group","aria-labelledby":i,...r,ref:t})})});QI.displayName=ZI;var JI="SelectLabel",eO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Uq(JI,n);return h.jsx(we.div,{id:i.id,...r,ref:t})});eO.displayName=JI;var Lu="SelectItem",[$q,tO]=Oa(Lu),nO=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=e,o=_i(Lu,n),l=vi(Lu,n),c=o.value===r,[d,u]=b.useState(s??""),[p,f]=b.useState(!1),g=Le(t,_=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,_,r,i)}),m=br(),v=b.useRef("touch"),y=()=>{i||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx($q,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:b.useCallback(_=>{u(S=>S||((_==null?void 0:_.textContent)??"").trim())},[]),children:h.jsx(Ud.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:h.jsx(we.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:g,onFocus:ge(a.onFocus,()=>f(!0)),onBlur:ge(a.onBlur,()=>f(!1)),onClick:ge(a.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:ge(a.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:ge(a.onPointerDown,_=>{v.current=_.pointerType}),onPointerMove:ge(a.onPointerMove,_=>{var S;v.current=_.pointerType,i?(S=l.onItemLeave)==null||S.call(l):v.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(a.onPointerLeave,_=>{var S;_.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ge(a.onKeyDown,_=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&_.key===" "||(Tq.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});nO.displayName=Lu;var lo="SelectItemText",rO=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,a=_i(lo,n),o=vi(lo,n),l=tO(lo,n),c=Iq(lo,n),[d,u]=b.useState(null),p=Le(t,y=>u(y),l.onItemTextChange,y=>{var _;return(_=o.itemTextRefCallback)==null?void 0:_.call(o,y,l.value,l.disabled)}),f=d==null?void 0:d.textContent,g=b.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=c;return It(()=>(m(g),()=>v(g)),[m,v,g]),h.jsxs(h.Fragment,{children:[h.jsx(we.span,{id:l.textId,...s,ref:p}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ma.createPortal(s.children,a.valueNode):null]})});rO.displayName=lo;var iO="SelectItemIndicator",sO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return tO(iO,n).isSelected?h.jsx(we.span,{"aria-hidden":!0,...r,ref:t}):null});sO.displayName=iO;var Cg="SelectScrollUpButton",aO=b.forwardRef((e,t)=>{const n=vi(Cg,e.__scopeSelect),r=Nw(Cg,e.__scopeSelect),[i,s]=b.useState(!1),a=Le(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?h.jsx(lO,{...e,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});aO.displayName=Cg;var Tg="SelectScrollDownButton",oO=b.forwardRef((e,t)=>{const n=vi(Tg,e.__scopeSelect),r=Nw(Tg,e.__scopeSelect),[i,s]=b.useState(!1),a=Le(t,r.onScrollButtonChange);return It(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?h.jsx(lO,{...e,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});oO.displayName=Tg;var lO=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=vi("SelectScrollButton",n),a=b.useRef(null),o=$d(n),l=b.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),It(()=>{var d;const c=o().find(u=>u.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),h.jsx(we.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ge(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:ge(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:ge(i.onPointerLeave,()=>{l()})})}),zq="SelectSeparator",cO=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(we.div,{"aria-hidden":!0,...r,ref:t})});cO.displayName=zq;var Ag="SelectArrow",Hq=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=zd(n),s=_i(Ag,n),a=vi(Ag,n);return s.open&&a.position==="popper"?h.jsx(FI,{...i,...r,ref:t}):null});Hq.displayName=Ag;var Gq="SelectBubbleInput",uO=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=b.useRef(null),s=Le(r,i),a=sI(t);return b.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&d){const u=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(u)}},[a,t]),h.jsx(we.select,{...n,style:{...BI,...n.style},ref:s,defaultValue:t})});uO.displayName=Gq;function dO(e){return e===""||e===void 0}function hO(e){const t=ci(e),n=b.useRef(""),r=b.useRef(0),i=b.useCallback(a=>{const o=n.current+a;t(o),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(o)},[t]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function pO(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=Wq(e,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Wq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vq=jI,fO=$I,qq=HI,Kq=GI,Yq=WI,gO=VI,Xq=XI,Zq=QI,mO=eO,bO=nO,Qq=rO,Jq=sO,yO=aO,_O=oO,vO=cO;const Du=Vq,cp=Zq,Mu=qq,il=b.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(fO,{ref:r,className:X("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(Kq,{asChild:!0,children:h.jsx(pl,{className:"h-4 w-4 opacity-50"})})]}));il.displayName=fO.displayName;const SO=b.forwardRef(({className:e,...t},n)=>h.jsx(yO,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(VT,{className:"h-4 w-4"})}));SO.displayName=yO.displayName;const wO=b.forwardRef(({className:e,...t},n)=>h.jsx(_O,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(pl,{className:"h-4 w-4"})}));wO.displayName=_O.displayName;const sl=b.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Yq,{children:h.jsxs(gO,{ref:i,className:X("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(SO,{}),h.jsx(Xq,{className:X("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(wO,{})]})}));sl.displayName=gO.displayName;const Bc=b.forwardRef(({className:e,...t},n)=>h.jsx(mO,{ref:n,className:X("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Bc.displayName=mO.displayName;const mn=b.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(bO,{ref:r,className:X("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Jq,{children:h.jsx(WT,{className:"h-4 w-4"})})}),h.jsx(Qq,{children:t})]}));mn.displayName=bO.displayName;const eK=b.forwardRef(({className:e,...t},n)=>h.jsx(vO,{ref:n,className:X("-mx-1 my-1 h-px bg-muted",e),...t}));eK.displayName=vO.displayName;function tK(e){const t=nK(e),n=b.forwardRef((r,i)=>{const{children:s,...a}=r,o=b.Children.toArray(s),l=o.find(iK);if(l){const c=l.props.children,d=o.map(u=>u===l?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:u);return h.jsx(t,{...a,ref:i,children:b.isValidElement(c)?b.cloneElement(c,void 0,d):null})}return h.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function nK(e){const t=b.forwardRef((n,r)=>{const{children:i,...s}=n;if(b.isValidElement(i)){const a=aK(i),o=sK(s,i.props);return i.type!==b.Fragment&&(o.ref=r?as(r,a):a),b.cloneElement(i,o)}return b.Children.count(i)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rK=Symbol("radix.slottable");function iK(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rK}function sK(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function aK(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd="Popover",[xO]=bi(Hd,[jd]),Al=jd(),[oK,Si]=xO(Hd),EO=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,o=Al(t),l=b.useRef(null),[c,d]=b.useState(!1),[u,p]=Yi({prop:r,defaultProp:i??!1,onChange:s,caller:Hd});return h.jsx(MI,{...o,children:h.jsx(oK,{scope:t,contentId:br(),triggerRef:l,open:u,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:a,children:n})})};EO.displayName=Hd;var kO="PopoverAnchor",lK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(kO,n),s=Al(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=i;return b.useEffect(()=>(a(),()=>o()),[a,o]),h.jsx(Aw,{...s,...r,ref:t})});lK.displayName=kO;var CO="PopoverTrigger",TO=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(CO,n),s=Al(n),a=Le(t,i.triggerRef),o=h.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":OO(i.open),...r,ref:a,onClick:ge(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:h.jsx(Aw,{asChild:!0,...s,children:o})});TO.displayName=CO;var Rw="PopoverPortal",[cK,uK]=xO(Rw,{forceMount:void 0}),AO=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Si(Rw,t);return h.jsx(cK,{scope:t,forceMount:n,children:h.jsx(ls,{present:n||s.open,children:h.jsx(cd,{asChild:!0,container:i,children:r})})})};AO.displayName=Rw;var ha="PopoverContent",NO=b.forwardRef((e,t)=>{const n=uK(ha,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Si(ha,e.__scopePopover);return h.jsx(ls,{present:r||s.open,children:s.modal?h.jsx(hK,{...i,ref:t}):h.jsx(pK,{...i,ref:t})})});NO.displayName=ha;var dK=tK("PopoverContent.RemoveScroll"),hK=b.forwardRef((e,t)=>{const n=Si(ha,e.__scopePopover),r=b.useRef(null),i=Le(t,r),s=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return Mm(a)},[]),h.jsx(dd,{as:dK,allowPinchZoom:!0,children:h.jsx(RO,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),s.current||(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,c=o.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),pK=b.forwardRef((e,t)=>{const n=Si(ha,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return h.jsx(RO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),RO=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,p=Si(ha,n),f=Al(n);return Dm(),h.jsx(ld,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(od,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:h.jsx(PI,{"data-state":OO(p.open),role:"dialog",id:p.contentId,...f,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),IO="PopoverClose",fK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Si(IO,n);return h.jsx(we.button,{type:"button",...r,ref:t,onClick:ge(e.onClick,()=>i.onOpenChange(!1))})});fK.displayName=IO;var gK="PopoverArrow",mK=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Al(n);return h.jsx(FI,{...i,...r,ref:t})});mK.displayName=gK;function OO(e){return e?"open":"closed"}var bK=EO,yK=TO,_K=AO,LO=NO;const vK=bK,SK=yK,DO=b.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(_K,{children:h.jsx(LO,{ref:i,align:t,sideOffset:n,className:X("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));DO.displayName=LO.displayName;function wK({projectId:e,config:t,onChange:n}){var k;const[r,i]=b.useState([]),[s,a]=b.useState([]),[o,l]=b.useState(null),[c,d]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{JP().then(i).catch(console.error),vh(e).then(a).catch(console.error)},[e]);const p=x=>{n({...t,...x})},f=async x=>{if(x.startsWith("preset:")){const E=x.replace("preset:",""),T=r.find(D=>D.id===E);if(T&&!T.downloaded){l(E);try{await eF(E),i(R=>R.map(I=>I.id===E?{...I,downloaded:!0}:I));const D=await vh(e);a(D)}catch(D){console.error("Failed to download preset:",D),l(null);return}l(null)}}p({source:x})},g=async x=>{const E=u.current;E&&(E.dataset.scope=x,E.click())},m=async x=>{var D;const E=(D=x.target.files)==null?void 0:D[0];if(!E)return;const T=x.target.dataset.scope||"global";d(!0);try{const{name:R}=await tF(E,T,e),I=await vh(e);a(I),p({source:`${T==="project"?"project":"global"}:${R}`})}catch(R){console.error("Upload failed:",R)}finally{d(!1),x.target.value=""}},v=s.filter(x=>x.source.startsWith("preset:")),y=s.filter(x=>x.source.startsWith("global:")),_=s.filter(x=>x.source.startsWith("project:")),S=r.filter(x=>!x.downloaded&&!v.some(E=>E.source===`preset:${x.id}`)),w=t.playMode==="interval"||t.playMode==="auto"&&((k=r.find(x=>`preset:${x.id}`===t.source))==null?void 0:k.type)==="strike";return h.jsxs(vK,{children:[h.jsx(SK,{asChild:!0,children:h.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",children:h.jsx(wF,{className:`h-4 w-4 ${t.enabled?"text-primary":""}`})})}),h.jsx(DO,{className:"w-[300px]",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(je,{className:"text-sm font-medium",children:"背景音效"}),h.jsx(yw,{checked:t.enabled,onCheckedChange:x=>p({enabled:x})})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"音源"}),h.jsxs(Du,{value:t.source,onValueChange:f,children:[h.jsx(il,{className:"h-8 text-xs",children:h.jsx(Mu,{placeholder:"选择音源"})}),h.jsxs(sl,{children:[(v.length>0||S.length>0)&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"预设音效"}),v.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source)),S.map(x=>h.jsx(mn,{value:`preset:${x.id}`,className:"text-xs",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[x.name,o===x.id?h.jsx(vo,{className:"h-3 w-3 animate-spin"}):h.jsx(pu,{className:"h-3 w-3 text-muted-foreground"})]})},`preset:${x.id}`))]}),y.length>0&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"全局自定义"}),y.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source))]}),_.length>0&&h.jsxs(cp,{children:[h.jsx(Bc,{children:"项目自定义"}),_.map(x=>h.jsx(mn,{value:x.source,className:"text-xs",children:x.name},x.source))]})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"播放模式"}),h.jsxs(Du,{value:t.playMode,onValueChange:x=>p({playMode:x}),children:[h.jsx(il,{className:"h-8 text-xs",children:h.jsx(Mu,{})}),h.jsxs(sl,{children:[h.jsx(mn,{value:"auto",className:"text-xs",children:"自动"}),h.jsx(mn,{value:"loop",className:"text-xs",children:"循环"}),h.jsx(mn,{value:"interval",className:"text-xs",children:"随机间隔"})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs(je,{className:"text-xs text-muted-foreground",children:["音量: ",Math.round(t.volume*100),"%"]}),h.jsx("input",{type:"range",min:0,max:100,value:Math.round(t.volume*100),onChange:x=>p({volume:Number(x.target.value)/100}),className:"w-full h-1.5 accent-primary cursor-pointer"})]}),w&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(je,{className:"text-xs text-muted-foreground",children:"间隔范围(秒)"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"number",min:1,value:t.intervalRange[0],onChange:x=>p({intervalRange:[Number(x.target.value),t.intervalRange[1]]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"~"}),h.jsx("input",{type:"number",min:1,value:t.intervalRange[1],onChange:x=>p({intervalRange:[t.intervalRange[0],Number(x.target.value)]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"})]})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(te,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("global"),children:[c?h.jsx(vo,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(gf,{className:"h-3 w-3 mr-1"}),"上传全局"]}),h.jsxs(te,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("project"),children:[c?h.jsx(vo,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(gf,{className:"h-3 w-3 mr-1"}),"上传项目"]})]}),h.jsx("input",{ref:u,type:"file",accept:"audio/*",className:"hidden",onChange:m})]})})]})}const xK=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,EK=5,kK=3e3;function CK(e,t){const n=b.useRef(null),r=b.useRef(0),i=b.useRef(!0),s=b.useRef(t);s.current=t;const a=b.useRef(!1),o=b.useCallback(f=>{var g;((g=n.current)==null?void 0:g.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(f))},[]),l=b.useCallback((f,g)=>{var m;((m=n.current)==null?void 0:m.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:f,rows:g})),a.current=!1):a.current=!0},[]),c=b.useCallback(f=>{o({type:"terminal_input",data:f})},[o]),d=b.useCallback((f,g)=>{o({type:"terminal_resize",cols:f,rows:g})},[o]),u=b.useCallback(()=>{o({type:"chat_subscribe"})},[o]),p=b.useCallback(()=>{if(!i.current)return;const f=kr();if(!f){window.location.href="/login";return}const g=new WebSocket(`${xK}/ws/projects/${e}`);n.current=g,g.onopen=()=>{r.current=0,g.send(JSON.stringify({type:"auth",token:f}))},g.onmessage=m=>{var y,_,S,w,k,x,E,T;let v;try{v=JSON.parse(m.data)}catch{return}switch(v.type){case"connected":a.current=!1,(_=(y=s.current).onConnected)==null||_.call(y);break;case"terminal_data":(w=(S=s.current).onTerminalData)==null||w.call(S,v.data);break;case"status":(x=(k=s.current).onStatus)==null||x.call(k,v.status);break;case"chat_message":{const D=v;(T=(E=s.current).onChatMessage)==null||T.call(E,D);break}case"error":console.error("[WS] Server error:",v.message);break}},g.onclose=()=>{n.current=null,i.current&&r.current<EK&&(r.current++,setTimeout(p,kK))},g.onerror=m=>{console.error("[WS] WebSocket error:",m)}},[e]);return b.useEffect(()=>(i.current=!0,p(),()=>{var f;i.current=!1,(f=n.current)==null||f.close(),n.current=null}),[p]),{subscribeTerminal:l,sendTerminalInput:c,sendTerminalResize:d,subscribeChatMessages:u}}function up({icon:e,label:t,content:n}){const[r,i]=b.useState(!1);return h.jsxs("div",{className:"border border-border rounded mt-1.5",children:[h.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(s=>!s),children:[h.jsx(sd,{className:X("h-3 w-3 transition-transform",r&&"rotate-90")}),h.jsx(e,{className:"h-3 w-3"}),h.jsx("span",{className:"truncate",children:t})]}),r&&h.jsx("pre",{className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})]})}function TK({blocks:e}){return h.jsx(h.Fragment,{children:e.map((t,n)=>t.type==="text"?h.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:h.jsx(lR,{remarkPlugins:[OR],children:t.content})},n):t.type==="thinking"?h.jsx(up,{icon:Rm,label:"Thinking...",content:t.content},n):t.type==="tool_use"?h.jsx(up,{icon:PF,label:t.content.split("(")[0],content:t.content},n):t.type==="tool_result"?h.jsx(up,{icon:hF,label:"Result",content:t.content},n):null)})}function AK({messages:e,onSend:t,readOnly:n}){const[r,i]=b.useState(""),s=b.useRef(null),a=b.useRef(null);b.useEffect(()=>{var d;(d=s.current)==null||d.scrollIntoView({behavior:"smooth"})},[e.length]);const o=()=>{const d=r.trim();d&&(t(d+"\r"),i(""),a.current&&(a.current.style.height="auto"))},l=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())},c=d=>{d.style.height="auto",d.style.height=Math.min(d.scrollHeight,120)+"px"};return h.jsxs("div",{className:"flex flex-col h-full bg-background",children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[e.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"等待对话..."}),e.map((d,u)=>h.jsx("div",{className:X("flex",d.role==="user"?"justify-end":"justify-start"),children:h.jsxs("div",{className:X("max-w-[85%] rounded-lg px-3 py-2 text-sm",d.role==="user"?"bg-blue-100 text-blue-900 dark:bg-blue-600 dark:text-white":"bg-muted"),children:[h.jsx(TK,{blocks:d.blocks}),h.jsx("div",{className:"text-[10px] opacity-50 mt-1",children:new Date(d.timestamp).toLocaleTimeString()})]})},u)),h.jsx("div",{ref:s})]}),!n&&h.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end flex-shrink-0",children:[h.jsx("textarea",{ref:a,value:r,onChange:d=>{i(d.target.value),c(d.target)},onKeyDown:l,placeholder:"输入消息...",rows:1,className:"flex-1 resize-none bg-muted rounded-md px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring",style:{maxHeight:"120px"}}),h.jsx("button",{onClick:o,disabled:!r.trim(),className:"p-2 rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex-shrink-0",children:h.jsx(AF,{className:"h-4 w-4"})})]})]})}function NK({status:e}){const t={running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"};return h.jsxs("span",{className:X("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",t[e]),children:[h.jsx("span",{className:X("w-1.5 h-1.5 rounded-full",{"bg-green-500":e==="running","bg-muted-foreground":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function RK(){const{id:e}=lM(),t=ss(),[n,r]=b.useState(null),[i,s]=b.useState(!0),[a,o]=b.useState(!1),[l,c]=b.useState(!1),[d,u]=b.useState({enabled:!1,source:"preset:rain",playMode:"auto",volume:.5,intervalRange:[3,8]}),[p,f]=b.useState(!1),g=b.useRef(null),[m,v]=b.useState("terminal"),[y,_]=b.useState([]),S=async()=>{if(e){c(!0);try{await KP(e)}catch($){alert($ instanceof Error?$.message:"备份失败")}finally{c(!1)}}},[w,k]=b.useState(()=>{try{return localStorage.getItem("cc_panel_filetree")!=="false"}catch{return!0}}),[x,E]=b.useState(()=>{try{return localStorage.getItem("cc_panel_shortcuts")!=="false"}catch{return!0}}),T=()=>k($=>(localStorage.setItem("cc_panel_filetree",String(!$)),!$)),D=()=>E($=>(localStorage.setItem("cc_panel_shortcuts",String(!$)),!$)),[R,I]=b.useState(!1);b.useEffect(()=>{const $=()=>I(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$),()=>document.removeEventListener("fullscreenchange",$)},[]);const O=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},N=b.useRef(null),P=b.useRef(null),F=b.useRef(null),B=b.useRef(null),j=b.useCallback($=>{var W;(W=N.current)==null||W.write($),f(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>f(!1),3e3)},[]),M=b.useCallback(()=>{var W;const $=P.current;$&&F.current&&F.current($.cols,$.rows),(W=B.current)==null||W.call(B)},[]),{subscribeTerminal:U,sendTerminalInput:C,sendTerminalResize:H,subscribeChatMessages:Z}=CK(e??"",{onTerminalData:j,onStatus:$=>r(W=>W&&{...W,status:$}),onConnected:M,onChatMessage:$=>{_(W=>[...W,$])}});b.useEffect(()=>{F.current=U},[U]),b.useEffect(()=>{B.current=Z},[Z]);const L=b.useCallback(($,W)=>{P.current={cols:$,rows:W},M()},[M]);b.useEffect(()=>{if(!e)return;(async()=>{try{const re=(await UT()).find(ce=>ce.id===e)??null;r(re),re!=null&&re.sound&&u(re.sound)}catch(W){console.error("Failed to load project:",W)}finally{s(!1)}})()},[e]);const se=async()=>{if(n){o(!0);try{r(await kP(n.id))}catch($){console.error($)}finally{o(!1)}}},_e=async()=>{if(n){o(!0);try{r(await CP(n.id))}catch($){console.error($)}finally{o(!1)}}};return i?h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})}):!n||!e?h.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background",children:[h.jsx("p",{className:"text-muted-foreground",children:"Project not found."}),h.jsxs(te,{variant:"outline",onClick:()=>t("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Back to Dashboard"]})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[h.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:h.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[h.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>t("/"),children:h.jsx(Wo,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",w?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:T,title:"Toggle file tree",children:h.jsx(EF,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",x?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:D,title:"Toggle right panel",children:h.jsx(kF,{className:"h-4 w-4"})}),h.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-1",children:[h.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:n.name}),h.jsx(NK,{status:n.status}),h.jsx(dr,{variant:"outline",className:"text-xs",children:n.permissionMode==="unlimited"?"Unlimited":"Limited"}),h.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:n.folderPath})]}),h.jsx(RA,{className:"mr-2"}),h.jsx(OA,{}),h.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:O,title:R?"退出全屏":"全屏",children:R?h.jsx(Om,{className:"h-3.5 w-3.5"}):h.jsx(Im,{className:"h-3.5 w-3.5"})}),e&&h.jsx(wK,{projectId:e,config:d,onChange:$=>{u($),nF(e,$)}}),h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void S(),disabled:l,title:"备份到云盘",children:[l?h.jsx(vo,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):h.jsx(MF,{className:"h-3.5 w-3.5 mr-1.5"}),"备份"]}),n.status==="running"||n.status==="restarting"?h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void se(),disabled:a,children:[h.jsx(OF,{className:"h-3.5 w-3.5 mr-1.5"}),"Stop"]}):h.jsxs(te,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void _e(),disabled:a,children:[h.jsx(CF,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})}),h.jsxs("div",{className:"flex-1 overflow-hidden flex min-h-0",children:[w&&h.jsx("div",{className:"w-56 flex-shrink-0 border-r border-border overflow-hidden",children:h.jsx(FV,{projectPath:n.folderPath})}),h.jsxs("div",{className:"flex-1 overflow-hidden min-w-0 flex flex-col",children:[h.jsxs("div",{className:"flex items-center border-b border-border bg-muted/30 px-2 h-8 flex-shrink-0",children:[h.jsxs("button",{onClick:()=>v("terminal"),className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="terminal"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(ff,{className:"h-3 w-3"}),"终端"]}),h.jsxs("button",{onClick:()=>v("chat"),className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="chat"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(_F,{className:"h-3 w-3"}),"对话"]})]}),h.jsx("div",{className:X("flex-1 min-h-0",m!=="terminal"&&"hidden"),children:h.jsx(xN,{ref:N,onInput:C,onResize:($,W)=>{P.current={cols:$,rows:W},H($,W)},onReady:L})}),m==="chat"&&h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(AK,{messages:y,onSend:C,readOnly:(n==null?void 0:n._sharedPermission)==="view"})})]}),x&&h.jsx("div",{className:"w-52 flex-shrink-0 border-l border-border overflow-hidden",children:h.jsx(GV,{projectId:e,onSend:C})})]}),e&&h.jsx(KV,{projectId:e,config:d,isActive:p})]})}var dp="rovingFocusGroup.onEntryFocus",IK={bubbles:!1,cancelable:!0},Nl="RovingFocusGroup",[Ng,MO,OK]=pI(Nl),[LK,PO]=bi(Nl,[OK]),[DK,MK]=LK(Nl),FO=b.forwardRef((e,t)=>h.jsx(Ng.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Ng.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(PK,{...e,ref:t})})}));FO.displayName=Nl;var PK=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,p=b.useRef(null),f=Le(t,p),g=_w(s),[m,v]=Yi({prop:a,defaultProp:o??null,onChange:l,caller:Nl}),[y,_]=b.useState(!1),S=ci(c),w=MO(n),k=b.useRef(!1),[x,E]=b.useState(0);return b.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(dp,S),()=>T.removeEventListener(dp,S)},[S]),h.jsx(DK,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:b.useCallback(T=>v(T),[v]),onItemShiftTab:b.useCallback(()=>_(!0),[]),onFocusableItemAdd:b.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:b.useCallback(()=>E(T=>T-1),[]),children:h.jsx(we.div,{tabIndex:y||x===0?-1:0,"data-orientation":r,...u,ref:f,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{k.current=!0}),onFocus:ge(e.onFocus,T=>{const D=!k.current;if(T.target===T.currentTarget&&D&&!y){const R=new CustomEvent(dp,IK);if(T.currentTarget.dispatchEvent(R),!R.defaultPrevented){const I=w().filter(B=>B.focusable),O=I.find(B=>B.active),N=I.find(B=>B.id===m),F=[O,N,...I].filter(Boolean).map(B=>B.ref.current);UO(F,d)}}k.current=!1}),onBlur:ge(e.onBlur,()=>_(!1))})})}),BO="RovingFocusGroupItem",jO=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:a,...o}=e,l=br(),c=s||l,d=MK(BO,n),u=d.currentTabStopId===c,p=MO(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=d;return b.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),h.jsx(Ng.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(we.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...o,ref:t,onMouseDown:ge(e.onMouseDown,v=>{r?d.onItemFocus(c):v.preventDefault()}),onFocus:ge(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:ge(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=jK(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=p().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")S.reverse();else if(y==="prev"||y==="next"){y==="prev"&&S.reverse();const w=S.indexOf(v.currentTarget);S=d.loop?UK(S,w+1):S.slice(w+1)}setTimeout(()=>UO(S))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})});jO.displayName=BO;var FK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BK(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jK(e,t,n){const r=BK(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return FK[r]}function UO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function UK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $K=FO,zK=jO,Gd="Tabs",[HK]=bi(Gd,[PO]),$O=PO(),[GK,Iw]=HK(Gd),zO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:o,activationMode:l="automatic",...c}=e,d=_w(o),[u,p]=Yi({prop:r,onChange:i,defaultProp:s??"",caller:Gd});return h.jsx(GK,{scope:n,baseId:br(),value:u,onValueChange:p,orientation:a,dir:d,activationMode:l,children:h.jsx(we.div,{dir:d,"data-orientation":a,...c,ref:t})})});zO.displayName=Gd;var HO="TabsList",GO=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,s=Iw(HO,n),a=$O(n);return h.jsx($K,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:h.jsx(we.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});GO.displayName=HO;var WO="TabsTrigger",VO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=e,a=Iw(WO,n),o=$O(n),l=YO(a.baseId,r),c=XO(a.baseId,r),d=r===a.value;return h.jsx(zK,{asChild:!0,...o,focusable:!i,active:d,children:h.jsx(we.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:t,onMouseDown:ge(e.onMouseDown,u=>{!i&&u.button===0&&u.ctrlKey===!1?a.onValueChange(r):u.preventDefault()}),onKeyDown:ge(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&a.onValueChange(r)}),onFocus:ge(e.onFocus,()=>{const u=a.activationMode!=="manual";!d&&!i&&u&&a.onValueChange(r)})})})});VO.displayName=WO;var qO="TabsContent",KO=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...a}=e,o=Iw(qO,n),l=YO(o.baseId,r),c=XO(o.baseId,r),d=r===o.value,u=b.useRef(d);return b.useEffect(()=>{const p=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(ls,{present:i||d,children:({present:p})=>h.jsx(we.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:p&&s})})});KO.displayName=qO;function YO(e,t){return`${e}-trigger-${t}`}function XO(e,t){return`${e}-content-${t}`}var WK=zO,ZO=GO,QO=VO,JO=KO;const VK=WK,eL=b.forwardRef(({className:e,...t},n)=>h.jsx(ZO,{ref:n,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));eL.displayName=ZO.displayName;const jc=b.forwardRef(({className:e,...t},n)=>h.jsx(QO,{ref:n,className:X("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));jc.displayName=QO.displayName;const Uc=b.forwardRef(({className:e,...t},n)=>h.jsx(JO,{ref:n,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Uc.displayName=JO.displayName;const Y0={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function qK({open:e,onOpenChange:t,onAdded:n}){const[r,i]=b.useState([]),[s,a]=b.useState(!1),[o,l]=b.useState(null),[c,d]=b.useState(""),[u,p]=b.useState(""),[f,g]=b.useState(""),[m,v]=b.useState(""),[y,_]=b.useState(!1),[S,w]=b.useState(null);b.useEffect(()=>{e&&WP().then(D=>i(D.available)).catch(()=>i([]))},[e]);const k=()=>{a(!1),l(null),d(""),p(""),g(""),v(""),_(!1),w(null)},x=async D=>{l(D),w(null);try{const{id:R}=await iE({type:D,label:Y0[D]||D}),{url:I}=await df(R);window.open(I,"_blank"),k(),t(!1),n()}catch(R){w(R instanceof Error?R.message:"添加失败"),l(null)}},E=async()=>{if(!c||!u||!f||!m){w("请填写所有字段");return}_(!0),w(null);try{const{id:D}=await iE({type:c,label:u,clientId:f,clientSecret:m}),{url:R}=await df(D);window.open(R,"_blank"),k(),t(!1),n()}catch(D){w(D instanceof Error?D.message:"添加失败")}finally{_(!1)}},T=r.length>0;return h.jsx(_a,{open:e,onOpenChange:D=>{t(D),D||k()},children:h.jsxs(cs,{className:"sm:max-w-md",children:[h.jsxs(us,{children:[h.jsxs(hs,{className:"flex items-center gap-2",children:[h.jsx(hf,{className:"h-5 w-5"}),"添加云盘账号"]}),h.jsx(ps,{children:s?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"云盘类型"}),h.jsxs(Du,{value:c,onValueChange:d,children:[h.jsx(il,{children:h.jsx(Mu,{placeholder:"选择云盘类型"})}),h.jsxs(sl,{children:[h.jsx(mn,{value:"google-drive",children:"Google Drive"}),h.jsx(mn,{value:"onedrive",children:"OneDrive"}),h.jsx(mn,{value:"dropbox",children:"Dropbox"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"显示名称"}),h.jsx(wn,{placeholder:"例如:我的 Google Drive",value:u,onChange:D=>p(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"Client ID"}),h.jsx(wn,{placeholder:"OAuth Client ID",value:f,onChange:D=>g(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"Client Secret"}),h.jsx(wn,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:D=>v(D.target.value)})]}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S})]}),h.jsxs(ds,{children:[h.jsx(te,{variant:"outline",onClick:()=>{a(!1),w(null)},children:"返回"}),h.jsx(te,{onClick:E,disabled:y,children:y?"添加中...":"添加并授权"})]})]}):h.jsxs("div",{className:"space-y-3 py-2",children:[T?h.jsx(h.Fragment,{children:r.map(D=>h.jsx(te,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void x(D),disabled:o!==null,children:o===D?"连接中...":`连接 ${Y0[D]||D}`},D))}):h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S}),h.jsx("div",{className:"pt-2 border-t border-border",children:h.jsxs("button",{onClick:()=>{a(!0),w(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(NF,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const KK={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function YK({type:e}){switch(e){case"google-drive":return h.jsx(oE,{className:"h-5 w-5 text-blue-500"});case"onedrive":return h.jsx(hf,{className:"h-5 w-5 text-sky-500"});case"dropbox":return h.jsx(oE,{className:"h-5 w-5 text-indigo-500"});default:return h.jsx(hf,{className:"h-5 w-5"})}}function XK({provider:e,onDelete:t,onReauth:n}){var a;const[r,i]=b.useState(!1),s=()=>{r?(t(e.id),i(!1)):(i(!0),setTimeout(()=>i(!1),3e3))};return h.jsxs(td,{children:[h.jsx(nd,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(YK,{type:e.type}),h.jsxs("div",{children:[h.jsx(rd,{className:"text-base",children:e.label}),h.jsx("p",{className:"text-sm text-muted-foreground",children:KK[e.type]||e.type})]})]}),h.jsx(dr,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),h.jsxs(id,{children:[e.authorized&&((a=e.tokens)==null?void 0:a.expiry)&&h.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(te,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[h.jsx(Ki,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),h.jsxs(te,{variant:r?"destructive":"outline",size:"sm",onClick:s,children:[h.jsx(Lm,{className:"h-3.5 w-3.5 mr-1"}),r?"确认删除?":"删除"]})]})]})]})}const ZK={success:{label:"成功",icon:cF,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:FF,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:aF,className:"bg-yellow-600 hover:bg-yellow-700"}};function QK(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;const i=Math.floor(r/60),s=r%60;return`${i}分${s}秒`}function JK(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function eY({history:e}){const t=e.slice(0,20);return t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[h.jsx(uF,{className:"h-10 w-10 mb-3 opacity-50"}),h.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b",children:[h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),h.jsx("tbody",{children:t.map(n=>{const r=ZK[n.status],i=r.icon;return h.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:JK(n.startTime)}),h.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),h.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),h.jsxs("td",{className:"py-2.5 px-2",children:[h.jsxs(dr,{className:r.className,children:[h.jsx(i,{className:"h-3 w-3 mr-1"}),r.label]}),n.error&&h.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),h.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:QK(n.startTime,n.endTime)})]},n.id)})})]})})}const X0=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],tY=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function nY(){const e=ss(),[t,n]=b.useState([]),[r,i]=b.useState(!0),[s,a]=b.useState(!1),[o,l]=b.useState({enabled:!1,intervalMinutes:60}),[c,d]=b.useState(!0),[u,p]=b.useState([]),[f,g]=b.useState(!0),[m,v]=b.useState(""),[y,_]=b.useState(!1),[S,w]=b.useState(!1),[k,x]=b.useState([]),[E,T]=b.useState(!0),D=async()=>{try{const C=await VP();n(C)}catch{}finally{i(!1)}},R=async()=>{try{const C=await YP();l(C)}catch{}finally{d(!1)}},I=async()=>{try{const C=await XP();p(C.length>0?C:X0)}catch{p(X0)}finally{g(!1)}},O=async()=>{try{const C=await QP();x(C)}catch{}finally{T(!1)}};b.useEffect(()=>{D(),R(),I(),O()},[]);const N=async C=>{try{await qP(C),n(H=>H.filter(Z=>Z.id!==C))}catch{}},P=async C=>{try{const{url:H}=await df(C);window.open(H,"_blank")}catch{}},F=async C=>{const H={...o,enabled:C};l(H);try{await sE({enabled:C})}catch{l(o)}},B=async C=>{const H=parseInt(C,10),Z={...o,intervalMinutes:H};l(Z);try{await sE({intervalMinutes:H})}catch{l(o)}},j=()=>{const C=m.trim();!C||u.includes(C)||(p(H=>[...H,C]),v(""),_(!0))},M=C=>{p(H=>H.filter(Z=>Z!==C)),_(!0)},U=async()=>{w(!0);try{await ZP(u),_(!1)}catch{}finally{w(!1)}};return h.jsx("div",{className:"min-h-screen bg-background",children:h.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),h.jsxs(VK,{defaultValue:"providers",children:[h.jsxs(eL,{className:"mb-4",children:[h.jsx(jc,{value:"providers",children:"云盘账号"}),h.jsx(jc,{value:"strategy",children:"备份策略"}),h.jsx(jc,{value:"history",children:"备份记录"})]}),h.jsxs(Uc,{value:"providers",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(te,{onClick:()=>a(!0),children:[h.jsx(oa,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),r?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):h.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>h.jsx(XK,{provider:C,onDelete:N,onReauth:P},C.id))})]}),h.jsx(qK,{open:s,onOpenChange:a,onAdded:()=>void D()})]}),h.jsx(Uc,{value:"strategy",children:h.jsxs("div",{className:"space-y-8",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),f?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(C=>h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,h.jsx("button",{onClick:()=>M(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:h.jsx(os,{className:"h-3 w-3"})})]},C))}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(wn,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&j()},className:"max-w-xs"}),h.jsx(te,{variant:"outline",size:"sm",onClick:j,children:"添加"})]}),y&&h.jsxs(te,{onClick:U,disabled:S,children:[h.jsx(KT,{className:"h-4 w-4 mr-1"}),S?"保存中...":"保存"]})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),c?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(yw,{checked:o.enabled,onCheckedChange:F}),h.jsx(je,{children:o.enabled?"已开启":"已关闭"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(je,{children:"备份间隔"}),h.jsxs(Du,{value:String(o.intervalMinutes),onValueChange:B,children:[h.jsx(il,{className:"w-48",children:h.jsx(Mu,{})}),h.jsx(sl,{children:tY.map(C=>h.jsx(mn,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),h.jsx(Uc,{value:"history",children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{T(!0),O()},children:[h.jsx(Ki,{className:"h-4 w-4 mr-1"}),"刷新"]})}),E?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):h.jsx(eY,{history:k})]})})]})]})})}function rY(){const e=ss(),[t,n]=b.useState([]),[r,i]=b.useState(!0),[s,a]=b.useState(null),[o,l]=b.useState(""),[c,d]=b.useState(null),[u,p]=b.useState(null),[f,g]=b.useState(null),[m,v]=b.useState(new Set);b.useEffect(()=>{FP().then(n).catch(k=>a(k instanceof Error?k.message:"Failed to load SkillHub")).finally(()=>i(!1))},[]);const y=b.useMemo(()=>{const k=new Set;return t.forEach(x=>{var E;return(E=x.tags)==null?void 0:E.forEach(T=>k.add(T))}),Array.from(k).sort()},[t]),_=b.useMemo(()=>t.some(k=>!k.tags||k.tags.length===0),[t]),S=b.useMemo(()=>{let k=t;if(c==="__untagged__"?k=k.filter(x=>!x.tags||x.tags.length===0):c&&(k=k.filter(x=>{var E;return(E=x.tags)==null?void 0:E.includes(c)})),o.trim()){const x=o.toLowerCase();k=k.filter(E=>{var T;return E.label.toLowerCase().includes(x)||E.description.toLowerCase().includes(x)||E.command.toLowerCase().includes(x)||E.author.toLowerCase().includes(x)||((T=E.tags)==null?void 0:T.some(D=>D.toLowerCase().includes(x)))})}return k},[t,o,c]),w=async(k,x)=>{if(x.stopPropagation(),!(f||m.has(k.id))){g(k.id);try{await jP(k.id),v(E=>new Set(E).add(k.id)),n(E=>E.map(T=>T.id===k.id?{...T,downloads:(T.downloads||0)+1}:T))}catch(E){alert(E instanceof Error?E.message:"Download failed")}finally{g(null)}}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[h.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Wo,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"relative w-64",children:[h.jsx(TF,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(wn,{placeholder:"搜索命令...",value:o,onChange:k=>l(k.target.value),className:"pl-8 h-9"})]})]})}),h.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[y.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(null),children:"全部"}),y.map(k=>h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===k?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(c===k?null:k),children:k},k)),_&&h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>d(c==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),s&&h.jsx("div",{className:"text-center text-destructive py-20",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[h.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),h.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!r&&!s&&t.length>0&&S.length===0&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),h.jsx("div",{className:"space-y-3",children:S.map(k=>{var R;const x=u===k.id,E=m.has(k.id),T=f===k.id,D=k.parentId?t.find(I=>I.id===k.parentId):void 0;return h.jsxs("div",{className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>p(x?null:k.id),children:[h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-medium text-sm truncate",children:k.label}),(R=k.tags)==null?void 0:R.map(I=>h.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[h.jsx(DF,{className:"h-2.5 w-2.5"}),I]},I))]}),D&&h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(_o,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",D.label]})]}),k.description&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:k.description}),h.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(YT,{className:"h-3 w-3"}),k.author]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(pu,{className:"h-3 w-3"}),k.downloads||0]}),h.jsx("span",{children:k.createdAt})]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsxs(te,{size:"sm",variant:E?"outline":"default",disabled:T||E,onClick:I=>w(k,I),title:D?`将同时下载继承的「${D.label}」`:void 0,children:[h.jsx(pu,{className:"h-3.5 w-3.5 mr-1"}),E?"已下载":T?"下载中...":"下载"]}),x?h.jsx(VT,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(pl,{className:"h-4 w-4 text-muted-foreground"})]})]}),x&&h.jsx("div",{className:"mt-3 pt-3 border-t",children:h.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:k.command})})]},k.id)})})]})]})}function dc({children:e}){const[t,n]=b.useState(!1),[r,i]=b.useState(!1);return b.useEffect(()=>{if(kr()){i(!0),n(!0);return}uf()?jT().then(a=>{cf(a),i(!0)}).catch(()=>{i(!1)}).finally(()=>n(!0)):n(!0)},[]),t?r?h.jsx(h.Fragment,{children:e}):h.jsx(ET,{to:"/login",replace:!0}):null}function iY(){return h.jsx(L3,{children:h.jsx(TM,{children:h.jsxs(EM,{children:[h.jsx(Ni,{path:"/login",element:h.jsx(rF,{})}),h.jsx(Ni,{path:"/",element:h.jsx(dc,{children:h.jsx(D3,{})})}),h.jsx(Ni,{path:"/projects/:id",element:h.jsx(dc,{children:h.jsx(RK,{})})}),h.jsx(Ni,{path:"/settings",element:h.jsx(dc,{children:h.jsx(nY,{})})}),h.jsx(Ni,{path:"/skillhub",element:h.jsx(dc,{children:h.jsx(rY,{})})}),h.jsx(Ni,{path:"*",element:h.jsx(ET,{to:"/",replace:!0})})]})})})}hp.createRoot(document.getElementById("root")).render(h.jsx(ft.StrictMode,{children:h.jsx(iY,{})}));export{Pu as a,$c as c,sY as g};
|